From c4bcbc22c987cfff151afb06de28cc72d3e7653b Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 9 Mar 2011 00:24:21 +0000 Subject: [PATCH] Merge r83555 from 1.17wmf1: fix wait for slaves code from r83529 --- includes/db/LoadBalancer.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 5f2af19443..3ceb536668 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -346,7 +346,7 @@ class LoadBalancer { wfProfileIn( __METHOD__ ); $this->mWaitForPos = $pos; for ( $i = 1; $i < count( $this->mServers ); $i++ ) { - $this->doWait( $i ); + $this->doWait( $i , true ); } wfProfileOut( __METHOD__ ); } @@ -367,12 +367,20 @@ class LoadBalancer { /** * Wait for a given slave to catch up to the master pos stored in $this */ - function doWait( $index ) { + function doWait( $index, $open ) { # Find a connection to wait on $conn = $this->getAnyOpenConnection( $index ); if ( !$conn ) { - wfDebug( __METHOD__ . ": no connection open\n" ); - return false; + if ( !$open ) { + wfDebug( __METHOD__ . ": no connection open\n" ); + return false; + } else { + $conn = $this->openConnection( $index ); + if ( !$conn ) { + wfDebug( __METHOD__ . ": failed to open connection\n" ); + return false; + } + } } wfDebug( __METHOD__.": Waiting for slave #$index to catch up...\n" ); -- 2.20.1