Use the main stash for LBFactory "memStash" parameter
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 17 Aug 2017 03:13:35 +0000 (20:13 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 10 Nov 2017 00:31:08 +0000 (00:31 +0000)
This store is used for ChronologyProtector positions.
It should be cross-DC since the sticky DC cookie may not work
for rapid cross-wiki farm activity, causing some request go to
the non-primary DC.

NOTE: this change should be deployed on all farm wikis at once

Change-Id: Ife126592aacace696e43912b9461164a9ea98bc1

includes/db/MWLBFactory.php

index 5196ac2..aa1918d 100644 (file)
@@ -142,16 +142,18 @@ abstract class MWLBFactory {
                        }
                }
 
+               $services = MediaWikiServices::getInstance();
+
                // Use APC/memcached style caching, but avoids loops with CACHE_DB (T141804)
-               $sCache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
+               $sCache = $services->getLocalServerObjectCache();
                if ( $sCache->getQoS( $sCache::ATTR_EMULATION ) > $sCache::QOS_EMULATION_SQL ) {
                        $lbConf['srvCache'] = $sCache;
                }
-               $cCache = ObjectCache::getLocalClusterInstance();
-               if ( $cCache->getQoS( $cCache::ATTR_EMULATION ) > $cCache::QOS_EMULATION_SQL ) {
-                       $lbConf['memStash'] = $cCache;
+               $mStash = $services->getMainObjectStash();
+               if ( $mStash->getQoS( $mStash::ATTR_EMULATION ) > $mStash::QOS_EMULATION_SQL ) {
+                       $lbConf['memStash'] = $mStash;
                }
-               $wCache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+               $wCache = $services->getMainWANObjectCache();
                if ( $wCache->getQoS( $wCache::ATTR_EMULATION ) > $wCache::QOS_EMULATION_SQL ) {
                        $lbConf['wanCache'] = $wCache;
                }