Index: trunk/phase3/maintenance/backup.inc |
— | — | @@ -51,6 +51,10 @@ |
52 | 52 | var $stubText = false; // include rev_text_id instead of text; for 2-pass dump |
53 | 53 | var $dumpUploads = false; |
54 | 54 | var $dumpUploadFileContents = false; |
| 55 | + var $lastTime = 0; |
| 56 | + var $pageCountLast = 0; |
| 57 | + var $revCountLast = 0; |
| 58 | + var $ID = 0; |
55 | 59 | |
56 | 60 | function BackupDumper( $args ) { |
57 | 61 | $this->stderr = fopen( "php://stderr", "wt" ); |
— | — | @@ -233,6 +237,8 @@ |
234 | 238 | $dbr = wfGetDB( DB_SLAVE ); |
235 | 239 | $this->maxCount = $dbr->selectField( $table, "MAX($field)", '', __METHOD__ ); |
236 | 240 | $this->startTime = wfTime(); |
| 241 | + $this->lastTime = $this->startTime; |
| 242 | + $this->ID = getmypid(); |
237 | 243 | } |
238 | 244 | |
239 | 245 | /** |
— | — | @@ -281,21 +287,35 @@ |
282 | 288 | |
283 | 289 | function showReport() { |
284 | 290 | if ( $this->reporting ) { |
285 | | - $delta = wfTime() - $this->startTime; |
286 | 291 | $now = wfTimestamp( TS_DB ); |
287 | | - if ( $delta ) { |
288 | | - $rate = $this->pageCount / $delta; |
289 | | - $revrate = $this->revCount / $delta; |
| 292 | + $nowts = wfTime(); |
| 293 | + $deltaAll = wfTime() - $this->startTime; |
| 294 | + $deltaPart = wfTime() - $this->lastTime; |
| 295 | + $this->pageCountPart = $this->pageCount - $this->pageCountLast; |
| 296 | + $this->revCountPart = $this->revCount - $this->revCountLast; |
| 297 | + |
| 298 | + if ( $deltaAll ) { |
290 | 299 | $portion = $this->revCount / $this->maxCount; |
291 | | - $eta = $this->startTime + $delta / $portion; |
| 300 | + $eta = $this->startTime + $deltaAll / $portion; |
292 | 301 | $etats = wfTimestamp( TS_DB, intval( $eta ) ); |
| 302 | + $pageRate = $this->pageCount / $deltaAll; |
| 303 | + $revRate = $this->revCount / $deltaAll; |
293 | 304 | } else { |
294 | | - $rate = '-'; |
295 | | - $revrate = '-'; |
| 305 | + $pageRate = '-'; |
| 306 | + $revRate = '-'; |
296 | 307 | $etats = '-'; |
297 | 308 | } |
298 | | - $this->progress( sprintf( "%s: %s %d pages (%0.3f/sec), %d revs (%0.3f/sec), ETA %s [max %d]", |
299 | | - $now, wfWikiID(), $this->pageCount, $rate, $this->revCount, $revrate, $etats, $this->maxCount ) ); |
| 309 | + if ( $deltaPart ) { |
| 310 | + $pageRatePart = $this->pageCountPart / $deltaPart; |
| 311 | + $revRatePart = $this->revCountPart / $deltaPart; |
| 312 | + } else { |
| 313 | + $pageRatePart = '-'; |
| 314 | + $revRatePart = '-'; |
| 315 | + } |
| 316 | + $this->progress( sprintf( "%s: %s (ID %d) %d pages (%0.1f|%0.1f/sec all|curr), %d revs (%0.1f|%0.1f/sec all|curr), ETA %s [max %d]", |
| 317 | + $now, wfWikiID(), $this->ID, $this->pageCount, $pageRate, $pageRatePart, $this->revCount, $revRate, $revRatePart, $etats, $this->maxCount ) ); |
| 318 | + $this->lastTime = $nowts; |
| 319 | + $this->revCountLast = $this->revCount; |
300 | 320 | } |
301 | 321 | } |
302 | 322 | |
Index: trunk/phase3/maintenance/dumpTextPass.php |
— | — | @@ -38,9 +38,6 @@ |
39 | 39 | var $history = WikiExporter::FULL; |
40 | 40 | var $fetchCount = 0; |
41 | 41 | var $prefetchCount = 0; |
42 | | - var $lastTime = 0; |
43 | | - var $pageCountLast = 0; |
44 | | - var $revCountLast = 0; |
45 | 42 | var $prefetchCountLast = 0; |
46 | 43 | var $fetchCountLast = 0; |
47 | 44 | |
— | — | @@ -57,8 +54,6 @@ |
58 | 55 | var $spawnRead = false; |
59 | 56 | var $spawnErr = false; |
60 | 57 | |
61 | | - var $ID = 0; |
62 | | - |
63 | 58 | var $xmlwriterobj = false; |
64 | 59 | |
65 | 60 | # when we spend more than maxTimeAllowed seconds on this run, we continue |
— | — | @@ -73,8 +68,6 @@ |
74 | 69 | |
75 | 70 | function initProgress( $history ) { |
76 | 71 | parent::initProgress(); |
77 | | - $this->ID = getmypid(); |
78 | | - $this->lastTime = $this->startTime; |
79 | 72 | $this->timeOfCheckpoint = $this->startTime; |
80 | 73 | } |
81 | 74 | |
— | — | @@ -234,10 +227,6 @@ |
235 | 228 | } |
236 | 229 | |
237 | 230 | function checkIfTimeExceeded() { |
238 | | - $m1 = $this->maxTimeAllowed; |
239 | | - $m2 = $this->lastTime; |
240 | | - $m3 = $this->timeOfCheckpoint; |
241 | | - $m4 = $this->lastTime - $this->timeOfCheckpoint; |
242 | 231 | if ( $this->maxTimeAllowed && ( $this->lastTime - $this->timeOfCheckpoint > $this->maxTimeAllowed ) ) { |
243 | 232 | return True; |
244 | 233 | } |