Make JobRunner::commitMasterChanges() check getServerCount()
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 17 Nov 2015 04:37:42 +0000 (20:37 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 17 Nov 2015 04:37:42 +0000 (20:37 -0800)
This is a sanity check to avoid problems in waitForOne()

Change-Id: I9792ea8fb69d560bd4adb9bd01515f6456b7e9f3

includes/jobqueue/JobRunner.php

index dd2ef8f..b121dfe 100644 (file)
@@ -451,7 +451,7 @@ class JobRunner implements LoggerAwareInterface {
                global $wgJobSerialCommitThreshold;
 
                $lb = wfGetLB( wfWikiID() );
-               if ( $wgJobSerialCommitThreshold !== false ) {
+               if ( $wgJobSerialCommitThreshold !== false && $lb->getServerCount() > 1 ) {
                        // Generally, there is one master connection to the local DB
                        $dbwSerial = $lb->getAnyOpenConnection( $lb->getWriterIndex() );
                } else {