Index: trunk/phase3/maintenance/dumpTextPass.php |
— | — | @@ -102,6 +102,10 @@ |
103 | 103 | var $history = MW_EXPORT_FULL; |
104 | 104 | var $fetchCount = 0; |
105 | 105 | var $prefetchCount = 0; |
| 106 | + |
| 107 | + var $failures = 0; |
| 108 | + var $maxFailures = 200; |
| 109 | + var $failureTimeout = 5; // Seconds to sleep after db failure |
106 | 110 | |
107 | 111 | function dump() { |
108 | 112 | # This shouldn't happen if on console... ;) |
— | — | @@ -236,6 +240,27 @@ |
237 | 241 | return $text; |
238 | 242 | } |
239 | 243 | } |
| 244 | + while( true ) { |
| 245 | + try { |
| 246 | + return $this->doGetText( $id ); |
| 247 | + } catch (DBQueryError $ex) { |
| 248 | + $this->failures++; |
| 249 | + if( $this->failures > $this->maxFailures ) { |
| 250 | + throw $ex; |
| 251 | + } else { |
| 252 | + $this->progress( "Database failure $this->failures " . |
| 253 | + "of allowed $this->maxFailures! " . |
| 254 | + "Pausing $this->failureTimeout seconds..." ); |
| 255 | + sleep( $this->failureTimeout ); |
| 256 | + } |
| 257 | + } |
| 258 | + } |
| 259 | + } |
| 260 | + |
| 261 | + /** |
| 262 | + * May throw a database error if, say, the server dies during query. |
| 263 | + */ |
| 264 | + private function doGetText( $id ) { |
240 | 265 | $id = intval( $id ); |
241 | 266 | $row = $this->db->selectRow( 'text', |
242 | 267 | array( 'old_text', 'old_flags' ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -234,6 +234,7 @@ |
235 | 235 | * (bug 6092) Introduce magic words {{REVISIONDAY}}, {{REVISIONDAY2}, {{REVISIONMONTH}}, |
236 | 236 | {{REVISIONYEAR}} and {{REVISIONTIMESTAMP}} |
237 | 237 | * (bug 7425) Preceeding whitespace in [[...]] breaks subpages |
| 238 | +* Try to reconnect after transitory database errors in dumpTextPass.php |
238 | 239 | |
239 | 240 | |
240 | 241 | == Languages updated == |