Remove wfWaitForSlaves when using Maintenance::commitTransaction
authorUmherirrender <umherirrender_de.wp@web.de>
Mon, 26 Feb 2018 20:05:33 +0000 (21:05 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Mon, 26 Feb 2018 20:05:33 +0000 (21:05 +0100)
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
maintenance/migrateActors.php
maintenance/migrateComments.php
maintenance/migrateUserGroup.php
maintenance/moveBatch.php
maintenance/populateLogUsertext.php
maintenance/populateRevisionLength.php
maintenance/populateRevisionSha1.php
maintenance/storage/compressOld.php
maintenance/storage/fixT22757.php
maintenance/updateCollation.php

index 20d5c2f..9849dc5 100644 (file)
@@ -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() );
index 1657f14..5b144fc 100644 (file)
@@ -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(
index cb72c1e..cdecab0 100644 (file)
@@ -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(
index eeaddba..bf8d071 100644 (file)
@@ -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" );
        }
index 090c3d4..6d14f8a 100644 (file)
@@ -117,7 +117,6 @@ class MoveBatch extends Maintenance {
                        if ( $interval ) {
                                sleep( $interval );
                        }
-                       wfWaitForSlaves();
                }
        }
 }
index 55ad536..cacd067 100644 (file)
@@ -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" );
 
index f83be9c..bcc4999 100644 (file)
@@ -117,7 +117,6 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance {
 
                        $blockStart += $batchSize;
                        $blockEnd += $batchSize;
-                       wfWaitForSlaves();
                }
 
                return $count;
index 54937ab..d2372a9 100644 (file)
@@ -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__ );
                        }
                }
index 4414c5b..a67e261 100644 (file)
@@ -462,7 +462,6 @@ class CompressOld extends Maintenance {
                                $this->output( "/" );
                                $this->commitTransaction( $dbw, __METHOD__ );
                                $i += $thisChunkSize;
-                               wfWaitForSlaves();
                        }
                        $this->output( "\n" );
                }
index b7ae691..da3ada7 100644 (file)
@@ -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] ) ) {
index 54ae130..d88d5e9 100644 (file)
@@ -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 ) {