From 934357cc6e9662db4675fb60e2935e3f06e07c70 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Sun, 13 Apr 2008 06:23:39 +0000 Subject: [PATCH] * don't shortcut readerindex for querygroups * don't record readerindex if already recorded, or not in global loads --- includes/LoadBalancer.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; } } -- 2.20.1