From e2d1c2f06c7fd5e7564f2bc788ea3d7ffc5a7edd Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Tue, 13 Oct 2015 22:50:47 +0200 Subject: [PATCH] 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 --- includes/db/loadbalancer/LoadBalancer.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; } -- 2.20.1