Pass __METHOD__ to load balancer commit/rollback methods
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 23 Dec 2015 02:30:20 +0000 (18:30 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 23 Dec 2015 02:30:20 +0000 (18:30 -0800)
Change-Id: I3fd87908c2a493fae49de6a29efe79f8d433c112

includes/MediaWiki.php
includes/db/loadbalancer/LBFactoryMulti.php
includes/db/loadbalancer/LBFactorySimple.php
includes/deferred/DeferredUpdates.php
includes/exception/MWExceptionHandler.php
includes/jobqueue/JobRunner.php
maintenance/doMaintenance.php

index be0073d..3b5a1b1 100644 (file)
@@ -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" );
index e58aead..e25499c 100644 (file)
@@ -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
        }
 }
index 1c9e094..3349e1f 100644 (file)
@@ -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
        }
 }
index fb6ef13..5583588 100644 (file)
@@ -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__ );
                                }
                        }
 
index 26960ff..88d94f1 100644 (file)
@@ -143,7 +143,7 @@ class MWExceptionHandler {
                                self::getLogMessage( $e ),
                                self::getLogContext( $e )
                        );
-                       $factory->rollbackMasterChanges();
+                       $factory->rollbackMasterChanges( __METHOD__ );
                }
        }
 
index 5666415..6d2ce0e 100644 (file)
@@ -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__ );
index e66b729..3a844bc 100644 (file)
@@ -113,5 +113,5 @@ wfLogProfilingData();
 
 // Commit and close up!
 $factory = wfGetLBFactory();
-$factory->commitMasterChanges();
+$factory->commitMasterChanges( 'doMaintenance' );
 $factory->shutdown();