From: Roan Kattouw Date: Wed, 9 Mar 2011 00:24:21 +0000 (+0000) Subject: Merge r83555 from 1.17wmf1: fix wait for slaves code from r83529 X-Git-Tag: 1.31.0-rc.0~31548 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=c4bcbc22c987cfff151afb06de28cc72d3e7653b;p=lhc%2Fweb%2Fwiklou.git Merge r83555 from 1.17wmf1: fix wait for slaves code from r83529 --- 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" );