*/
private function getDBConnection( $mode, $groups = [] ) {
$lb = $this->getDBLoadBalancer();
- return $lb->getConnection( $mode, $groups, $this->dbDomain );
+ return $lb->getConnectionRef( $mode, $groups, $this->dbDomain );
}
/**
* @return IDatabase
*/
private static function getDB( $index, $groups = [] ) {
- $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
-
- return $lb->getConnection( $index, $groups );
+ return MediaWikiServices::getInstance()
+ ->getDBLoadBalancer()
+ ->getConnectionRef( $index, $groups );
}
}
*/
private function getDBConnection( $index ) {
$lb = $this->getDBLoadBalancer();
- return $lb->getConnection( $index, [], $this->dbDomain );
+ return $lb->getConnectionRef( $index, [], $this->dbDomain );
}
/**
use Wikimedia\Rdbms\DBError;
use Wikimedia\Rdbms\DBQueryError;
use Wikimedia\Rdbms\DBConnectionError;
+use Wikimedia\Rdbms\IMaintainableDatabase;
use Wikimedia\Rdbms\LoadBalancer;
use Wikimedia\ScopedCallback;
use Wikimedia\WaitConditionLoop;
* Get a connection to the specified database
*
* @param int $serverIndex
- * @return Database
+ * @return IMaintainableDatabase
* @throws MWException
*/
protected function getDB( $serverIndex ) {
$index = $this->replicaOnly ? DB_REPLICA : DB_MASTER;
if ( $lb->getServerType( $lb->getWriterIndex() ) !== 'sqlite' ) {
// Keep a separate connection to avoid contention and deadlocks
- $db = $lb->getConnection( $index, [], false, $lb::CONN_TRX_AUTOCOMMIT );
+ $db = $lb->getConnectionRef( $index, [], false, $lb::CONN_TRX_AUTOCOMMIT );
} else {
// However, SQLite has the opposite behavior due to DB-level locking.
// Stock sqlite MediaWiki installs use a separate sqlite cache DB instead.
- $db = $lb->getConnection( $index );
+ $db = $lb->getConnectionRef( $index );
}
}