From: Marius Hoch Date: Tue, 13 Oct 2015 20:50:47 +0000 (+0200) Subject: LoadBalancer::getLaggedSlaveMode needs to know about the wiki X-Git-Tag: 1.31.0-rc.0~9375^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24ze_article%22%29%20.%20%22?a=commitdiff_plain;h=e2d1c2f06c7fd5e7564f2bc788ea3d7ffc5a7edd;p=lhc%2Fweb%2Fwiklou.git LoadBalancer::getLaggedSlaveMode needs to know about the wiki If not asked for the current wiki. This is relevant in setups with LBFactoryMulti where one LoadBalancer only knows about some database servers and not necessarily about the ones of the current wiki, but we still try to open a connection with the current wiki database. Change-Id: Ie6a87c587c68df6380e568a16c57f7a05ec084f6 --- diff --git a/includes/db/loadbalancer/LoadBalancer.php b/includes/db/loadbalancer/LoadBalancer.php index fbc8c8cdd3..eda374a1b8 100644 --- a/includes/db/loadbalancer/LoadBalancer.php +++ b/includes/db/loadbalancer/LoadBalancer.php @@ -549,7 +549,7 @@ class LoadBalancer { } # Make master connections read only if in lagged slave mode - if ( $masterOnly && $this->getServerCount() > 1 && $this->getLaggedSlaveMode() ) { + if ( $masterOnly && $this->getServerCount() > 1 && $this->getLaggedSlaveMode( $wiki ) ) { $conn->setLBInfo( 'readOnlyReason', 'The database has been automatically locked ' . 'while the slave database servers catch up to the master' @@ -1142,11 +1142,13 @@ class LoadBalancer { /** * @note This method will trigger a DB connection if not yet done + * + * @param string|bool $wiki Wiki ID, or false for the current wiki * @return bool Whether the generic connection for reads is highly "lagged" */ - public function getLaggedSlaveMode() { + public function getLaggedSlaveMode( $wiki = false ) { # Get a generic reader connection - $this->getConnection( DB_SLAVE ); + $this->getConnection( DB_SLAVE, false, $wiki ); return $this->mLaggedSlaveMode; }