From: Aaron Schulz Date: Thu, 12 Oct 2017 19:00:07 +0000 (-0700) Subject: Remove useless commit calls in JobRunner X-Git-Tag: 1.31.0-rc.0~1798^2 X-Git-Url: http://git.cyclocoop.org/%27http:/code.google.com/p/ie7-js/00?a=commitdiff_plain;h=7f571f9bca4f562332e9d7d3c73d983646dab8bf;p=lhc%2Fweb%2Fwiklou.git Remove useless commit calls in JobRunner These were meant as sanity checks, but would fail in those unusual cases anyway with exceptions. Instead, have an early check to make sure no explicit transaction rounds are active when JobRunner:run is called. Change-Id: I723c77c8d3ef7ec4dcf09ce6d549b4fd57bdf1c2 --- diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index db881d5eb9..fa7d605731 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -119,6 +119,7 @@ class JobRunner implements LoggerAwareInterface { $response['reached'] = 'none-possible'; return $response; } + // Bail out if DB is in read-only mode if ( wfReadOnly() ) { $response['reached'] = 'read-only'; @@ -126,6 +127,9 @@ class JobRunner implements LoggerAwareInterface { } $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + if ( $lbFactory->hasTransactionRound() ) { + throw new LogicException( __METHOD__ . ' called with an active transaction round.' ); + } // Bail out if there is too much DB lag. // This check should not block as we want to try other wiki queues. list( , $maxLag ) = $lbFactory->getMainLB( wfWikiID() )->getMaxLag(); @@ -134,9 +138,6 @@ class JobRunner implements LoggerAwareInterface { return $response; } - // Flush any pending DB writes for sanity - $lbFactory->commitAll( __METHOD__ ); - // Catch huge single updates that lead to replica DB lag $trxProfiler = Profiler::instance()->getTransactionProfiler(); $trxProfiler->setLogger( LoggerFactory::getInstance( 'DBPerformance' ) ); @@ -170,7 +171,6 @@ class JobRunner implements LoggerAwareInterface { } else { $job = $group->pop( $type ); // job from a single queue } - $lbFactory->commitMasterChanges( __METHOD__ ); // flush any JobQueueDB writes if ( $job ) { // found a job ++$jobsPopped; @@ -193,7 +193,6 @@ class JobRunner implements LoggerAwareInterface { $info = $this->executeJob( $job, $lbFactory, $stats, $popTime ); if ( $info['status'] !== false || !$job->allowRetries() ) { $group->ack( $job ); // succeeded or job cannot be retried - $lbFactory->commitMasterChanges( __METHOD__ ); // flush any JobQueueDB writes } // Back off of certain jobs for a while (for throttling and for errors)