r84843 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84842‎ | r84843 | r84844 >
Date:13:27, 27 March 2011
Author:ariel
Status:ok
Tags:
Comment:
eta shows revs/pages per sec in current interval as well as overall; useful for investigating problems, now that we have logging
Modified paths:
  • /trunk/phase3/maintenance/dumpTextPass.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/dumpTextPass.php
@@ -37,6 +37,11 @@
3838 var $input = "php://stdin";
3939 var $fetchCount = 0;
4040 var $prefetchCount = 0;
 41+ var $lastTime = 0;
 42+ var $pageCountLast = 0;
 43+ var $revCountLast = 0;
 44+ var $prefetchCountLast = 0;
 45+ var $fetchCountLast = 0;
4146
4247 var $failures = 0;
4348 var $maxFailures = 5;
@@ -51,6 +56,14 @@
5257 var $spawnRead = false;
5358 var $spawnErr = false;
5459
 60+ var $ID = 0;
 61+
 62+ function initProgress( $history ) {
 63+ parent::initProgress();
 64+ $this->ID = getmypid();
 65+ $this->lastTime = $this->startTime;
 66+ }
 67+
5568 function dump( $history, $text = WikiExporter::TEXT ) {
5669 # This shouldn't happen if on console... ;)
5770 header( 'Content-type: text/html; charset=UTF-8' );
@@ -128,23 +141,52 @@
129142 }
130143
131144 if ( $this->reporting ) {
132 - $delta = wfTime() - $this->startTime;
133145 $now = wfTimestamp( TS_DB );
134 - if ( $delta ) {
135 - $rate = $this->pageCount / $delta;
136 - $revrate = $this->revCount / $delta;
 146+ $deltaAll = wfTime() - $this->startTime;
 147+ $deltaPart = wfTime() - $this->lastTime;
 148+ $this->pageCountPart = $this->pageCount - $this->pageCountLast;
 149+ $this->revCountPart = $this->revCount - $this->revCountLast;
 150+
 151+ if ( $deltaAll ) {
137152 $portion = $this->revCount / $this->maxCount;
138 - $eta = $this->startTime + $delta / $portion;
 153+ $eta = $this->startTime + $deltaAll / $portion;
139154 $etats = wfTimestamp( TS_DB, intval( $eta ) );
140 - $fetchrate = 100.0 * $this->prefetchCount / $this->fetchCount;
 155+ if ( $this->fetchCount ) {
 156+ $fetchRate = 100.0 * $this->prefetchCount / $this->fetchCount;
 157+ }
 158+ else {
 159+ $fetchRate = '-';
 160+ }
 161+ $pageRate = $this->pageCount / $deltaAll;
 162+ $revRate = $this->revCount / $deltaAll;
141163 } else {
142 - $rate = '-';
143 - $revrate = '-';
 164+ $pageRate = '-';
 165+ $revRate = '-';
144166 $etats = '-';
145 - $fetchrate = '-';
 167+ $fetchRate = '-';
146168 }
147 - $this->progress( sprintf( "%s: %s %d pages (%0.3f/sec), %d revs (%0.3f/sec), %0.1f%% prefetched, ETA %s [max %d]",
148 - $now, wfWikiID(), $this->pageCount, $rate, $this->revCount, $revrate, $fetchrate, $etats, $this->maxCount ) );
 169+ if ( $deltaPart ) {
 170+ if ( $this->fetchCountLast ) {
 171+ $fetchRatePart = 100.0 * $this->prefetchCountLast / $this->fetchCountLast;
 172+ }
 173+ else {
 174+ $fetchRatePart = '-';
 175+ }
 176+ $pageRatePart = $this->pageCountPart / $deltaPart;
 177+ $revRatePart = $this->revCountPart / $deltaPart;
 178+
 179+ } else {
 180+ $fetchRatePart = '-';
 181+ $pageRatePart = '-';
 182+ $revRatePart = '-';
 183+ }
 184+ $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), %0.1f%%|%0.1f%% prefetched (all|curr), ETA %s [max %d]",-
 185+ $now, wfWikiID(), $this->ID, $this->pageCount, $pageRate, $pageRatePart, $this->revCount, $revRate, $revRatePart, $fetchRate, $fetchRatePart, $etats, $this->maxCount ) );
 186+ $this->lastTime = $now;
 187+ $this->partCountLast = $this->partCount;
 188+ $this->revCountLast = $this->revCount;
 189+ $this->prefetchCountLast = $this->prefetchCount;
 190+ $this->fetchCountLast = $this->fetchCount;
149191 }
150192 }
151193
@@ -452,7 +494,7 @@
453495 (Default: 100)
454496 --server=h Force reading from MySQL server h
455497 --output=<type>:<file> Write to a file instead of stdout
456 - <type>s: file, gzip, bzip2, 7zip
 498+ <type>s: file, gzip, bzip2, 7zip
457499 --current Base ETA on number of pages in database instead of all revisions
458500 --spawn Spawn a subprocess for loading text records
459501 --help Display this help message

Status & tagging log