X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateCollation.php;h=922cc872139465c309d0e34714ad385df1bbf8ad;hb=7070dfc250e229ea4e30028c23e31c9cc15c4460;hp=5882ff50d9a98f81fd7f544e423c4794e77c1cb7;hpb=01bcb5a9e645dcc06e00112c2e5863087fabf9eb;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 5882ff50d9..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' ); @@ -111,7 +112,7 @@ TEXT ]; } - $count = $dbw->estimateRowCount( + $count = $dbr->estimateRowCount( 'categorylinks', '*', $collationConds, @@ -119,7 +120,7 @@ TEXT ); // Improve estimate if feasible if ( $count < 1000000 ) { - $count = $dbw->selectField( + $count = $dbr->selectField( 'categorylinks', 'COUNT(*)', $collationConds, @@ -132,6 +133,7 @@ TEXT return; } $this->output( "Fixing collation for $count rows.\n" ); + wfWaitForSlaves(); } $count = 0; $batchCount = 0;