Index: branches/wmf/1.17wmf1/maintenance/updateCollation.php |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | |
31 | 31 | public function syncDBs() { |
32 | 32 | $lb = wfGetLB(); |
| 33 | + $lb->waitTimeout(100000); |
33 | 34 | $dbw = $lb->getConnection( DB_MASTER ); |
34 | 35 | $pos = $dbw->getMasterPos(); |
35 | 36 | $lb->waitForAll( $pos ); |
— | — | @@ -40,13 +41,15 @@ |
41 | 42 | $dbw = wfGetDB( DB_MASTER ); |
42 | 43 | $force = $this->getOption( 'force' ); |
43 | 44 | |
44 | | - $options = array( 'LIMIT' => self::BATCH_SIZE ); |
| 45 | + $options = array( 'LIMIT' => self::BATCH_SIZE, 'STRAIGHT_JOIN' ); |
45 | 46 | |
46 | 47 | if ( $force ) { |
47 | 48 | $options['ORDER BY'] = 'cl_from, cl_to'; |
48 | 49 | } 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'] = ''; |
51 | 54 | |
52 | 55 | if ( !$wgMiserMode ) { |
53 | 56 | $count = $dbw->selectField( |
— | — | @@ -68,7 +71,7 @@ |
69 | 72 | $row = false; |
70 | 73 | $batchConds = array(); |
71 | 74 | do { |
72 | | - $this->output( 'Processing next ' . self::BATCH_SIZE . ' rows... '); |
| 75 | + $this->output( "Selecting next " . self::BATCH_SIZE . " rows..." ); |
73 | 76 | $res = $dbw->select( |
74 | 77 | array( 'categorylinks', 'page' ), |
75 | 78 | array( 'cl_from', 'cl_to', 'cl_sortkey_prefix', 'cl_collation', |
— | — | @@ -78,6 +81,7 @@ |
79 | 82 | __METHOD__, |
80 | 83 | $options |
81 | 84 | ); |
| 85 | + $this->output( " processing..." ); |
82 | 86 | |
83 | 87 | $dbw->begin(); |
84 | 88 | foreach ( $res as $row ) { |
— | — | @@ -131,7 +135,11 @@ |
132 | 136 | $count += $res->numRows(); |
133 | 137 | $this->output( "$count done.\n" ); |
134 | 138 | |
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 | + } |
136 | 144 | } while ( $res->numRows() == self::BATCH_SIZE ); |
137 | 145 | } |
138 | 146 | } |