Index: trunk/phase3/maintenance/storage/trackBlobs.php |
— | — | @@ -300,6 +300,7 @@ |
301 | 301 | // Traverse the orphan list |
302 | 302 | $insertBatch = array(); |
303 | 303 | $id = 0; |
| 304 | + $numOrphans = 0; |
304 | 305 | while ( true ) { |
305 | 306 | $id = gmp_scan1( $orphans, $id ); |
306 | 307 | if ( $id == -1 ) { |
— | — | @@ -309,12 +310,18 @@ |
310 | 311 | 'bo_cluster' => $cluster, |
311 | 312 | 'bo_blob_id' => $id |
312 | 313 | ); |
| 314 | + if ( count( $insertBatch ) > $this->batchSize ) { |
| 315 | + $dbw->insert( 'blob_orphans', $insertBatch, __METHOD__ ); |
| 316 | + $insertBatch = array(); |
| 317 | + } |
| 318 | + |
313 | 319 | ++$id; |
| 320 | + ++$numOrphans; |
314 | 321 | } |
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"; |
319 | 326 | } |
320 | 327 | } |
321 | 328 | } |