- if ( $i !== false ) {
- # Replica DB connection successful.
- # Wait for the session master pos for a short time.
- if ( $this->mWaitForPos && $i > 0 ) {
- # When LoadBalancer::waitFor() set mWaitForPos, the wait will happen here.
- # Be sure to update laggedReplicaMode accordingly for consistency.
- if ( !$this->doWait( $i ) ) {
- $laggedReplicaMode = true;
- }
- }
- if ( $this->mReadIndex <= 0 && $this->mLoads[$i] > 0 && $group === false ) {
- $this->mReadIndex = $i;
- # Record if the generic reader index is in "lagged replica DB" mode
- if ( $laggedReplicaMode ) {
- $this->laggedReplicaMode = true;
- }
- }
- $serverName = $this->getServerName( $i );
- $this->connLogger->debug(
- __METHOD__ . ": using server $serverName for group '$group'" );
- }
-
- return $i;