X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateCollation.php;h=922cc872139465c309d0e34714ad385df1bbf8ad;hb=7070dfc250e229ea4e30028c23e31c9cc15c4460;hp=6d9a6160770d3911960c4af090eb391ef17bea4d;hpb=6a8de1f1aa0bcdbf9385a4f9a01a4ef3bb70be57;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 6d9a616077..922cc87213 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -34,7 +34,7 @@ require_once __DIR__ . '/Maintenance.php'; */ class UpdateCollation extends Maintenance { const BATCH_SIZE = 100; // Number of rows to process in one batch - const SYNC_INTERVAL = 20; // Wait for slaves after this many batches + const SYNC_INTERVAL = 5; // Wait for slaves after this many batches public $sizeHistogram = []; @@ -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' ); @@ -97,6 +98,7 @@ TEXT $options = [ 'LIMIT' => self::BATCH_SIZE, 'ORDER BY' => $orderBy, + 'STRAIGHT_JOIN' // per T58041 ]; if ( $force || $dryRun ) { @@ -110,7 +112,7 @@ TEXT ]; } - $count = $dbw->estimateRowCount( + $count = $dbr->estimateRowCount( 'categorylinks', '*', $collationConds, @@ -118,7 +120,7 @@ TEXT ); // Improve estimate if feasible if ( $count < 1000000 ) { - $count = $dbw->selectField( + $count = $dbr->selectField( 'categorylinks', 'COUNT(*)', $collationConds, @@ -131,6 +133,7 @@ TEXT return; } $this->output( "Fixing collation for $count rows.\n" ); + wfWaitForSlaves(); } $count = 0; $batchCount = 0;