Steps to replicate the issue:
- Configure your local wiki setup to have another database named centralauth on the same section as your main test wiki (doesn't matter if via a virtual domain or not).
- Run this maintenance script:
<?php use Wikimedia\Rdbms\IDatabase; require_once __DIR__ . '/../../maintenance/Maintenance.php'; class DBReuse extends Maintenance { public function execute() { $lbFactory = $this->getServiceContainer()->getDBLoadBalancerFactory(); $lbFactory->beginPrimaryChanges( __METHOD__ ); $this->test( false ); $this->test( 'centralauth' ); $lbFactory->commitPrimaryChanges( __METHOD__ ); } /** * @param string|bool $domain */ private function test( $domain ) { $connectionProvider = $this->getServiceContainer()->getConnectionProvider(); $dbw = $connectionProvider->getPrimaryDatabase( $domain ); $dbw->query( 'select 1' ); if ( $domain === false ) { $dbw->onTransactionPreCommitOrIdle( static function ( IDatabase $dbw ): void { var_dump( $dbw->getDomainID() ); }, ); } } } $maintClass = DBReuse::class; require RUN_MAINTENANCE_IF_MAIN;
What happens?:
It outputs string(11) "centralauth".
What should have happened instead?:
It should output string(...) "<your local test DB name>".
This caused a train blocker UBN: T386171.