From: Aaron Schulz Date: Tue, 10 Nov 2015 20:18:00 +0000 (-0800) Subject: Make getLaggedSlaveMode() use reuseConnection() as needed X-Git-Tag: 1.31.0-rc.0~9029^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=17f34355c1cf50077319c8a6369d5a04ec5a42d8;p=lhc%2Fweb%2Fwiklou.git Make getLaggedSlaveMode() use reuseConnection() as needed Bug: T118162 Change-Id: I03e1386b952a9e9243518c12fb175727f81c9976 --- diff --git a/includes/db/loadbalancer/LoadBalancer.php b/includes/db/loadbalancer/LoadBalancer.php index 65ee9c716a..052a0fade5 100644 --- a/includes/db/loadbalancer/LoadBalancer.php +++ b/includes/db/loadbalancer/LoadBalancer.php @@ -594,7 +594,6 @@ class LoadBalancer { $refCount = $conn->getLBInfo( 'foreignPoolRefCount' ); if ( $serverIndex === null || $refCount === null ) { wfDebug( __METHOD__ . ": this connection was not opened as a foreign connection\n" ); - /** * This can happen in code like: * foreach ( $dbs as $db ) { @@ -605,7 +604,6 @@ class LoadBalancer { * When a connection to the local DB is opened in this way, reuseConnection() * should be ignored */ - return; } @@ -1173,7 +1171,8 @@ class LoadBalancer { if ( !$this->laggedSlaveMode && $this->getServerCount() > 1 ) { try { // See if laggedSlaveMode gets set - $this->getConnection( DB_SLAVE, false, $wiki ); + $conn = $this->getConnection( DB_SLAVE, false, $wiki ); + $this->reuseConnection( $conn ); } catch ( DBConnectionError $e ) { // Avoid expensive re-connect attempts and failures $this->slavesDownMode = true;