r83992 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83991‎ | r83992 | r83993 >
Date:02:39, 15 March 2011
Author:tstarling
Status:ok
Tags:
Comment:
Committing some live patches by Roan
Modified paths:
  • /branches/wmf/1.17wmf1/maintenance/updateCollation.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/maintenance/updateCollation.php
@@ -29,6 +29,7 @@
3030
3131 public function syncDBs() {
3232 $lb = wfGetLB();
 33+ $lb->waitTimeout(100000);
3334 $dbw = $lb->getConnection( DB_MASTER );
3435 $pos = $dbw->getMasterPos();
3536 $lb->waitForAll( $pos );
@@ -40,13 +41,15 @@
4142 $dbw = wfGetDB( DB_MASTER );
4243 $force = $this->getOption( 'force' );
4344
44 - $options = array( 'LIMIT' => self::BATCH_SIZE );
 45+ $options = array( 'LIMIT' => self::BATCH_SIZE, 'STRAIGHT_JOIN' );
4546
4647 if ( $force ) {
4748 $options['ORDER BY'] = 'cl_from, cl_to';
4849 } else {
49 - $collationConds = array( 0 =>
50 - 'cl_collation != ' . $dbw->addQuotes( $wgCategoryCollation ) );
 50+ #$collationConds = array( 0 =>
 51+ # 'cl_collation != ' . $dbw->addQuotes( $wgCategoryCollation ) );
 52+ #Live hack for faster queries --catrope
 53+ $collationConds['cl_collation'] = '';
5154
5255 if ( !$wgMiserMode ) {
5356 $count = $dbw->selectField(
@@ -68,7 +71,7 @@
6972 $row = false;
7073 $batchConds = array();
7174 do {
72 - $this->output( 'Processing next ' . self::BATCH_SIZE . ' rows... ');
 75+ $this->output( "Selecting next " . self::BATCH_SIZE . " rows..." );
7376 $res = $dbw->select(
7477 array( 'categorylinks', 'page' ),
7578 array( 'cl_from', 'cl_to', 'cl_sortkey_prefix', 'cl_collation',
@@ -78,6 +81,7 @@
7982 __METHOD__,
8083 $options
8184 );
 85+ $this->output( " processing..." );
8286
8387 $dbw->begin();
8488 foreach ( $res as $row ) {
@@ -131,7 +135,11 @@
132136 $count += $res->numRows();
133137 $this->output( "$count done.\n" );
134138
135 - $this->syncDBs();
 139+ if ( $count % 1000 == 0 ) { #hack --catrope
 140+ $this->output( "Waiting for slaves ... " );
 141+ $this->syncDBs();
 142+ $this->output( "done\n" );
 143+ }
136144 } while ( $res->numRows() == self::BATCH_SIZE );
137145 }
138146 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r97146Merge live hacks from r83992 to trunk, after cleaning some things up....catrope12:17, 15 September 2011
r97173Merged revisions 97087,97091-97092,97094,97096-97098,97100-97101,97103,97136,...dantman16:19, 15 September 2011

Status & tagging log