objectcache: remove dangling WAN cache EventRelayer references
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 17 Feb 2019 03:44:36 +0000 (19:44 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Sun, 17 Feb 2019 04:22:32 +0000 (20:22 -0800)
* Remove 'channels' field references from config/setup
* Remove 'relayer'/'channels' field reference in unit tests
* Remove unused DEFAULT_PURGE_CHANNEL class constant
* Also remove long-since bogus 'pool' field references

Follow-up to 4753b0a4ed4b6b8abb

Change-Id: If6670ff4e1dccc8ae253a08b46d205601da10024

includes/DefaultSettings.php
includes/Setup.php
includes/libs/objectcache/WANObjectCache.php
includes/libs/objectcache/WANObjectCacheReaper.php
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php

index dc8f1e8..537f411 100644 (file)
@@ -2456,23 +2456,20 @@ $wgMainWANCache = false;
  *
  * The format is an associative array where the key is a cache identifier, and
  * the value is an associative array of parameters. The "cacheId" parameter is
- * a cache identifier from $wgObjectCaches. The "channels" parameter is a map of
- * actions ('purge') to PubSub channels defined in $wgEventRelayerConfig.
- * The "loggroup" parameter controls where log events are sent.
+ * a cache identifier from $wgObjectCaches. The "loggroup" parameter controls
+ * where log events are sent.
  *
  * @since 1.26
  */
 $wgWANObjectCaches = [
        CACHE_NONE => [
                'class'    => WANObjectCache::class,
-               'cacheId'  => CACHE_NONE,
-               'channels' => []
+               'cacheId'  => CACHE_NONE
        ]
        /* Example of a simple single data-center cache:
        'memcached-php' => [
                'class'    => WANObjectCache::class,
-               'cacheId'  => 'memcached-php',
-               'channels' => [ 'purge' => 'wancache-main-memcached-purge' ]
+               'cacheId'  => 'memcached-php'
        ]
        */
 ];
index b4b6ce6..f8b9546 100644 (file)
@@ -690,8 +690,7 @@ if ( $wgMainWANCache === false ) {
        $wgMainWANCache = 'mediawiki-main-default';
        $wgWANObjectCaches[$wgMainWANCache] = [
                'class'    => WANObjectCache::class,
-               'cacheId'  => $wgMainCacheType,
-               'channels' => [ 'purge' => 'wancache-main-default-purge' ]
+               'cacheId'  => $wgMainCacheType
        ];
 }
 
index f9debaf..2329140 100644 (file)
@@ -221,8 +221,6 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
 
        const PC_PRIMARY = 'primary:1000'; // process cache name and max key count
 
-       const DEFAULT_PURGE_CHANNEL = 'wancache-purge';
-
        /**
         * @param array $params
         *   - cache    : BagOStuff object for a persistent cache
index e4ab95c..fb8a754 100644 (file)
@@ -69,7 +69,6 @@ class WANObjectCacheReaper implements LoggerAwareInterface {
         *        The callback must fully duck-type test the object, since can be any model class.
         * @param array $params Additional options:
         *          - channel: the name of the update event stream.
-        *            Default: WANObjectCache::DEFAULT_PURGE_CHANNEL.
         *          - initialStartWindow: seconds back in time to start if the position is lost.
         *            Default: 1 hour.
         *          - logger: an SPL monolog instance [optional]
index 369b2bf..d9b7e18 100644 (file)
@@ -30,9 +30,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                parent::setUp();
 
                $this->cache = new WANObjectCache( [
-                       'cache' => new HashBagOStuff(),
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] )
+                       'cache' => new HashBagOStuff()
                ] );
 
                $wanCache = TestingAccessWrapper::newFromObject( $this->cache );
@@ -440,8 +438,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                };
 
                $cache = new NearExpiringWANObjectCache( [
-                       'cache'        => new HashBagOStuff(),
-                       'pool'         => 'empty',
+                       'cache'        => new HashBagOStuff()
                ] );
 
                $wasSet = 0;
@@ -468,7 +465,6 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                };
                $cache = new NearExpiringWANObjectCache( [
                        'cache'        => new HashBagOStuff(),
-                       'pool'         => 'empty',
                        'asyncHandler' => $asyncHandler
                ] );
 
@@ -500,8 +496,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                $this->assertEquals( $value, $v, "New value stored" );
 
                $cache = new PopularityRefreshingWANObjectCache( [
-                       'cache'   => new HashBagOStuff(),
-                       'pool'    => 'empty'
+                       'cache'   => new HashBagOStuff()
                ] );
 
                $mockWallClock = $priorTime;
@@ -694,7 +689,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        WANObjectCache::VALUE_KEY_PREFIX . 'k1' => 'val-id1',
                        WANObjectCache::VALUE_KEY_PREFIX . 'k2' => 'val-id2'
                ] );
-               $wanCache = new WANObjectCache( [ 'cache' => $localBag, 'pool' => 'testcache-hash' ] );
+               $wanCache = new WANObjectCache( [ 'cache' => $localBag ] );
 
                // Warm the process cache
                $keyedIds = new ArrayIterator( [ 'k1' => 'id1', 'k2' => 'id2' ] );
@@ -1504,9 +1499,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        ->willReturn( false );
 
                $wanCache = new WANObjectCache( [
-                       'cache' => $backend,
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] )
+                       'cache' => $backend
                ] );
 
                $isStale = null;
@@ -1556,8 +1549,6 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                $localBag->expects( $this->never() )->method( 'delete' );
                $wanCache = new WANObjectCache( [
                        'cache' => $localBag,
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] ),
                        'mcrouterAware' => true,
                        'region' => 'pmtpa',
                        'cluster' => 'mw-wan'
@@ -1582,8 +1573,6 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        ->setMethods( [ 'set' ] )->getMock();
                $wanCache = new WANObjectCache( [
                        'cache' => $localBag,
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] ),
                        'mcrouterAware' => true,
                        'region' => 'pmtpa',
                        'cluster' => 'mw-wan'
@@ -1600,8 +1589,6 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        ->setMethods( [ 'set' ] )->getMock();
                $wanCache = new WANObjectCache( [
                        'cache' => $localBag,
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] ),
                        'mcrouterAware' => true,
                        'region' => 'pmtpa',
                        'cluster' => 'mw-wan'
@@ -1618,8 +1605,6 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        ->setMethods( [ 'delete' ] )->getMock();
                $wanCache = new WANObjectCache( [
                        'cache' => $localBag,
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] ),
                        'mcrouterAware' => true,
                        'region' => 'pmtpa',
                        'cluster' => 'mw-wan'
@@ -1633,7 +1618,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
 
        public function testEpoch() {
                $bag = new HashBagOStuff();
-               $cache = new WANObjectCache( [ 'cache' => $bag, 'pool' => 'testcache-hash' ] );
+               $cache = new WANObjectCache( [ 'cache' => $bag ] );
                $key = $cache->makeGlobalKey( 'The whole of the Law' );
 
                $now = microtime( true );
@@ -1649,7 +1634,6 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
 
                $cache = new WANObjectCache( [
                        'cache' => $bag,
-                       'pool' => 'testcache-hash',
                        'epoch' => $now - 3600
                ] );
                $cache->setMockTime( $now );
@@ -1660,7 +1644,6 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                $now += 30;
                $cache = new WANObjectCache( [
                        'cache' => $bag,
-                       'pool' => 'testcache-hash',
                        'epoch' => $now + 3600
                ] );
                $cache->setMockTime( $now );
@@ -1746,9 +1729,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        ->willReturn( 'special' );
 
                $wanCache = new WANObjectCache( [
-                       'cache' => $backend,
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] )
+                       'cache' => $backend
                ] );
 
                $this->assertSame( 'special', $wanCache->makeKey( 'a', 'b' ) );
@@ -1764,9 +1745,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        ->willReturn( 'special' );
 
                $wanCache = new WANObjectCache( [
-                       'cache' => $backend,
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] )
+                       'cache' => $backend
                ] );
 
                $this->assertSame( 'special', $wanCache->makeGlobalKey( 'a', 'b' ) );
@@ -1787,9 +1766,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
         */
        public function testStatsKeyClass( $key, $class ) {
                $wanCache = TestingAccessWrapper::newFromObject( new WANObjectCache( [
-                       'cache' => new HashBagOStuff,
-                       'pool' => 'testcache-hash',
-                       'relayer' => new EventRelayerNull( [] )
+                       'cache' => new HashBagOStuff
                ] ) );
 
                $this->assertEquals( $class, $wanCache->determineKeyClass( $key ) );