From: Aaron Schulz Date: Tue, 6 Sep 2016 00:09:08 +0000 (-0700) Subject: Renamed some variables from "slave" to "replica" X-Git-Tag: 1.31.0-rc.0~5754 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22config_fonctions%22%2C%20%22image_process=%24process%22%29%20.%20%22?a=commitdiff_plain;h=57e19b610dbe6c33984b1b6408ee6906340bf05a;p=lhc%2Fweb%2Fwiklou.git Renamed some variables from "slave" to "replica" Change-Id: I455278294cd7ea344d14a76ac5957ece2e07fbf3 --- 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."