Exclude servers with zero load from lag checks
authorTim Starling <tstarling@wikimedia.org>
Mon, 18 Nov 2013 00:10:42 +0000 (11:10 +1100)
committerTim Starling <tstarling@wikimedia.org>
Mon, 18 Nov 2013 00:10:42 +0000 (11:10 +1100)
Since r13582, servers with zero load have been isolated from the rest of
the servers in the section in terms of query flow. However, lag checks
still remained. This is not appropriate for backup/QueryPage servers
that are routinely lagged. IIRC we dealt with this once before with a
special case in the core excluding benet from master pos waits, but that
doesn't seem like a very appropriate solution today. Perhaps there is an
application for including zero-load slaves in lag checks, but I can't
think of any right now.

Related WMF conf change in I8fac5c99.

Change-Id: Id354039123f8c04febc8090eea9940fff044c5ea

includes/DefaultSettings.php
includes/db/LoadBalancer.php

index d428910..4247d1c 100644 (file)
@@ -1608,7 +1608,12 @@ $wgSharedTables = array( 'user', 'user_properties' );
  *   - user:        DB user
  *   - password:    DB password
  *   - type:        "mysql" or "postgres"
- *   - load:        ratio of DB_SLAVE load, must be >=0, the sum of all loads must be >0
+ *
+ *   - load:        Ratio of DB_SLAVE load, must be >=0, the sum of all loads must be >0.
+ *                  If this is zero for any given server, no normal query traffic will be
+ *                  sent to it. It will be excluded from lag checks in maintenance scripts.
+ *                  The only way it can receive traffic is if groupLoads is used.
+ *
  *   - groupLoads:  array of load ratios, the key is the query group name. A query may belong
  *                  to several groups, the most specific group defined here is used.
  *
index 857109d..011c083 100644 (file)
@@ -373,7 +373,9 @@ class LoadBalancer {
                wfProfileIn( __METHOD__ );
                $this->mWaitForPos = $pos;
                for ( $i = 1; $i < count( $this->mServers ); $i++ ) {
-                       $this->doWait( $i, true );
+                       if ( $this->mLoads[$i] > 0 ) {
+                               $this->doWait( $i, true );
+                       }
                }
                wfProfileOut( __METHOD__ );
        }