objectcache: Make SqlBagOStuff::waitForSlaves() no-op without slaves
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 30 Aug 2016 22:32:09 +0000 (15:32 -0700)
committerKrinkle <krinklemail@gmail.com>
Tue, 30 Aug 2016 22:47:04 +0000 (22:47 +0000)
Change-Id: Ibaa4745c18c6f4f66edb4c5f190196b575d3b738

includes/objectcache/SqlBagOStuff.php

index 7a89991..73f8280 100644 (file)
@@ -801,6 +801,10 @@ class SqlBagOStuff extends BagOStuff {
                if ( $this->usesMainDB() ) {
                        $lb = $this->getSeparateMainLB()
                                ?: MediaWikiServices::getInstance()->getDBLoadBalancer();
+                       // Return if there are no slaves
+                       if ( $lb->getServerCount() <= 1 ) {
+                               return true;
+                       }
                        // Main LB is used; wait for any slaves to catch up
                        try {
                                $pos = $lb->getMasterPos();