r83555 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83554‎ | r83555 | r83556 >
Date:00:21, 9 March 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17wmf1: Live hack to fix wait for slaves logic. Will merge to trunk
Modified paths:
  • /branches/wmf/1.17wmf1/includes/db/LoadBalancer.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/db/LoadBalancer.php
@@ -346,7 +346,7 @@
347347 wfProfileIn( __METHOD__ );
348348 $this->mWaitForPos = $pos;
349349 for ( $i = 1; $i < count( $this->mServers ); $i++ ) {
350 - $this->doWait( $i );
 350+ $this->doWait( $i , true );
351351 }
352352 wfProfileOut( __METHOD__ );
353353 }
@@ -367,12 +367,20 @@
368368 /**
369369 * Wait for a given slave to catch up to the master pos stored in $this
370370 */
371 - function doWait( $index ) {
 371+ function doWait( $index, $open ) {
372372 # Find a connection to wait on
373373 $conn = $this->getAnyOpenConnection( $index );
374374 if ( !$conn ) {
375 - wfDebug( __METHOD__ . ": no connection open\n" );
376 - return false;
 375+ if ( !$open ) {
 376+ wfDebug( __METHOD__ . ": no connection open\n" );
 377+ return false;
 378+ } else {
 379+ $conn = $this->openConnection( $index );
 380+ if ( !$conn ) {
 381+ wfDebug( __METHOD__ . ": failed to open connection\n" );
 382+ return false;
 383+ }
 384+ }
377385 }
378386
379387 wfDebug( __METHOD__.": Waiting for slave #$index to catch up...\n" );

Follow-up revisions

RevisionCommit summaryAuthorDate
r83558Merge r83555 from 1.17wmf1: fix wait for slaves code from r83529catrope00:24, 9 March 2011
r83590Followup r83558, r83555...reedy16:37, 9 March 2011
r83591MFT r83590, fixing r83555reedy16:39, 9 March 2011

Status & tagging log