*
* @param string|bool $group Query group or false for the generic group
* @param string|bool $domain DB domain ID or false for the local domain
- * @throws DBError If no live handle can be obtained
- * @return bool|int|string
+ * @return int|bool Returns false if no live handle can be obtained
*/
public function getReaderIndex( $group = false, $domain = false );
$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
}
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;