Do not count 0-load servers in getMaxLag()
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 21 May 2016 10:40:03 +0000 (03:40 -0700)
committerOri.livneh <ori@wikimedia.org>
Mon, 23 May 2016 18:42:56 +0000 (18:42 +0000)
JobRunner::run() and API endpoints use this to bail out if
lag is too high. A dedicated "vslow" host with no normal
load should not trigger this logic, for example.

Bug: T135809
Change-Id: If6879aa1a4379857779a4eacf2a8b7400c0b434f

includes/db/loadbalancer/LoadBalancer.php

index 5578099..1f2f494 100644 (file)
@@ -1334,7 +1334,7 @@ class LoadBalancer {
 
                $lagTimes = $this->getLagTimes( $wiki );
                foreach ( $lagTimes as $i => $lag ) {
-                       if ( $lag > $maxLag ) {
+                       if ( $this->mLoads[$i] > 0 && $lag > $maxLag ) {
                                $maxLag = $lag;
                                $host = $this->mServers[$i]['host'];
                                $maxIndex = $i;