Change-Id: I0b7fd896c88b06cbc17b31b1ae2b9cb8e375da1b
$replicaDB = $this->getOption( 'replicadb', $this->getOption( 'slave', '' ) );
if ( $replicaDB === 'any' ) {
$index = DB_REPLICA;
- } elseif ( $replicaDB != '' ) {
+ } elseif ( $replicaDB !== '' ) {
$index = null;
$serverCount = $lb->getServerCount();
for ( $i = 0; $i < $serverCount; ++$i ) {
break;
}
}
- if ( $index === null ) {
+ if ( $index === null || $index === $lb->getWriterIndex() ) {
$this->fatalError( "No replica DB server configured with the name '$replicaDB'." );
}
} else {