r49789 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49788‎ | r49789 | r49790 >
Date:00:51, 24 April 2009
Author:tstarling
Status:ok (Comments)
Tags:
Comment:
Insert blob_orphans rows in batches.
Modified paths:
  • /trunk/phase3/maintenance/storage/trackBlobs.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/storage/trackBlobs.php
@@ -300,6 +300,7 @@
301301 // Traverse the orphan list
302302 $insertBatch = array();
303303 $id = 0;
 304+ $numOrphans = 0;
304305 while ( true ) {
305306 $id = gmp_scan1( $orphans, $id );
306307 if ( $id == -1 ) {
@@ -309,12 +310,18 @@
310311 'bo_cluster' => $cluster,
311312 'bo_blob_id' => $id
312313 );
 314+ if ( count( $insertBatch ) > $this->batchSize ) {
 315+ $dbw->insert( 'blob_orphans', $insertBatch, __METHOD__ );
 316+ $insertBatch = array();
 317+ }
 318+
313319 ++$id;
 320+ ++$numOrphans;
314321 }
315 -
316 - // Insert the batch
317 - echo "Found " . count( $insertBatch ) . " orphan(s) in $cluster\n";
318 - $dbw->insert( 'blob_orphans', $insertBatch, __METHOD__ );
 322+ if ( $insertBatch ) {
 323+ $dbw->insert( 'blob_orphans', $insertBatch, __METHOD__ );
 324+ }
 325+ echo "Found $numOrphans orphan(s) in $cluster\n";
319326 }
320327 }
321328 }

Comments

#Comment by Tim Starling (talk | contribs)   09:47, 4 May 2009

Wikimedia-specific, not backporting.

Status & tagging log