From: Brian Wolff Date: Tue, 10 May 2016 19:38:27 +0000 (-0400) Subject: use slave for row estimate in updateCollation.php X-Git-Tag: 1.31.0-rc.0~7020^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=09205b2954d00a122de74e3480c61e5b4242b6bf;p=lhc%2Fweb%2Fwiklou.git use slave for row estimate in updateCollation.php 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 --- diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 6d9a616077..dc9431f9d5 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -70,6 +70,7 @@ TEXT 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' ); @@ -110,7 +111,7 @@ TEXT ]; } - $count = $dbw->estimateRowCount( + $count = $dbr->estimateRowCount( 'categorylinks', '*', $collationConds, @@ -118,7 +119,7 @@ TEXT ); // Improve estimate if feasible if ( $count < 1000000 ) { - $count = $dbw->selectField( + $count = $dbr->selectField( 'categorylinks', 'COUNT(*)', $collationConds, @@ -131,6 +132,7 @@ TEXT return; } $this->output( "Fixing collation for $count rows.\n" ); + wfWaitForSlaves(); } $count = 0; $batchCount = 0;