Previously, passing a specific server index (even the master index)
would result in a connection to some server in $groups or the generic
read group being selected.
Change-Id: Ifb497f5f4bb61f16b310d4d30fb8315e3bcdce8e
* 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
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 );