Index: branches/wmf/1.17wmf1/maintenance/runBatchedQuery.php |
— | — | @@ -29,7 +29,6 @@ |
30 | 30 | parent::__construct(); |
31 | 31 | $this->mDescription = "Run a query repeatedly until it affects 0 rows, and wait for slaves in between.\n" . |
32 | 32 | "NOTE: You need to set a LIMIT clause yourself."; |
33 | | - $this->addOption( 'wait', "Wait for replication lag to go down to this value. Default: 5", false, true ); |
34 | 33 | } |
35 | 34 | |
36 | 35 | public function execute() { |
— | — | @@ -46,7 +45,7 @@ |
47 | 46 | $dbw->query( $query, __METHOD__ ); |
48 | 47 | $affected = $dbw->affectedRows(); |
49 | 48 | $this->output( "$affected rows\n" ); |
50 | | - wfWaitForSlaves( $wait ); |
| 49 | + wfWaitForSlaves_masterPos(); |
51 | 50 | } while ( $affected > 0 ); |
52 | 51 | } |
53 | 52 | |
Index: branches/wmf/1.17wmf1/includes/GlobalFunctions.php |
— | — | @@ -3425,6 +3425,22 @@ |
3426 | 3426 | } |
3427 | 3427 | |
3428 | 3428 | /** |
| 3429 | + * Modern version of wfWaitForSlaves(). Instead of looking at replication lag |
| 3430 | + * and waiting for it to go down, this waits for the slaves to catch up to the |
| 3431 | + * master position. This is much better for lag control than wfWaitForSlaves() |
| 3432 | + */ |
| 3433 | +function wfWaitForSlaves_masterPos() { |
| 3434 | + $lb = wfGetLB(); |
| 3435 | + // bug 27975 - Don't try to wait for slaves if there are none |
| 3436 | + // Prevents permission error when getting master position |
| 3437 | + if ( $lb->getServerCount() > 1 ) { |
| 3438 | + $dbw = $lb->getConnection( DB_MASTER ); |
| 3439 | + $pos = $dbw->getMasterPos(); |
| 3440 | + $lb->waitForAll( $pos ); |
| 3441 | + } |
| 3442 | +} |
| 3443 | + |
| 3444 | +/** |
3429 | 3445 | * Used to be used for outputting text in the installer/updater |
3430 | 3446 | * @deprecated Warnings in 1.19, removal in 1.20 |
3431 | 3447 | */ |
Property changes on: branches/wmf/1.17wmf1/includes/GlobalFunctions.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
3432 | 3448 | Merged /trunk/phase3/includes/GlobalFunctions.php:r86398 |