From 57e19b610dbe6c33984b1b6408ee6906340bf05a Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 5 Sep 2016 17:09:08 -0700 Subject: [PATCH] Renamed some variables from "slave" to "replica" Change-Id: I455278294cd7ea344d14a76ac5957ece2e07fbf3 --- includes/WatchedItemStore.php | 6 +++--- includes/api/ApiMain.php | 4 ++-- includes/jobqueue/JobRunner.php | 4 ++-- includes/objectcache/SqlBagOStuff.php | 8 ++++---- includes/user/User.php | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php index 6986a2f892..9a74401a43 100644 --- a/includes/WatchedItemStore.php +++ b/includes/WatchedItemStore.php @@ -190,13 +190,13 @@ class WatchedItemStore implements StatsdAwareInterface { } /** - * @param int $slaveOrMaster DB_MASTER or DB_REPLICA + * @param int $dbIndex DB_MASTER or DB_REPLICA * * @return DatabaseBase * @throws MWException */ - private function getConnection( $slaveOrMaster ) { - return $this->loadBalancer->getConnection( $slaveOrMaster, [ 'watchlist' ] ); + private function getConnection( $dbIndex ) { + return $this->loadBalancer->getConnection( $dbIndex, [ 'watchlist' ] ); } /** diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 2ce51202fe..1f3c76a636 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -1323,8 +1323,8 @@ class ApiMain extends ApiBase { } // If a majority of replica DBs are too lagged then disallow writes - $slaveCount = wfGetLB()->getServerCount() - 1; - if ( $numLagged >= ceil( $slaveCount / 2 ) ) { + $replicaCount = wfGetLB()->getServerCount() - 1; + if ( $numLagged >= ceil( $replicaCount / 2 ) ) { $laggedServers = implode( ', ', $laggedServers ); wfDebugLog( 'api-readonly', diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index 134ba9d706..f0d5eceaf0 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -118,7 +118,7 @@ class JobRunner implements LoggerAwareInterface { // This check should not block as we want to try other wiki queues. list( , $maxLag ) = wfGetLB( wfWikiID() )->getMaxLag(); if ( $maxLag >= self::MAX_ALLOWED_LAG ) { - $response['reached'] = 'slave-lag-limit'; + $response['reached'] = 'replica-lag-limit'; return $response; } @@ -221,7 +221,7 @@ class JobRunner implements LoggerAwareInterface { 'timeout' => self::MAX_ALLOWED_LAG ] ); } catch ( DBReplicationWaitError $e ) { - $response['reached'] = 'slave-lag-limit'; + $response['reached'] = 'replica-lag-limit'; break; } $lastCheckTime = microtime( true ); diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 4870d5eb70..3baae50641 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -44,7 +44,7 @@ class SqlBagOStuff extends BagOStuff { /** @var string */ protected $tableName = 'objectcache'; /** @var bool */ - protected $slaveOnly = false; + protected $replicaOnly = false; /** @var int */ protected $syncTimeout = 3; @@ -132,7 +132,7 @@ class SqlBagOStuff extends BagOStuff { if ( isset( $params['syncTimeout'] ) ) { $this->syncTimeout = $params['syncTimeout']; } - $this->slaveOnly = !empty( $params['slaveOnly'] ); + $this->replicaOnly = !empty( $params['slaveOnly'] ); } protected function getSeparateMainLB() { @@ -183,7 +183,7 @@ class SqlBagOStuff extends BagOStuff { $db = DatabaseBase::factory( $type, $info ); $db->clearFlag( DBO_TRX ); } else { - $index = $this->slaveOnly ? DB_REPLICA : DB_MASTER; + $index = $this->replicaOnly ? DB_REPLICA : DB_MASTER; if ( $this->getSeparateMainLB() ) { $db = $this->getSeparateMainLB()->getConnection( $index ); $db->clearFlag( DBO_TRX ); // auto-commit mode @@ -539,7 +539,7 @@ class SqlBagOStuff extends BagOStuff { } protected function garbageCollect() { - if ( !$this->purgePeriod || $this->slaveOnly ) { + if ( !$this->purgePeriod || $this->replicaOnly ) { // Disabled return; } diff --git a/includes/user/User.php b/includes/user/User.php index 971ef7019f..248ea8e194 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -3841,7 +3841,7 @@ class User implements IDBAccessObject { // Maybe the problem was a missed cache update; clear it to be safe $this->clearSharedCache( 'refresh' ); // User was changed in the meantime or loaded with stale data - $from = ( $this->queryFlagsUsed & self::READ_LATEST ) ? 'master' : 'slave'; + $from = ( $this->queryFlagsUsed & self::READ_LATEST ) ? 'master' : 'replica'; throw new MWException( "CAS update failed on user_touched for user ID '{$this->mId}' (read from $from);" . " the version of the user to be saved is older than the current version." -- 2.20.1