jcrespo reported a lag spike at the very beginning of running this
script. I'm guessing that's due to counting how many rows in
categorylinks to give the progress bar. Since we only need a
rough estimate for the progress meter, make that query run on
a slave. Also add a wfWaitForSlaves() immediately after it for
good measure.
Bug: T58041
Change-Id: I3cba392f0013fcb2ef86803632e2d9b1b88b3b29
global $wgCategoryCollation;
$dbw = $this->getDB( DB_MASTER );
+ $dbr = $this->getDB( DB_SLAVE );
$force = $this->getOption( 'force' );
$dryRun = $this->getOption( 'dry-run' );
$verboseStats = $this->getOption( 'verbose-stats' );
];
}
- $count = $dbw->estimateRowCount(
+ $count = $dbr->estimateRowCount(
'categorylinks',
'*',
$collationConds,
);
// Improve estimate if feasible
if ( $count < 1000000 ) {
- $count = $dbw->selectField(
+ $count = $dbr->selectField(
'categorylinks',
'COUNT(*)',
$collationConds,
return;
}
$this->output( "Fixing collation for $count rows.\n" );
+ wfWaitForSlaves();
}
$count = 0;
$batchCount = 0;