Merge "deferred: make DeferredUpdates::attemptUpdate() use callback owners for $fname...
[lhc/web/wiklou.git] / includes / libs / rdbms / loadbalancer / LoadBalancer.php
index 69bd51f..d088aa9 100644 (file)
@@ -177,11 +177,10 @@ class LoadBalancer implements ILoadBalancer {
                                $server['replica'] = true;
                        }
                        $this->servers[$i] = $server;
-                       $serverGroupLoads = [ self::GROUP_GENERIC => $server['load'] ];
-                       $serverGroupLoads += ( $server['groupLoads'] ?? [] );
-                       foreach ( $serverGroupLoads as $group => $ratio ) {
+                       foreach ( ( $server['groupLoads'] ?? [] ) as $group => $ratio ) {
                                $this->groupLoads[$group][$i] = $ratio;
                        }
+                       $this->groupLoads[self::GROUP_GENERIC][$i] = $server['load'];
                }
 
                $localDomain = isset( $params['localDomain'] )
@@ -593,8 +592,7 @@ class LoadBalancer implements ILoadBalancer {
                        $this->connLogger->debug( __METHOD__ . ": Using reader #$i: $serverName..." );
 
                        // Get a connection to this server without triggering other server connections
-                       $flags = self::CONN_SILENCE_ERRORS;
-                       $conn = $this->getServerConnection( $i, $domain, $flags );
+                       $conn = $this->getServerConnection( $i, $domain, self::CONN_SILENCE_ERRORS );
                        if ( !$conn ) {
                                $this->connLogger->warning( __METHOD__ . ": Failed connecting to $i/$domain" );
                                unset( $currentLoads[$i] ); // avoid this server next iteration
@@ -1920,13 +1918,8 @@ class LoadBalancer implements ILoadBalancer {
                }
 
                if ( $this->hasStreamingReplicaServers() ) {
-                       try {
-                               // Set "laggedReplicaMode"
-                               $this->getReaderIndex( self::GROUP_GENERIC, $domain );
-                       } catch ( DBConnectionError $e ) {
-                               // Sanity: avoid expensive re-connect attempts and failures
-                               $this->laggedReplicaMode = true;
-                       }
+                       // This will set "laggedReplicaMode" as needed
+                       $this->getReaderIndex( self::GROUP_GENERIC, $domain );
                }
 
                return $this->laggedReplicaMode;
@@ -1936,15 +1929,6 @@ class LoadBalancer implements ILoadBalancer {
                return $this->laggedReplicaMode;
        }
 
-       /**
-        * @return bool
-        * @since 1.27
-        * @deprecated Since 1.28; use laggedReplicaUsed()
-        */
-       public function laggedSlaveUsed() {
-               return $this->laggedReplicaUsed();
-       }
-
        public function getReadOnlyReason( $domain = false, IDatabase $conn = null ) {
                if ( $this->readOnlyReason !== false ) {
                        return $this->readOnlyReason;
@@ -2217,14 +2201,6 @@ class LoadBalancer implements ILoadBalancer {
                $this->indexAliases = $aliases;
        }
 
-       /**
-        * @param string $prefix
-        * @deprecated Since 1.33
-        */
-       public function setDomainPrefix( $prefix ) {
-               $this->setLocalDomainPrefix( $prefix );
-       }
-
        public function setLocalDomainPrefix( $prefix ) {
                // Find connections to explicit foreign domains still marked as in-use...
                $domainsInUse = [];