From 6bb0f4fb95ee814e4ff6e9b4061416908f41c910 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 8 Aug 2019 23:23:05 -0700 Subject: [PATCH] objectcache: rename getDB() to getConnection() in SqlBagOStuff Change-Id: I7ec33e2622f5b418712d76bedcbb4be65376cf91 --- includes/objectcache/SqlBagOStuff.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index a1820abeda..fe27b787a6 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -169,7 +169,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { * @return IMaintainableDatabase * @throws MWException */ - private function getDB( $shardIndex ) { + private function getConnection( $shardIndex ) { if ( $shardIndex >= $this->numServerShards ) { throw new MWException( __METHOD__ . ": Invalid server index \"$shardIndex\"" ); } @@ -290,7 +290,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $dataRows = []; foreach ( $keysByTable as $shardIndex => $serverKeys ) { try { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); foreach ( $serverKeys as $tableName => $tableKeys ) { $res = $db->select( $tableName, [ 'keyname', 'value', 'exptime' ], @@ -321,7 +321,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $this->debug( "get: retrieved data; expiry time is " . $row->exptime ); $db = null; // in case of connection failure try { - $db = $this->getDB( $row->shardIndex ); + $db = $this->getConnection( $row->shardIndex ); if ( $this->isExpired( $db, $row->exptime ) ) { // MISS $this->debug( "get: key has expired" ); } else { // HIT @@ -364,7 +364,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { foreach ( $keysByTable as $shardIndex => $serverKeys ) { $db = null; // in case of connection failure try { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); $this->occasionallyGarbageCollect( $db ); // expire old entries if any $dbExpiry = $exptime ? $db->timestamp( $exptime ) : $this->getMaxDateTime( $db ); } catch ( DBError $e ) { @@ -479,7 +479,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $silenceScope = $this->silenceTransactionProfiler(); $db = null; // in case of connection failure try { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); // (T26425) use a replace if the db supports it instead of // delete/insert to avoid clashes with conflicting keynames $db->update( @@ -533,7 +533,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $silenceScope = $this->silenceTransactionProfiler(); $db = null; // in case of connection failure try { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); $encTimestamp = $db->addQuotes( $db->timestamp() ); $db->update( $tableName, @@ -647,7 +647,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { foreach ( $shardIndexes as $numServersDone => $shardIndex ) { $db = null; // in case of connection failure try { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); $this->deleteServerObjectsExpiringBefore( $db, $timestamp, @@ -752,7 +752,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { for ( $shardIndex = 0; $shardIndex < $this->numServerShards; $shardIndex++ ) { $db = null; // in case of connection failure try { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); for ( $i = 0; $i < $this->numTableShards; $i++ ) { $db->delete( $this->getTableNameByShard( $i ), '*', __METHOD__ ); } @@ -779,7 +779,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $db = null; // in case of connection failure try { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); $ok = $db->lock( $key, __METHOD__, $timeout ); if ( $ok ) { $this->locks[$key] = [ 'class' => $rclass, 'depth' => 1 ]; @@ -811,7 +811,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { $db = null; // in case of connection failure try { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); $ok = $db->unlock( $key, __METHOD__ ); if ( !$ok ) { $this->logger->warning( @@ -947,7 +947,7 @@ class SqlBagOStuff extends MediumSpecificBagOStuff { */ public function createTables() { for ( $shardIndex = 0; $shardIndex < $this->numServerShards; $shardIndex++ ) { - $db = $this->getDB( $shardIndex ); + $db = $this->getConnection( $shardIndex ); if ( $db->getType() !== 'mysql' ) { throw new MWException( __METHOD__ . ' is not supported on this DB server' ); } -- 2.20.1