[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Change $wiki => $domain in LoadBalancer
jenkins-bot has submitted this change and it was merged. Change subject: Change $wiki => $domain in LoadBalancer .. Change $wiki => $domain in LoadBalancer Change-Id: I97f96383c501e9b3262c11d143795b82ae36aca5 --- M includes/db/loadbalancer/LoadBalancer.php 1 file changed, 74 insertions(+), 74 deletions(-) Approvals: Krinkle: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/db/loadbalancer/LoadBalancer.php b/includes/db/loadbalancer/LoadBalancer.php index 841231b..f2cf232 100644 --- a/includes/db/loadbalancer/LoadBalancer.php +++ b/includes/db/loadbalancer/LoadBalancer.php @@ -82,7 +82,7 @@ private $trxRoundId = false; /** @var array[] Map of (name => callable) */ private $trxRecurringCallbacks = []; - /** @var string Local Wiki ID and default for selectDB() calls */ + /** @var string Local Domain ID and default for selectDB() calls */ private $localDomain; /** @var string Current server name */ private $host; @@ -202,12 +202,12 @@ /** * @param array $loads -* @param bool|string $wiki Wiki to get non-lagged for +* @param bool|string $domain Domain to get non-lagged for * @param int $maxLag Restrict the maximum allowed lag to this many seconds * @return bool|int|string */ - private function getRandomNonLagged( array $loads, $wiki = false, $maxLag = INF ) { - $lags = $this->getLagTimes( $wiki ); + private function getRandomNonLagged( array $loads, $domain = false, $maxLag = INF ) { + $lags = $this->getLagTimes( $domain ); # Unset excessively lagged servers foreach ( $lags as $i => $lag ) { @@ -251,7 +251,7 @@ return ArrayUtils::pickRandom( $loads ); } - public function getReaderIndex( $group = false, $wiki = false ) { + public function getReaderIndex( $group = false, $domain = false ) { if ( count( $this->mServers ) == 1 ) { # Skip the load balancing if there's only one server return $this->getWriterIndex(); @@ -279,7 +279,7 @@ } # Scale the configured load ratios according to the dynamic load if supported - $this->getLoadMonitor()->scaleLoads( $nonErrorLoads, $group, $wiki ); + $this->getLoadMonitor()->scaleLoads( $nonErrorLoads, $group, $domain ); $laggedReplicaMode = false; @@ -299,11 +299,11 @@ # avoid lagged servers so as to avoid just blocking in that method. $ago = microtime( true ) - $this->mWaitForPos->asOfTime(); # Aim for <= 1 second of waiting (being too picky can backfire) - $i = $this->getRandomNonLagged( $currentLoads, $wiki, $ago + 1 ); + $i = $this->getRandomNonLagged( $currentLoads, $domain, $ago + 1 ); } if ( $i === false ) { # Any server with less lag than it's 'max lag' param is preferable - $i = $this->getRandomNonLagged( $currentLoads, $wiki ); + $i = $this->getRandomNonLagged( $currentLoads, $domain ); } if ( $i === false && count( $currentLoads ) != 0 ) { # All replica DBs lagged. Switch to read-only mode @@ -325,9 +325,9 @@ $serverName = $this->getServerName( $i ); $this->connLogger->debug( __METHOD__ . ": Using reader #$i: $serverName..." ); - $conn = $this->openConnection( $i, $wiki ); + $conn = $this->openConnection( $i, $domain ); if ( !$conn ) { - $this->connLogger->warning( __METHOD__ . ": Failed connecting to $i/$wiki" ); + $this->connLogger->warning( __METHOD__ . ": Failed connecting to $i/$domain" ); unset( $nonErrorLoads[$i] ); unset( $currentLoads[$i] ); $i = false; @@ -336,7 +336,7 @@ // Decrement reference counter, we are finished with this connection. // It will be incremented for the caller later. - if ( $wiki !== false ) { + if ( $domain !== false ) { $this->reuseConnection( $conn ); } @@ -500,14 +500,14 @@ return $ok; } - public function getConnection(
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Change $wiki => $domain in LoadBalancer
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/310723 Change subject: Change $wiki => $domain in LoadBalancer .. Change $wiki => $domain in LoadBalancer Change-Id: I97f96383c501e9b3262c11d143795b82ae36aca5 --- M includes/db/loadbalancer/LoadBalancer.php 1 file changed, 74 insertions(+), 74 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/23/310723/1 diff --git a/includes/db/loadbalancer/LoadBalancer.php b/includes/db/loadbalancer/LoadBalancer.php index 841231b..f2cf232 100644 --- a/includes/db/loadbalancer/LoadBalancer.php +++ b/includes/db/loadbalancer/LoadBalancer.php @@ -82,7 +82,7 @@ private $trxRoundId = false; /** @var array[] Map of (name => callable) */ private $trxRecurringCallbacks = []; - /** @var string Local Wiki ID and default for selectDB() calls */ + /** @var string Local Domain ID and default for selectDB() calls */ private $localDomain; /** @var string Current server name */ private $host; @@ -202,12 +202,12 @@ /** * @param array $loads -* @param bool|string $wiki Wiki to get non-lagged for +* @param bool|string $domain Domain to get non-lagged for * @param int $maxLag Restrict the maximum allowed lag to this many seconds * @return bool|int|string */ - private function getRandomNonLagged( array $loads, $wiki = false, $maxLag = INF ) { - $lags = $this->getLagTimes( $wiki ); + private function getRandomNonLagged( array $loads, $domain = false, $maxLag = INF ) { + $lags = $this->getLagTimes( $domain ); # Unset excessively lagged servers foreach ( $lags as $i => $lag ) { @@ -251,7 +251,7 @@ return ArrayUtils::pickRandom( $loads ); } - public function getReaderIndex( $group = false, $wiki = false ) { + public function getReaderIndex( $group = false, $domain = false ) { if ( count( $this->mServers ) == 1 ) { # Skip the load balancing if there's only one server return $this->getWriterIndex(); @@ -279,7 +279,7 @@ } # Scale the configured load ratios according to the dynamic load if supported - $this->getLoadMonitor()->scaleLoads( $nonErrorLoads, $group, $wiki ); + $this->getLoadMonitor()->scaleLoads( $nonErrorLoads, $group, $domain ); $laggedReplicaMode = false; @@ -299,11 +299,11 @@ # avoid lagged servers so as to avoid just blocking in that method. $ago = microtime( true ) - $this->mWaitForPos->asOfTime(); # Aim for <= 1 second of waiting (being too picky can backfire) - $i = $this->getRandomNonLagged( $currentLoads, $wiki, $ago + 1 ); + $i = $this->getRandomNonLagged( $currentLoads, $domain, $ago + 1 ); } if ( $i === false ) { # Any server with less lag than it's 'max lag' param is preferable - $i = $this->getRandomNonLagged( $currentLoads, $wiki ); + $i = $this->getRandomNonLagged( $currentLoads, $domain ); } if ( $i === false && count( $currentLoads ) != 0 ) { # All replica DBs lagged. Switch to read-only mode @@ -325,9 +325,9 @@ $serverName = $this->getServerName( $i ); $this->connLogger->debug( __METHOD__ . ": Using reader #$i: $serverName..." ); - $conn = $this->openConnection( $i, $wiki ); + $conn = $this->openConnection( $i, $domain ); if ( !$conn ) { - $this->connLogger->warning( __METHOD__ . ": Failed connecting to $i/$wiki" ); + $this->connLogger->warning( __METHOD__ . ": Failed connecting to $i/$domain" ); unset( $nonErrorLoads[$i] ); unset( $currentLoads[$i] ); $i = false; @@ -336,7 +336,7 @@ // Decrement reference counter, we are finished with this connection. // It will be incremented for the caller later. - if ( $wiki !== false ) { + if ( $domain !== false ) { $this->reuseConnection( $conn ); } @@ -500,14 +500,14 @@ return $ok;