From bf5a10414641d7bda378dd947a33ccca5d897e4f Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Mon, 26 Feb 2018 21:05:33 +0100 Subject: [PATCH] Remove wfWaitForSlaves when using Maintenance::commitTransaction Maintenance::commitTransaction is calling waitForReplication already. No need to wait a second time, hopefully the lags are 0 already. Change-Id: Id457ed2cdd6bfd9663665ba0cd5c4e3dd640b738 --- maintenance/deleteSelfExternals.php | 1 - maintenance/migrateActors.php | 1 - maintenance/migrateComments.php | 1 - maintenance/migrateUserGroup.php | 1 - maintenance/moveBatch.php | 1 - maintenance/populateLogUsertext.php | 1 - maintenance/populateRevisionLength.php | 1 - maintenance/populateRevisionSha1.php | 2 -- maintenance/storage/compressOld.php | 1 - maintenance/storage/fixT22757.php | 10 ---------- maintenance/updateCollation.php | 6 ------ 11 files changed, 26 deletions(-) diff --git a/maintenance/deleteSelfExternals.php b/maintenance/deleteSelfExternals.php index 20d5c2f0a9..9849dc500b 100644 --- a/maintenance/deleteSelfExternals.php +++ b/maintenance/deleteSelfExternals.php @@ -41,7 +41,6 @@ class DeleteSelfExternals extends Maintenance { $this->output( "Deleting self externals from $wgServer\n" ); $db = $this->getDB( DB_MASTER ); while ( 1 ) { - wfWaitForSlaves(); $this->commitTransaction( $db, __METHOD__ ); $q = $db->limitResult( "DELETE /* deleteSelfExternals */ FROM externallinks WHERE el_to" . $db->buildLike( $wgServer . '/', $db->anyString() ), $this->getBatchSize() ); diff --git a/maintenance/migrateActors.php b/maintenance/migrateActors.php index 1657f142b0..5b144fc347 100644 --- a/maintenance/migrateActors.php +++ b/maintenance/migrateActors.php @@ -386,7 +386,6 @@ class MigrateActors extends LoggedUpdateMaintenance { list( $n, $display ) = $this->makeNextCond( $dbw, [ $primaryKey ], $lastRow ); $next = [ $n ]; $this->output( "... $display\n" ); - wfWaitForSlaves(); } $this->output( diff --git a/maintenance/migrateComments.php b/maintenance/migrateComments.php index cb72c1ec2f..cdecab03c3 100644 --- a/maintenance/migrateComments.php +++ b/maintenance/migrateComments.php @@ -282,7 +282,6 @@ class MigrateComments extends LoggedUpdateMaintenance { // Calculate the "next" condition $next = [ $primaryKey . ' > ' . $dbw->addQuotes( $row->$primaryKey ) ]; $this->output( "... {$row->$primaryKey}\n" ); - wfWaitForSlaves(); } $this->output( diff --git a/maintenance/migrateUserGroup.php b/maintenance/migrateUserGroup.php index eeaddba101..bf8d071ce8 100644 --- a/maintenance/migrateUserGroup.php +++ b/maintenance/migrateUserGroup.php @@ -100,7 +100,6 @@ class MigrateUserGroup extends Maintenance { $count += $affected; $blockStart += $batchSize; $blockEnd += $batchSize; - wfWaitForSlaves(); } $this->output( "Done! $count users in group '$oldGroup' are now in '$newGroup' instead.\n" ); } diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php index 090c3d41d0..6d14f8af5d 100644 --- a/maintenance/moveBatch.php +++ b/maintenance/moveBatch.php @@ -117,7 +117,6 @@ class MoveBatch extends Maintenance { if ( $interval ) { sleep( $interval ); } - wfWaitForSlaves(); } } } diff --git a/maintenance/populateLogUsertext.php b/maintenance/populateLogUsertext.php index 55ad5368cb..cacd067f3e 100644 --- a/maintenance/populateLogUsertext.php +++ b/maintenance/populateLogUsertext.php @@ -85,7 +85,6 @@ class PopulateLogUsertext extends LoggedUpdateMaintenance { $this->commitTransaction( $db, __METHOD__ ); $blockStart += $batchSize; $blockEnd += $batchSize; - wfWaitForSlaves(); } $this->output( "Done populating log_user_text field.\n" ); diff --git a/maintenance/populateRevisionLength.php b/maintenance/populateRevisionLength.php index f83be9c793..bcc499947f 100644 --- a/maintenance/populateRevisionLength.php +++ b/maintenance/populateRevisionLength.php @@ -117,7 +117,6 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { $blockStart += $batchSize; $blockEnd += $batchSize; - wfWaitForSlaves(); } return $count; diff --git a/maintenance/populateRevisionSha1.php b/maintenance/populateRevisionSha1.php index 54937abc4a..d2372a94a5 100644 --- a/maintenance/populateRevisionSha1.php +++ b/maintenance/populateRevisionSha1.php @@ -109,7 +109,6 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $blockStart += $batchSize; $blockEnd += $batchSize; - wfWaitForSlaves(); } return $count; @@ -135,7 +134,6 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $updateSize = 0; $this->commitTransaction( $db, __METHOD__ ); $this->output( "Commited row with ar_timestamp={$row->ar_timestamp}\n" ); - wfWaitForSlaves(); $this->beginTransaction( $db, __METHOD__ ); } } diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php index 4414c5b0ae..a67e261e1e 100644 --- a/maintenance/storage/compressOld.php +++ b/maintenance/storage/compressOld.php @@ -462,7 +462,6 @@ class CompressOld extends Maintenance { $this->output( "/" ); $this->commitTransaction( $dbw, __METHOD__ ); $i += $thisChunkSize; - wfWaitForSlaves(); } $this->output( "\n" ); } diff --git a/maintenance/storage/fixT22757.php b/maintenance/storage/fixT22757.php index b7ae6918a4..da3ada7fa1 100644 --- a/maintenance/storage/fixT22757.php +++ b/maintenance/storage/fixT22757.php @@ -240,7 +240,6 @@ class FixT22757 extends Maintenance { __METHOD__ ); $this->commitTransaction( $dbw, __METHOD__ ); - $this->waitForSlaves(); } print "$primaryId: resolved to $url\n"; @@ -254,15 +253,6 @@ class FixT22757 extends Maintenance { print "Good stubs: $numGood\n"; } - function waitForSlaves() { - static $iteration = 0; - ++$iteration; - if ( ++$iteration > 50 == 0 ) { - wfWaitForSlaves(); - $iteration = 0; - } - } - function findTextIdInPage( $pageId, $textId ) { $ids = $this->getRevTextMap( $pageId ); if ( !isset( $ids[$textId] ) ) { diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 54ae1301f1..d88d5e968e 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -232,12 +232,6 @@ TEXT } else { $this->output( "$count done.\n" ); } - - if ( !$dryRun && ++$batchCount % self::SYNC_INTERVAL == 0 ) { - $this->output( "Waiting for replica DBs ... " ); - wfWaitForSlaves(); - $this->output( "done\n" ); - } } while ( $res->numRows() == self::BATCH_SIZE ); if ( !$dryRun ) { -- 2.20.1