From e73f4a21f5f869562935584fff4860b534206a62 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 2 Jul 2018 16:49:28 +0100 Subject: [PATCH] rdbms: give TransactionProfiler write time and row count for ROLLBACK This will hopefully provide more diagnostic info when DBTransactionSizeError rollbacks are triggered. Bug: T190260 Change-Id: Ib8bea5a9ec7d3ffeaf423adb930dc6fb14314449 --- includes/libs/rdbms/database/Database.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index d11b51b0fd..dc3260d4d4 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -3844,9 +3844,11 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->assertOpen(); $this->runOnTransactionPreCommitCallbacks(); + $writeTime = $this->pendingWriteQueryDuration( self::ESTIMATE_DB_APPLY ); $this->doCommit( $fname ); $this->trxStatus = self::STATUS_TRX_NONE; + if ( $this->trxDoneWrites ) { $this->lastWriteTime = microtime( true ); $this->trxProfiler->transactionWritingOut( @@ -3894,14 +3896,18 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware // Avoid fatals if close() was called $this->assertOpen(); + $writeTime = $this->pendingWriteQueryDuration( self::ESTIMATE_DB_APPLY ); $this->doRollback( $fname ); $this->trxStatus = self::STATUS_TRX_NONE; $this->trxAtomicLevels = []; + if ( $this->trxDoneWrites ) { $this->trxProfiler->transactionWritingOut( $this->server, $this->dbName, - $this->trxShortId + $this->trxShortId, + $writeTime, + $this->trxWriteAffectedRows ); } } -- 2.20.1