Add wfWaitForSlaves() to maintenance/migrateComments.php
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 29 Nov 2017 19:52:31 +0000 (14:52 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 29 Nov 2017 19:52:31 +0000 (14:52 -0500)
Change-Id: Idb8d21116a52c473cc4658883fe13855bad92222

maintenance/migrateComments.php

index 01ee9f8..c000871 100644 (file)
@@ -144,6 +144,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
                $primaryKey = (array)$primaryKey;
                $pkFilter = array_flip( $primaryKey );
                $this->output( "Beginning migration of $table.$oldField to $table.$newField\n" );
+               wfWaitForSlaves();
 
                $dbw = $this->getDB( DB_MASTER );
                $next = '1=1';
@@ -206,6 +207,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
                        }
                        $prompt = join( ' ', array_reverse( $prompt ) );
                        $this->output( "... $prompt\n" );
+                       wfWaitForSlaves();
                }
 
                $this->output(
@@ -231,6 +233,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
        protected function migrateToTemp( $table, $primaryKey, $oldField, $newPrimaryKey, $newField ) {
                $newTable = $table . '_comment_temp';
                $this->output( "Beginning migration of $table.$oldField to $newTable.$newField\n" );
+               wfWaitForSlaves();
 
                $dbw = $this->getDB( DB_MASTER );
                $next = [];
@@ -279,6 +282,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
                        // Calculate the "next" condition
                        $next = [ $primaryKey . ' > ' . $dbw->addQuotes( $row->$primaryKey ) ];
                        $this->output( "... {$row->$primaryKey}\n" );
+                       wfWaitForSlaves();
                }
 
                $this->output(