As seen in here: https://gerrit.wikimedia.org/g/mediawiki/core/+/4bc5734399d240534af95139cefced7df760c5e2/maintenance/updateSpecialPages.php#138
private function reopenAndWaitForReplicas() { $lbFactory = $this->getServiceContainer()->getDBLoadBalancerFactory(); $lb = $lbFactory->getMainLB(); if ( !$lb->pingAll() ) { $this->output( "\n" ); do { $this->error( "Connection failed, reconnecting in 10 seconds..." ); sleep( 10 ); } while ( !$lb->pingAll() ); $this->output( "Reconnected\n\n" ); } // Wait for the replica DB to catch up $this->waitForReplication(); }
This will get stuck if the DB it was previously using gets taken down for maintenance or something similar.