r90423 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90422‎ | r90423 | r90424 >
Date:00:46, 20 June 2011
Author:tstarling
Status:ok
Tags:
Comment:
Merged r90266 from REL1_17: fixed bug 29233: slave DB failover
Modified paths:
  • /branches/wmf/1.17wmf1/includes/db/LoadBalancer.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/db/LoadBalancer.php
@@ -220,7 +220,8 @@
221221 $i = $this->getRandomNonLagged( $currentLoads, $wiki );
222222 if ( $i === false && count( $currentLoads ) != 0 ) {
223223 # All slaves lagged. Switch to read-only mode
224 - $wgReadOnly = wfMsgNoDBForContent( 'readonly_lag' );
 224+ $wgReadOnly = 'The database has been automatically locked ' .
 225+ 'while the slave database servers catch up to the master';
225226 $i = $this->pickRandom( $currentLoads );
226227 $laggedSlaveMode = true;
227228 }
@@ -650,7 +651,13 @@
651652
652653 # Create object
653654 wfDebug( "Connecting to $host $dbname...\n" );
654 - $db = new $class( $host, $user, $password, $dbname, $flags );
 655+ try {
 656+ $db = new $class( $host, $user, $password, $dbname, $flags );
 657+ } catch ( DBConnectionError $e ) {
 658+ // FIXME: This is probably the ugliest thing I have ever done to
 659+ // PHP. I'm half-expecting it to segfault, just out of disgust. -- TS
 660+ $db = $e->db;
 661+ }
655662 if ( $db->isOpen() ) {
656663 wfDebug( "Connected to $host $dbname.\n" );
657664 } else {
Property changes on: branches/wmf/1.17wmf1/includes/db/LoadBalancer.php
___________________________________________________________________
Added: svn:mergeinfo
658665 Merged /branches/new-installer/phase3/includes/db/LoadBalancer.php:r43664-66004
659666 Merged /branches/wmf-deployment/includes/db/LoadBalancer.php:r53381,60970
660667 Merged /branches/REL1_15/phase3/includes/db/LoadBalancer.php:r51646
661668 Merged /branches/wmf/1.16wmf4/includes/db/LoadBalancer.php:r67177,69199,76243,77266
662669 Merged /branches/REL1_17/phase3/includes/db/LoadBalancer.php:r90266
663670 Merged /branches/sqlite/includes/db/LoadBalancer.php:r58211-58321
664671 Merged /trunk/phase3/includes/db/LoadBalancer.php:r83590,89512-89513

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90266* (bug 29233) Temporary fix which roughly restores the 1.16 behaviour of open...tstarling12:59, 17 June 2011

Status & tagging log