From: Domas Mituzas Date: Sun, 13 Apr 2008 06:23:39 +0000 (+0000) Subject: * don't shortcut readerindex for querygroups X-Git-Tag: 1.31.0-rc.0~48390 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=934357cc6e9662db4675fb60e2935e3f06e07c70;p=lhc%2Fweb%2Fwiklou.git * don't shortcut readerindex for querygroups * don't record readerindex if already recorded, or not in global loads --- diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index 52fe9c1fea..fab42aae03 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -142,7 +142,8 @@ class LoadBalancer { if ( count( $this->mServers ) == 1 ) { # Skip the load balancing if there's only one server return 0; - } elseif ( $this->mReadIndex >= 0 ) { + } elseif ( $group === false and $this->mReadIndex >= 0 ) { + # Shortcut if generic reader exists already return $this->mReadIndex; } @@ -268,7 +269,7 @@ class LoadBalancer { $this->mServers[$i]['slave pos'] = $conn->getSlavePos(); } } - if ( $i !== false ) { + if ( $this->mReadIndex <=0 && $this->mLoads[$i]>0 && $i !== false ) { $this->mReadIndex = $i; } }