From: Reedy Date: Wed, 13 Sep 2017 22:22:19 +0000 (+0100) Subject: populateIpChanges.php: Insert rows in batches X-Git-Tag: 1.31.0-rc.0~2108 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=1116ebe298e9048218019d429d4caa5e13ac1996 populateIpChanges.php: Insert rows in batches Change-Id: I0233b5a17fc64751514ec6d0701f155a73906873 --- diff --git a/maintenance/populateIpChanges.php b/maintenance/populateIpChanges.php index e086c5e9e6..ffb8c43b30 100644 --- a/maintenance/populateIpChanges.php +++ b/maintenance/populateIpChanges.php @@ -82,19 +82,15 @@ TEXT $this->output( "...checking $this->mBatchSize revisions for IP edits that need copying, " . "starting with rev_id $blockStart\n" ); + $insertRows = []; foreach ( $rows as $row ) { // Double-check to make sure this is an IP, e.g. not maintenance user or imported revision. if ( IP::isValid( $row->rev_user_text ) ) { - $dbw->insert( - 'ip_changes', - [ - 'ipc_rev_id' => $row->rev_id, - 'ipc_rev_timestamp' => $row->rev_timestamp, - 'ipc_hex' => IP::toHex( $row->rev_user_text ), - ], - __METHOD__, - 'IGNORE' - ); + $insertRows[] = [ + 'ipc_rev_id' => $row->rev_id, + 'ipc_rev_timestamp' => $row->rev_timestamp, + 'ipc_hex' => IP::toHex( $row->rev_user_text ), + ]; $revCount++; } @@ -104,6 +100,13 @@ TEXT $blockStart++; + $dbw->insert( + 'ip_changes', + $insertRows, + __METHOD__, + 'IGNORE' + ); + $lbFactory->waitForReplication(); usleep( $throttle * 1000 ); }