From 203565a9c1781e6947f98386e977ecc0e36fe431 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 18 Nov 2013 11:10:42 +1100 Subject: [PATCH] Exclude servers with zero load from lag checks 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 | 7 ++++++- includes/db/LoadBalancer.php | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index d428910ad9..4247d1c8fb 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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. * diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 857109db26..011c0831cc 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -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__ ); } -- 2.20.1