Use ESTIMATE_DB_APPLY for total transaction time estimate
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 11 Sep 2016 22:51:15 +0000 (15:51 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sun, 11 Sep 2016 23:04:21 +0000 (16:04 -0700)
Individual write queries already do this, but the COMMIT step
still used the old accounting.

Change-Id: I416a524d6652f933cbc49033b49745db732c8b92

includes/db/Database.php
includes/jobqueue/JobRunner.php
tests/phpunit/includes/db/DatabaseTestHelper.php

index ced7379..eca80d8 100644 (file)
@@ -2971,7 +2971,7 @@ abstract class DatabaseBase implements IDatabase {
                $this->assertOpen();
 
                $this->runOnTransactionPreCommitCallbacks();
-               $writeTime = $this->pendingWriteQueryDuration();
+               $writeTime = $this->pendingWriteQueryDuration( self::ESTIMATE_DB_APPLY );
                $this->doCommit( $fname );
                if ( $this->mTrxDoneWrites ) {
                        $this->mDoneWrites = microtime( true );
index 570d6db..022abd9 100644 (file)
@@ -504,6 +504,7 @@ class JobRunner implements LoggerAwareInterface {
        private function commitMasterChanges( LBFactory $lbFactory, Job $job, $fnameTrxOwner ) {
                global $wgJobSerialCommitThreshold;
 
+               $time = false;
                $lb = $lbFactory->getMainLB( wfWikiID() );
                if ( $wgJobSerialCommitThreshold !== false && $lb->getServerCount() > 1 ) {
                        // Generally, there is one master connection to the local DB
@@ -527,7 +528,7 @@ class JobRunner implements LoggerAwareInterface {
                        return;
                }
 
-               $ms = intval( 1000 * $dbwSerial->pendingWriteQueryDuration() );
+               $ms = intval( 1000 * $time );
                $msg = $job->toString() . " COMMIT ENQUEUED [{$ms}ms of writes]";
                $this->logger->info( $msg );
                $this->debugCallback( $msg );
index 33ccb4d..63322cc 100644 (file)
@@ -174,6 +174,11 @@ class DatabaseTestHelper extends DatabaseBase {
                return true;
        }
 
+       function ping( &$rtt = null ) {
+               $rtt = 0.0;
+               return true;
+       }
+
        protected function closeConnection() {
                return false;
        }