MediaWiki master
recompressTracked.php
Go to the documentation of this file.
1<?php
31use Wikimedia\AtEase\AtEase;
32
34require __DIR__ . '/../CommandLineInc.php';
35
36if ( count( $args ) < 1 ) {
37 echo "Usage: php recompressTracked.php [options] <cluster> [... <cluster>...]
38Moves blobs indexed by trackBlobs.php to a specified list of destination clusters,
39and recompresses them in the process. Restartable.
40
41Options:
42 --procs <procs> Set the number of child processes (default 1)
43 --copy-only Copy only, do not update the text table. Restart
44 without this option to complete.
45 --debug-log <file> Log debugging data to the specified file
46 --info-log <file> Log progress messages to the specified file
47 --critical-log <file> Log error messages to the specified file
48";
49 exit( 1 );
50}
51
53$job->execute();
54
63 public $batchSize = 1000;
64 public $orphanBatchSize = 1000;
65 public $reportingInterval = 10;
66 public $numProcs = 1;
67 public $numBatches = 0;
70 public $copyOnly = false;
71 public $isChild = false;
72 public $childId = false;
73 public $noCount = false;
76 public $store;
78 private $blobStore;
79
80 private static $optionsWithArgs = [
81 'procs',
82 'child-id',
83 'debug-log',
84 'info-log',
85 'critical-log'
86 ];
87
88 private static $cmdLineOptionMap = [
89 'no-count' => 'noCount',
90 'procs' => 'numProcs',
91 'copy-only' => 'copyOnly',
92 'child' => 'isChild',
93 'child-id' => 'childId',
94 'debug-log' => 'debugLog',
95 'info-log' => 'infoLog',
96 'critical-log' => 'criticalLog',
97 ];
98
99 public static function getOptionsWithArgs() {
100 return self::$optionsWithArgs;
101 }
102
103 public static function newFromCommandLine( $args, $options ) {
104 $jobOptions = [ 'destClusters' => $args ];
105 foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
106 if ( isset( $options[$cmdOption] ) ) {
107 $jobOptions[$classOption] = $options[$cmdOption];
108 }
109 }
110
111 return new self( $jobOptions );
112 }
113
114 public function __construct( $options ) {
115 foreach ( $options as $name => $value ) {
116 $this->$name = $value;
117 }
118 $esFactory = MediaWikiServices::getInstance()->getExternalStoreFactory();
119 $this->store = $esFactory->getStore( 'DB' );
120 if ( !$this->isChild ) {
121 $GLOBALS['wgDebugLogPrefix'] = "RCT M: ";
122 } elseif ( $this->childId !== false ) {
123 $GLOBALS['wgDebugLogPrefix'] = "RCT {$this->childId}: ";
124 }
125 $this->pageBlobClass = function_exists( 'xdiff_string_bdiff' ) ?
126 DiffHistoryBlob::class : ConcatenatedGzipHistoryBlob::class;
127 $this->orphanBlobClass = ConcatenatedGzipHistoryBlob::class;
128
129 $this->blobStore = MediaWikiServices::getInstance()
130 ->getBlobStoreFactory()
131 ->newSqlBlobStore();
132 }
133
134 public function debug( $msg ) {
135 wfDebug( "$msg" );
136 if ( $this->debugLog ) {
137 $this->logToFile( $msg, $this->debugLog );
138 }
139 }
140
141 public function info( $msg ) {
142 echo "$msg\n";
143 if ( $this->infoLog ) {
144 $this->logToFile( $msg, $this->infoLog );
145 }
146 }
147
148 public function critical( $msg ) {
149 echo "$msg\n";
150 if ( $this->criticalLog ) {
151 $this->logToFile( $msg, $this->criticalLog );
152 }
153 }
154
155 private function logToFile( $msg, $file ) {
156 $header = '[' . date( 'd\TH:i:s' ) . '] ' . wfHostname() . ' ' . posix_getpid();
157 if ( $this->childId !== false ) {
158 $header .= "({$this->childId})";
159 }
160 $header .= ' ' . WikiMap::getCurrentWikiDbDomain()->getId();
161 LegacyLogger::emit( sprintf( "%-50s %s\n", $header, $msg ), $file );
162 }
163
169 private function syncDBs() {
170 $icp = MediaWikiServices::getInstance()->getConnectionProvider();
171 $dbw = $icp->getPrimaryDatabase();
172
173 $dbr = $icp->getReplicaDatabase();
174 $pos = $dbw->getPrimaryPos();
175 $dbr->primaryPosWait( $pos, 100_000 );
176 }
177
181 public function execute() {
182 if ( $this->isChild ) {
183 $this->executeChild();
184 } else {
185 $this->executeParent();
186 }
187 }
188
192 public function executeParent() {
193 if ( !$this->checkTrackingTable() ) {
194 return;
195 }
196
197 $this->syncDBs();
198 $this->startChildProcs();
199 $this->doAllPages();
200 $this->doAllOrphans();
201 $this->killChildProcs();
202 }
203
208 private function checkTrackingTable() {
209 // TOOD: Use ICP::getConnection() – but that returns an IDatabase not a Database and so no tableExists()
210 $dbr = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnectionRef( DB_REPLICA );
211 if ( !$dbr->tableExists( 'blob_tracking', __METHOD__ ) ) {
212 $this->critical( "Error: blob_tracking table does not exist" );
213
214 return false;
215 }
216 $row = $dbr->newSelectQueryBuilder()
217 ->select( '*' )
218 ->from( 'blob_tracking' )
219 ->caller( __METHOD__ )->fetchRow();
220 if ( !$row ) {
221 $this->info( "Warning: blob_tracking table contains no rows, skipping this wiki." );
222
223 return false;
224 }
225
226 return true;
227 }
228
235 private function startChildProcs() {
236 $wiki = WikiMap::getCurrentWikiId();
237
238 $cmd = 'php ' . Shell::escape( __FILE__ );
239 foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
240 if ( $cmdOption == 'child-id' ) {
241 continue;
242 }
243 if ( in_array( $cmdOption, self::$optionsWithArgs ) && isset( $this->$classOption ) ) {
244 // @phan-suppress-next-line PhanTypeMismatchArgument False positive
245 $cmd .= " --$cmdOption " . Shell::escape( $this->$classOption );
246 } elseif ( $this->$classOption ) {
247 $cmd .= " --$cmdOption";
248 }
249 }
250 $cmd .= ' --child' .
251 ' --wiki ' . Shell::escape( $wiki ) .
252 ' ' . Shell::escape( ...$this->destClusters );
253
254 $this->childPipes = $this->childProcs = [];
255 for ( $i = 0; $i < $this->numProcs; $i++ ) {
256 $pipes = [];
257 $spec = [
258 [ 'pipe', 'r' ],
259 [ 'file', 'php://stdout', 'w' ],
260 [ 'file', 'php://stderr', 'w' ]
261 ];
262 AtEase::suppressWarnings();
263 $proc = proc_open( "$cmd --child-id $i", $spec, $pipes );
264 AtEase::restoreWarnings();
265 if ( !$proc ) {
266 $this->critical( "Error opening child process: $cmd" );
267 exit( 1 );
268 }
269 $this->childProcs[$i] = $proc;
270 $this->childPipes[$i] = $pipes[0];
271 }
272 $this->prevChildId = -1;
273 }
274
278 private function killChildProcs() {
279 $this->info( "Waiting for child processes to finish..." );
280 for ( $i = 0; $i < $this->numProcs; $i++ ) {
281 $this->dispatchToChild( $i, 'quit' );
282 }
283 for ( $i = 0; $i < $this->numProcs; $i++ ) {
284 $status = proc_close( $this->childProcs[$i] );
285 if ( $status ) {
286 $this->critical( "Warning: child #$i exited with status $status" );
287 }
288 }
289 $this->info( "Done." );
290 }
291
297 private function dispatch( ...$args ) {
298 $pipes = $this->childPipes;
299 $x = [];
300 $y = [];
301 $numPipes = stream_select( $x, $pipes, $y, 3600 );
302 if ( !$numPipes ) {
303 $this->critical( "Error waiting to write to child process. Aborting" );
304 exit( 1 );
305 }
306 for ( $i = 0; $i < $this->numProcs; $i++ ) {
307 $childId = ( $i + $this->prevChildId + 1 ) % $this->numProcs;
308 if ( isset( $pipes[$childId] ) ) {
309 $this->prevChildId = $childId;
310 $this->dispatchToChild( $childId, $args );
311
312 return;
313 }
314 }
315 $this->critical( "Unreachable" );
316 exit( 1 );
317 }
318
324 private function dispatchToChild( $childId, $args ) {
325 $args = (array)$args;
326 $cmd = implode( ' ', $args );
327 fwrite( $this->childPipes[$childId], "$cmd\n" );
328 }
329
333 private function doAllPages() {
334 $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
335 $i = 0;
336 $startId = 0;
337 if ( $this->noCount ) {
338 $numPages = '[unknown]';
339 } else {
340 $numPages = $dbr->newSelectQueryBuilder()
341 ->select( 'COUNT(DISTINCT bt_page)' )
342 ->from( 'blob_tracking' )
343 ->where( [ 'bt_moved' => 0 ] )
344 ->caller( __METHOD__ )->fetchField();
345 }
346 if ( $this->copyOnly ) {
347 $this->info( "Copying pages..." );
348 } else {
349 $this->info( "Moving pages..." );
350 }
351 while ( true ) {
352 $res = $dbr->newSelectQueryBuilder()
353 ->select( [ 'bt_page' ] )
354 ->distinct()
355 ->from( 'blob_tracking' )
356 ->where( [ 'bt_moved' => 0, $dbr->expr( 'bt_page', '>', $startId ) ] )
357 ->orderBy( 'bt_page' )
358 ->limit( $this->batchSize )
359 ->caller( __METHOD__ )->fetchResultSet();
360 if ( !$res->numRows() ) {
361 break;
362 }
363 foreach ( $res as $row ) {
364 $startId = $row->bt_page;
365 $this->dispatch( 'doPage', $row->bt_page );
366 $i++;
367 }
368 $this->report( 'pages', $i, $numPages );
369 }
370 $this->report( 'pages', $i, $numPages );
371 if ( $this->copyOnly ) {
372 $this->info( "All page copies queued." );
373 } else {
374 $this->info( "All page moves queued." );
375 }
376 }
377
384 private function report( $label, $current, $end ) {
385 $this->numBatches++;
386 if ( $current == $end || $this->numBatches >= $this->reportingInterval ) {
387 $this->numBatches = 0;
388 $this->info( "$label: $current / $end" );
389 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->waitForReplication();
390 }
391 }
392
396 private function doAllOrphans() {
397 $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
398 $startId = 0;
399 $i = 0;
400 if ( $this->noCount ) {
401 $numOrphans = '[unknown]';
402 } else {
403 $numOrphans = $dbr->newSelectQueryBuilder()
404 ->select( 'COUNT(DISTINCT bt_text_id)' )
405 ->from( 'blob_tracking' )
406 ->where( [ 'bt_moved' => 0, 'bt_page' => 0 ] )
407 ->caller( __METHOD__ )->fetchField();
408 if ( !$numOrphans ) {
409 return;
410 }
411 }
412 if ( $this->copyOnly ) {
413 $this->info( "Copying orphans..." );
414 } else {
415 $this->info( "Moving orphans..." );
416 }
417
418 while ( true ) {
419 $res = $dbr->newSelectQueryBuilder()
420 ->select( [ 'bt_text_id' ] )
421 ->distinct()
422 ->from( 'blob_tracking' )
423 ->where( [ 'bt_moved' => 0, 'bt_page' => 0, $dbr->expr( 'bt_text_id', '>', $startId ) ] )
424 ->orderBy( 'bt_text_id' )
425 ->limit( $this->batchSize )
426 ->caller( __METHOD__ )->fetchResultSet();
427 if ( !$res->numRows() ) {
428 break;
429 }
430 $ids = [];
431 foreach ( $res as $row ) {
432 $startId = $row->bt_text_id;
433 $ids[] = $row->bt_text_id;
434 $i++;
435 }
436 // Need to send enough orphan IDs to the child at a time to fill a blob,
437 // so orphanBatchSize needs to be at least ~100.
438 // batchSize can be smaller or larger.
439 while ( count( $ids ) > $this->orphanBatchSize ) {
440 $args = array_slice( $ids, 0, $this->orphanBatchSize );
441 $ids = array_slice( $ids, $this->orphanBatchSize );
442 array_unshift( $args, 'doOrphanList' );
443 $this->dispatch( ...$args );
444 }
445 if ( count( $ids ) ) {
446 $args = $ids;
447 array_unshift( $args, 'doOrphanList' );
448 $this->dispatch( ...$args );
449 }
450
451 $this->report( 'orphans', $i, $numOrphans );
452 }
453 $this->report( 'orphans', $i, $numOrphans );
454 $this->info( "All orphans queued." );
455 }
456
460 public function executeChild() {
461 $this->debug( 'starting' );
462 $this->syncDBs();
463
464 while ( !feof( STDIN ) ) {
465 $line = rtrim( fgets( STDIN ) );
466 if ( $line == '' ) {
467 continue;
468 }
469 $this->debug( $line );
470 $args = explode( ' ', $line );
471 $cmd = array_shift( $args );
472 switch ( $cmd ) {
473 case 'doPage':
474 $this->doPage( intval( $args[0] ) );
475 break;
476 case 'doOrphanList':
477 $this->doOrphanList( array_map( 'intval', $args ) );
478 break;
479 case 'quit':
480 return;
481 }
482 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->waitForReplication();
483 }
484 }
485
491 private function doPage( $pageId ) {
492 $title = Title::newFromID( $pageId );
493 if ( $title ) {
494 $titleText = $title->getPrefixedText();
495 } else {
496 $titleText = '[deleted]';
497 }
498 $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
499
500 // Finish any incomplete transactions
501 if ( !$this->copyOnly ) {
502 $this->finishIncompleteMoves( [ 'bt_page' => $pageId ] );
503 $this->syncDBs();
504 }
505
506 $startId = 0;
507 $trx = new CgzCopyTransaction( $this, $this->pageBlobClass );
508
509 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
510 while ( true ) {
511 $res = $dbr->newSelectQueryBuilder()
512 ->select( '*' )
513 ->from( 'blob_tracking' )
514 ->join( 'text', null, 'bt_text_id=old_id' )
515 ->where( [
516 'bt_page' => $pageId,
517 $dbr->expr( 'bt_text_id', '>', $startId ),
518 'bt_moved' => 0,
519 'bt_new_url' => null,
520 ] )
521 ->orderBy( 'bt_text_id' )
522 ->limit( $this->batchSize )
523 ->caller( __METHOD__ )->fetchResultSet();
524 if ( !$res->numRows() ) {
525 break;
526 }
527
528 $lastTextId = 0;
529 foreach ( $res as $row ) {
530 $startId = $row->bt_text_id;
531 if ( $lastTextId == $row->bt_text_id ) {
532 // Duplicate (null edit)
533 continue;
534 }
535 $lastTextId = $row->bt_text_id;
536 // Load the text
537 $text = $this->blobStore->expandBlob( $row->old_text, $row->old_flags );
538 if ( $text === false ) {
539 $this->critical( "Error loading {$row->bt_rev_id}/{$row->bt_text_id}" );
540 continue;
541 }
542
543 // Queue it
544 if ( !$trx->addItem( $text, $row->bt_text_id ) ) {
545 $this->debug( "$titleText: committing blob with " . $trx->getSize() . " items" );
546 $trx->commit();
547 $trx = new CgzCopyTransaction( $this, $this->pageBlobClass );
548 $lbFactory->waitForReplication();
549 }
550 }
551 }
552
553 $this->debug( "$titleText: committing blob with " . $trx->getSize() . " items" );
554 $trx->commit();
555 }
556
570 public function moveTextRow( $textId, $url ) {
571 if ( $this->copyOnly ) {
572 $this->critical( "Internal error: can't call moveTextRow() in --copy-only mode" );
573 exit( 1 );
574 }
575 $dbw = MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
576
577 $dbw->begin( __METHOD__ );
578 $dbw->newUpdateQueryBuilder()
579 ->update( 'text' )
580 ->set( [
581 'old_text' => $url,
582 'old_flags' => 'external,utf-8',
583 ] )
584 ->where( [
585 'old_id' => $textId
586 ] )
587 ->caller( __METHOD__ )
588 ->execute();
589 $dbw->newUpdateQueryBuilder()
590 ->update( 'blob_tracking' )
591 ->set( [ 'bt_moved' => 1 ] )
592 ->where( [ 'bt_text_id' => $textId ] )
593 ->caller( __METHOD__ )
594 ->execute();
595 $dbw->commit( __METHOD__ );
596 }
597
608 private function finishIncompleteMoves( $conds ) {
609 $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
610 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
611
612 $startId = 0;
613 $conds = array_merge( $conds, [
614 'bt_moved' => 0,
615 'bt_new_url IS NOT NULL'
616 ] );
617 while ( true ) {
618 $res = $dbr->newSelectQueryBuilder()
619 ->select( '*' )
620 ->from( 'blob_tracking' )
621 ->where( $conds )
622 ->andWhere( $dbr->expr( 'bt_text_id', '>', $startId ) )
623 ->orderBy( 'bt_text_id' )
624 ->limit( $this->batchSize )
625 ->caller( __METHOD__ )->fetchResultSet();
626 if ( !$res->numRows() ) {
627 break;
628 }
629 $this->debug( 'Incomplete: ' . $res->numRows() . ' rows' );
630 foreach ( $res as $row ) {
631 $startId = $row->bt_text_id;
632 $this->moveTextRow( $row->bt_text_id, $row->bt_new_url );
633 if ( $row->bt_text_id % 10 == 0 ) {
634 $lbFactory->waitForReplication();
635 }
636 }
637 }
638 }
639
644 public function getTargetCluster() {
645 $cluster = next( $this->destClusters );
646 if ( $cluster === false ) {
647 $cluster = reset( $this->destClusters );
648 }
649
650 return $cluster;
651 }
652
658 private function doOrphanList( $textIds ) {
659 // Finish incomplete moves
660 if ( !$this->copyOnly ) {
661 $this->finishIncompleteMoves( [ 'bt_text_id' => $textIds ] );
662 $this->syncDBs();
663 }
664
665 $trx = new CgzCopyTransaction( $this, $this->orphanBlobClass );
666
667 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
668 $res = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase()->newSelectQueryBuilder()
669 ->select( [ 'old_id', 'old_text', 'old_flags' ] )
670 ->distinct()
671 ->from( 'text' )
672 ->join( 'blob_tracking', null, 'bt_text_id=old_id' )
673 ->where( [ 'old_id' => $textIds, 'bt_moved' => 0 ] )
674 ->caller( __METHOD__ )->fetchResultSet();
675
676 foreach ( $res as $row ) {
677 $text = $this->blobStore->expandBlob( $row->old_text, $row->old_flags );
678 if ( $text === false ) {
679 $this->critical( "Error: cannot load revision text for old_id={$row->old_id}" );
680 continue;
681 }
682
683 if ( !$trx->addItem( $text, $row->old_id ) ) {
684 $this->debug( "[orphan]: committing blob with " . $trx->getSize() . " rows" );
685 $trx->commit();
686 $trx = new CgzCopyTransaction( $this, $this->orphanBlobClass );
687 $lbFactory->waitForReplication();
688 }
689 }
690 $this->debug( "[orphan]: committing blob with " . $trx->getSize() . " rows" );
691 $trx->commit();
692 }
693}
694
700 public $parent;
703 public $cgz;
706 private $texts;
707
713 public function __construct( $parent, $blobClass ) {
714 $this->blobClass = $blobClass;
715 $this->cgz = false;
716 $this->texts = [];
717 $this->parent = $parent;
718 }
719
727 public function addItem( $text, $textId ) {
728 if ( !$this->cgz ) {
729 $class = $this->blobClass;
730 $this->cgz = new $class;
731 }
732 $hash = $this->cgz->addItem( $text );
733 $this->referrers[$textId] = $hash;
734 $this->texts[$textId] = $text;
735
736 return $this->cgz->isHappy();
737 }
738
739 public function getSize() {
740 return count( $this->texts );
741 }
742
746 public function recompress() {
747 $class = $this->blobClass;
748 $this->cgz = new $class;
749 $this->referrers = [];
750 foreach ( $this->texts as $textId => $text ) {
751 $hash = $this->cgz->addItem( $text );
752 $this->referrers[$textId] = $hash;
753 }
754 }
755
761 public function commit() {
762 $originalCount = count( $this->texts );
763 if ( !$originalCount ) {
764 return;
765 }
766
767 /* Check to see if the target text_ids have been moved already.
768 *
769 * We originally read from the replica DB, so this can happen when a single
770 * text_id is shared between multiple pages. It's rare, but possible
771 * if a delete/move/undelete cycle splits up a null edit.
772 *
773 * We do a locking read to prevent closer-run race conditions.
774 */
775 $dbw = MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
776 $dbw->begin( __METHOD__ );
777 $res = $dbw->newSelectQueryBuilder()
778 ->select( [ 'bt_text_id', 'bt_moved' ] )
779 ->forUpdate()
780 ->from( 'blob_tracking' )
781 ->where( [ 'bt_text_id' => array_keys( $this->referrers ) ] )
782 ->caller( __METHOD__ )->fetchResultSet();
783 $dirty = false;
784 foreach ( $res as $row ) {
785 if ( $row->bt_moved ) {
786 # This row has already been moved, remove it
787 $this->parent->debug( "TRX: conflict detected in old_id={$row->bt_text_id}" );
788 unset( $this->texts[$row->bt_text_id] );
789 $dirty = true;
790 }
791 }
792
793 // Recompress the blob if necessary
794 if ( $dirty ) {
795 if ( !count( $this->texts ) ) {
796 // All have been moved already
797 if ( $originalCount > 1 ) {
798 // This is suspcious, make noise
799 $this->parent->critical(
800 "Warning: concurrent operation detected, are there two conflicting " .
801 "processes running, doing the same job?" );
802 }
803
804 return;
805 }
806 $this->recompress();
807 }
808
809 // Insert the data into the destination cluster
810 $targetCluster = $this->parent->getTargetCluster();
811 $store = $this->parent->store;
812 $targetDB = $store->getPrimary( $targetCluster );
813 $targetDB->clearFlag( DBO_TRX ); // we manage the transactions
814 $targetDB->begin( __METHOD__ );
815 $baseUrl = $this->parent->store->store( $targetCluster, serialize( $this->cgz ) );
816
817 // Write the new URLs to the blob_tracking table
818 foreach ( $this->referrers as $textId => $hash ) {
819 $url = $baseUrl . '/' . $hash;
820 $dbw->newUpdateQueryBuilder()
821 ->update( 'blob_tracking' )
822 ->set( [ 'bt_new_url' => $url ] )
823 ->where( [
824 'bt_text_id' => $textId,
825 'bt_moved' => 0, # Check for concurrent conflicting update
826 ] )
827 ->caller( __METHOD__ )
828 ->execute();
829 }
830
831 $targetDB->commit( __METHOD__ );
832 // Critical section here: interruption at this point causes blob duplication
833 // Reversing the order of the commits would cause data loss instead
834 $dbw->commit( __METHOD__ );
835
836 // Write the new URLs to the text table and set the moved flag
837 if ( !$this->parent->copyOnly ) {
838 foreach ( $this->referrers as $textId => $hash ) {
839 $url = $baseUrl . '/' . $hash;
840 $this->parent->moveTextRow( $textId, $url );
841 }
842 }
843 }
844}
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfHostname()
Get host name of the current machine, for use in error reporting.
Class to represent a recompression operation for a single CGZ blob.
RecompressTracked $parent
ConcatenatedGzipHistoryBlob false $cgz
addItem( $text, $textId)
Add text.
commit()
Commit the blob.
recompress()
Recompress text after some aberrant modification.
__construct( $parent, $blobClass)
Create a transaction from a RecompressTracked object.
Concatenated gzip (CGZ) storage Improves compression ratio by concatenating like objects before gzipp...
External storage in a SQL database.
getPrimary( $cluster)
Get a primary database connection for the specified cluster.
store( $location, $data)
Insert a data item into a given location.string|bool The URL of the stored data item,...
PSR-3 logger that mimics the historic implementation of MediaWiki's former wfErrorLog logging impleme...
Service locator for MediaWiki core services.
Executes shell commands.
Definition Shell.php:46
Service for storing and loading Content objects representing revision data blobs.
Represents a title within MediaWiki.
Definition Title.php:78
Tools for dealing with other locally-hosted wikis.
Definition WikiMap.php:31
Maintenance script that moves blobs indexed by trackBlobs.php to a specified list of destination clus...
executeChild()
Main entry point for worker processes.
moveTextRow( $textId, $url)
Atomic move operation.
execute()
Execute parent or child depending on the isChild option.
static newFromCommandLine( $args, $options)
getTargetCluster()
Returns the name of the next target cluster.
executeParent()
Execute the parent process.
ExternalStoreDB $store
const DB_REPLICA
Definition defines.php:26
const DBO_TRX
Definition defines.php:12
$optionsWithArgs
if(count( $args)< 1) $job
$header