From: jenkins-bot Date: Fri, 26 Jul 2019 14:02:29 +0000 (+0000) Subject: Merge "Convert LoadBalancer::getConnection() callers to LoadBalancer::getConnectionRef()" X-Git-Tag: 1.34.0-rc.0~870 X-Git-Url: http://git.cyclocoop.org/%27.%28%24current%20%3E%202?a=commitdiff_plain;h=22f137ced85fe4841c71ba6c2b9faf6199b5a539;hp=5099ee9f7273ea156eea8afa033548b800828639;p=lhc%2Fweb%2Fwiklou.git Merge "Convert LoadBalancer::getConnection() callers to LoadBalancer::getConnectionRef()" --- diff --git a/includes/Revision/RevisionStore.php b/includes/Revision/RevisionStore.php index 8a4b6dcfaf..fe5b5b94e9 100644 --- a/includes/Revision/RevisionStore.php +++ b/includes/Revision/RevisionStore.php @@ -284,7 +284,7 @@ class RevisionStore */ private function getDBConnection( $mode, $groups = [] ) { $lb = $this->getDBLoadBalancer(); - return $lb->getConnection( $mode, $groups, $this->dbDomain ); + return $lb->getConnectionRef( $mode, $groups, $this->dbDomain ); } /** diff --git a/includes/SiteStatsInit.php b/includes/SiteStatsInit.php index 932e1c3d55..2252f8f4ff 100644 --- a/includes/SiteStatsInit.php +++ b/includes/SiteStatsInit.php @@ -195,8 +195,8 @@ class SiteStatsInit { * @return IDatabase */ private static function getDB( $index, $groups = [] ) { - $lb = MediaWikiServices::getInstance()->getDBLoadBalancer(); - - return $lb->getConnection( $index, $groups ); + return MediaWikiServices::getInstance() + ->getDBLoadBalancer() + ->getConnectionRef( $index, $groups ); } } diff --git a/includes/Storage/SqlBlobStore.php b/includes/Storage/SqlBlobStore.php index 5260754f5f..d1b688b201 100644 --- a/includes/Storage/SqlBlobStore.php +++ b/includes/Storage/SqlBlobStore.php @@ -207,7 +207,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore { */ private function getDBConnection( $index ) { $lb = $this->getDBLoadBalancer(); - return $lb->getConnection( $index, [], $this->dbDomain ); + return $lb->getConnectionRef( $index, [], $this->dbDomain ); } /** diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 9226875e2a..6cc63bffb3 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -27,6 +27,7 @@ use Wikimedia\Rdbms\IDatabase; 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; @@ -165,7 +166,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { * Get a connection to the specified database * * @param int $serverIndex - * @return Database + * @return IMaintainableDatabase * @throws MWException */ protected function getDB( $serverIndex ) { @@ -199,11 +200,11 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $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 ); } }