Add version to LoadMonitor::getCacheKey()
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 4 Oct 2016 21:04:20 +0000 (14:04 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 4 Oct 2016 21:07:57 +0000 (21:07 +0000)
This avoids undefined index and "servers down" errors when
using Het Deploy since only the version has the new fields.

Bug: T147359
Change-Id: Ic2d0d147df2e1c015ec4a6675294203b2adf5ed9

includes/libs/rdbms/loadmonitor/LoadMonitor.php

index 59075e4..60400e3 100644 (file)
@@ -40,6 +40,8 @@ class LoadMonitor implements ILoadMonitor {
        /** @var float Moving average ratio (e.g. 0.1 for 10% weight to new weight) */
        private $movingAveRatio;
 
+       const VERSION = 1;
+
        public function __construct(
                ILoadBalancer $lb, BagOStuff $srvCache, BagOStuff $cache, array $options = []
        ) {
@@ -199,6 +201,7 @@ class LoadMonitor implements ILoadMonitor {
                // Lag is per-server, not per-DB, so key on the master DB name
                return $this->srvCache->makeGlobalKey(
                        'lag-times',
+                       self::VERSION,
                        $this->parent->getServerName( $this->parent->getWriterIndex() )
                );
        }