rdbms: give TransactionProfiler write time and row count for ROLLBACK
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 2 Jul 2018 15:49:28 +0000 (16:49 +0100)
committerKrinkle <krinklemail@gmail.com>
Wed, 18 Jul 2018 18:03:46 +0000 (18:03 +0000)
This will hopefully provide more diagnostic info when DBTransactionSizeError
rollbacks are triggered.

Bug: T190260
Change-Id: Ib8bea5a9ec7d3ffeaf423adb930dc6fb14314449

includes/libs/rdbms/database/Database.php

index d11b51b..dc3260d 100644 (file)
@@ -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
                                );
                        }
                }