From 58cffd04b8c6986355d4d2f5a054a5623e4ec564 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 22 Dec 2015 18:30:20 -0800 Subject: [PATCH] Pass __METHOD__ to load balancer commit/rollback methods Change-Id: I3fd87908c2a493fae49de6a29efe79f8d433c112 --- includes/MediaWiki.php | 6 +++--- includes/db/loadbalancer/LBFactoryMulti.php | 2 +- includes/db/loadbalancer/LBFactorySimple.php | 2 +- includes/deferred/DeferredUpdates.php | 4 ++-- includes/exception/MWExceptionHandler.php | 2 +- includes/jobqueue/JobRunner.php | 8 ++++---- maintenance/doMaintenance.php | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index be0073d01e..3b5a1b107c 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -554,7 +554,7 @@ class MediaWiki { } ); } ); // Commit all changes - $factory->commitMasterChanges(); + $factory->commitMasterChanges( __METHOD__ ); // Record ChronologyProtector positions $factory->shutdown(); wfDebug( __METHOD__ . ': all transactions committed' ); @@ -741,7 +741,7 @@ class MediaWiki { */ public function restInPeace( $mode = 'fast' ) { // Assure deferred updates are not in the main transaction - wfGetLBFactory()->commitMasterChanges(); + wfGetLBFactory()->commitMasterChanges( __METHOD__ ); // Ignore things like master queries/connections on GET requests // as long as they are in deferred updates (which catch errors). @@ -764,7 +764,7 @@ class MediaWiki { // Commit and close up! $factory = wfGetLBFactory(); - $factory->commitMasterChanges(); + $factory->commitMasterChanges( __METHOD__ ); $factory->shutdown( LBFactory::SHUTDOWN_NO_CHRONPROT ); wfDebug( "Request ended normally\n" ); diff --git a/includes/db/loadbalancer/LBFactoryMulti.php b/includes/db/loadbalancer/LBFactoryMulti.php index e58aead8e1..e25499c2b7 100644 --- a/includes/db/loadbalancer/LBFactoryMulti.php +++ b/includes/db/loadbalancer/LBFactoryMulti.php @@ -402,6 +402,6 @@ class LBFactoryMulti extends LBFactory { if ( !( $flags & self::SHUTDOWN_NO_CHRONPROT ) ) { $this->shutdownChronologyProtector( $this->chronProt ); } - $this->commitMasterChanges(); // sanity + $this->commitMasterChanges( __METHOD__ ); // sanity } } diff --git a/includes/db/loadbalancer/LBFactorySimple.php b/includes/db/loadbalancer/LBFactorySimple.php index 1c9e094469..3349e1f737 100644 --- a/includes/db/loadbalancer/LBFactorySimple.php +++ b/includes/db/loadbalancer/LBFactorySimple.php @@ -160,6 +160,6 @@ class LBFactorySimple extends LBFactory { if ( !( $flags & self::SHUTDOWN_NO_CHRONPROT ) ) { $this->shutdownChronologyProtector( $this->chronProt ); } - $this->commitMasterChanges(); // sanity + $this->commitMasterChanges( __METHOD__ ); // sanity } } diff --git a/includes/deferred/DeferredUpdates.php b/includes/deferred/DeferredUpdates.php index fb6ef13f5b..55835882ee 100644 --- a/includes/deferred/DeferredUpdates.php +++ b/includes/deferred/DeferredUpdates.php @@ -149,7 +149,7 @@ class DeferredUpdates { foreach ( $otherUpdates as $update ) { try { $update->doUpdate(); - wfGetLBFactory()->commitMasterChanges(); + wfGetLBFactory()->commitMasterChanges( __METHOD__ ); } catch ( Exception $e ) { // We don't want exceptions thrown during deferred updates to // be reported to the user since the output is already sent @@ -158,7 +158,7 @@ class DeferredUpdates { } // Make sure incomplete transactions are not committed and end any // open atomic sections so that other DB updates have a chance to run - wfGetLBFactory()->rollbackMasterChanges(); + wfGetLBFactory()->rollbackMasterChanges( __METHOD__ ); } } diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index 26960ffc3a..88d94f1164 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -143,7 +143,7 @@ class MWExceptionHandler { self::getLogMessage( $e ), self::getLogContext( $e ) ); - $factory->rollbackMasterChanges(); + $factory->rollbackMasterChanges( __METHOD__ ); } } diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index 5666415e47..6d2ce0eff9 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -126,7 +126,7 @@ class JobRunner implements LoggerAwareInterface { $group = JobQueueGroup::singleton(); // Flush any pending DB writes for sanity - wfGetLBFactory()->commitAll(); + wfGetLBFactory()->commitAll( __METHOD__ ); // Some jobs types should not run until a certain timestamp $backoffs = array(); // map of (type => UNIX expiry) @@ -192,7 +192,7 @@ class JobRunner implements LoggerAwareInterface { // Commit all outstanding connections that are in a transaction // to get a fresh repeatable read snapshot on every connection. // Note that jobs are still responsible for handling slave lag. - wfGetLBFactory()->commitAll(); + wfGetLBFactory()->commitAll( __METHOD__ ); // Clear out title cache data from prior snapshots LinkCache::singleton()->clear(); $timeMs = intval( ( microtime( true ) - $jobStartTime ) * 1000 ); @@ -464,7 +464,7 @@ class JobRunner implements LoggerAwareInterface { ) { // Writes are all to foreign DBs, named locks don't form queues, // or $wgJobSerialCommitThreshold is not reached; commit changes now - wfGetLBFactory()->commitMasterChanges(); + wfGetLBFactory()->commitMasterChanges( __METHOD__ ); return; } @@ -496,7 +496,7 @@ class JobRunner implements LoggerAwareInterface { } ); // Actually commit the DB master changes - wfGetLBFactory()->commitMasterChanges(); + wfGetLBFactory()->commitMasterChanges( __METHOD__ ); // Release the lock $dbwSerial->unlock( 'jobrunner-serial-commit', __METHOD__ ); diff --git a/maintenance/doMaintenance.php b/maintenance/doMaintenance.php index e66b7293c0..3a844bc555 100644 --- a/maintenance/doMaintenance.php +++ b/maintenance/doMaintenance.php @@ -113,5 +113,5 @@ wfLogProfilingData(); // Commit and close up! $factory = wfGetLBFactory(); -$factory->commitMasterChanges(); +$factory->commitMasterChanges( 'doMaintenance' ); $factory->shutdown(); -- 2.20.1