Merge "rdbms: make $i in LoadBalancer::getConnection override $groups"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 13 Apr 2018 16:30:37 +0000 (16:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 13 Apr 2018 16:30:37 +0000 (16:30 +0000)
includes/libs/rdbms/loadbalancer/ILoadBalancer.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php

index ae4362d..a699b23 100644 (file)
@@ -183,7 +183,7 @@ interface ILoadBalancer {
         * call ILoadBalancer::reuseConnection() on the handle when finished using it.
         * In all other cases, this is not necessary, though not harmful either.
         *
-        * @param int $i Server index or DB_MASTER/DB_REPLICA
+        * @param int $i Server index (overrides $groups) or DB_MASTER/DB_REPLICA
         * @param array|string|bool $groups Query group(s), or false for the generic reader
         * @param string|bool $domain Domain ID, or false for the current domain
         * @param int $flags Bitfield of CONN_* class constants
index c587b42..e2d3b33 100644 (file)
@@ -714,7 +714,7 @@ class LoadBalancer implements ILoadBalancer {
 
                if ( $i == self::DB_MASTER ) {
                        $i = $this->getWriterIndex();
-               } else {
+               } elseif ( $i == self::DB_REPLICA ) {
                        # Try to find an available server in any the query groups (in order)
                        foreach ( $groups as $group ) {
                                $groupIndex = $this->getReaderIndex( $group, $domain );