Remove unused DB position values in LoadBalancer
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 3 Sep 2016 21:58:38 +0000 (14:58 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 3 Sep 2016 21:58:38 +0000 (14:58 -0700)
Also fixed IDEA error about useless $conn declaration.

Change-Id: I73572cb201e44db45fbe9bdb8e06bff4b50cecb2

includes/db/loadbalancer/LoadBalancer.php

index 7ca0b33..d3a2902 100644 (file)
@@ -284,7 +284,6 @@ class LoadBalancer {
 
                # No server found yet
                $i = false;
-               $conn = false;
                # First try quickly looking through the available servers for a server that
                # meets our criteria
                $currentLoads = $nonErrorLoads;
@@ -353,9 +352,7 @@ class LoadBalancer {
                        # Replica DB connection successful.
                        # Wait for the session master pos for a short time.
                        if ( $this->mWaitForPos && $i > 0 ) {
-                               if ( !$this->doWait( $i ) ) {
-                                       $this->mServers[$i]['slave pos'] = $conn->getSlavePos();
-                               }
+                               $this->doWait( $i );
                        }
                        if ( $this->mReadIndex <= 0 && $this->mLoads[$i] > 0 && $group === false ) {
                                $this->mReadIndex = $i;
@@ -384,7 +381,6 @@ class LoadBalancer {
 
                if ( $i > 0 ) {
                        if ( !$this->doWait( $i ) ) {
-                               $this->mServers[$i]['slave pos'] = $this->getAnyOpenConnection( $i )->getSlavePos();
                                $this->laggedReplicaMode = true;
                        }
                }