MediaWiki REL1_34
|
Maintenance script that moves blobs indexed by trackBlobs.php to a specified list of destination clusters, and recompresses them in the process. More...
Public Member Functions | |
__construct ( $options) | |
checkTrackingTable () | |
Make sure the tracking table exists and isn't empty. | |
critical ( $msg) | |
debug ( $msg) | |
dispatch (... $args) | |
Dispatch a command to the next available child process. | |
dispatchToChild ( $childId, $args) | |
Dispatch a command to a specified child process. | |
doAllOrphans () | |
Move all orphan text to the new clusters. | |
doAllPages () | |
Move all tracked pages to the new clusters. | |
doOrphanList ( $textIds) | |
Move an orphan text_id to the new cluster. | |
doPage ( $pageId) | |
Move tracked text in a given page. | |
execute () | |
Execute parent or child depending on the isChild option. | |
executeChild () | |
Main entry point for worker processes. | |
executeParent () | |
Execute the parent process. | |
finishIncompleteMoves ( $conds) | |
Moves are done in two phases: bt_new_url and then bt_moved. | |
getExtDB ( $cluster) | |
Gets a DB master connection for the given external cluster name. | |
getTargetCluster () | |
Returns the name of the next target cluster. | |
info ( $msg) | |
killChildProcs () | |
Gracefully terminate the child processes. | |
logToFile ( $msg, $file) | |
moveTextRow ( $textId, $url) | |
Atomic move operation. | |
report ( $label, $current, $end) | |
Display a progress report. | |
startChildProcs () | |
Start the worker processes. | |
syncDBs () | |
Wait until the selected replica DB has caught up to the master. | |
Static Public Member Functions | |
static | getOptionsWithArgs () |
static | newFromCommandLine ( $args, $options) |
Public Attributes | |
$batchSize = 1000 | |
$childId = false | |
$childPipes | |
$childProcs | |
$copyOnly = false | |
$criticalLog | |
$debugLog | |
$destClusters | |
$infoLog | |
$isChild = false | |
$noCount = false | |
$numBatches = 0 | |
$numProcs = 1 | |
$orphanBatchSize = 1000 | |
$orphanBlobClass | |
$pageBlobClass | |
$prevChildId | |
$reportingInterval = 10 | |
ExternalStoreDB | $store |
Private Attributes | |
SqlBlobStore | $blobStore |
Static Private Attributes | |
static | $cmdLineOptionMap |
static | $optionsWithArgs |
Maintenance script that moves blobs indexed by trackBlobs.php to a specified list of destination clusters, and recompresses them in the process.
Definition at line 59 of file recompressTracked.php.
RecompressTracked::__construct | ( | $options | ) |
Definition at line 112 of file recompressTracked.php.
References $GLOBALS.
RecompressTracked::checkTrackingTable | ( | ) |
Make sure the tracking table exists and isn't empty.
Definition at line 204 of file recompressTracked.php.
References $dbr, critical(), DB_REPLICA, info(), and wfGetDB().
Referenced by executeParent().
RecompressTracked::critical | ( | $msg | ) |
Definition at line 146 of file recompressTracked.php.
References logToFile().
Referenced by checkTrackingTable(), dispatch(), doOrphanList(), doPage(), killChildProcs(), moveTextRow(), and startChildProcs().
RecompressTracked::debug | ( | $msg | ) |
Definition at line 132 of file recompressTracked.php.
References logToFile(), and wfDebug().
Referenced by doOrphanList(), doPage(), executeChild(), and finishIncompleteMoves().
RecompressTracked::dispatch | ( | $args | ) |
Dispatch a command to the next available child process.
This may block until a child process finishes its work and becomes available.
array|string | ...$args |
Definition at line 287 of file recompressTracked.php.
References $args, $childId, $childPipes, $numProcs, critical(), and dispatchToChild().
Referenced by doAllOrphans(), and doAllPages().
RecompressTracked::dispatchToChild | ( | $childId, | |
$args ) |
Dispatch a command to a specified child process.
int | $childId | |
array | string | $args |
Definition at line 314 of file recompressTracked.php.
References $args, and $childId.
Referenced by dispatch(), and killChildProcs().
RecompressTracked::doAllOrphans | ( | ) |
Move all orphan text to the new clusters.
Definition at line 392 of file recompressTracked.php.
References $args, $dbr, $res, DB_REPLICA, dispatch(), info(), report(), and wfGetDB().
Referenced by executeParent().
RecompressTracked::doAllPages | ( | ) |
Move all tracked pages to the new clusters.
Definition at line 323 of file recompressTracked.php.
References $dbr, $res, DB_REPLICA, dispatch(), info(), report(), and wfGetDB().
Referenced by executeParent().
RecompressTracked::doOrphanList | ( | $textIds | ) |
Move an orphan text_id to the new cluster.
array | $textIds |
Definition at line 672 of file recompressTracked.php.
References $res, critical(), DB_REPLICA, debug(), finishIncompleteMoves(), syncDBs(), and wfGetDB().
Referenced by executeChild().
RecompressTracked::doPage | ( | $pageId | ) |
Move tracked text in a given page.
int | $pageId |
Definition at line 492 of file recompressTracked.php.
References $dbr, $res, $title, critical(), DB_REPLICA, debug(), finishIncompleteMoves(), syncDBs(), and wfGetDB().
Referenced by executeChild().
RecompressTracked::execute | ( | ) |
Execute parent or child depending on the isChild option.
Definition at line 177 of file recompressTracked.php.
References executeChild(), and executeParent().
RecompressTracked::executeChild | ( | ) |
Main entry point for worker processes.
Definition at line 461 of file recompressTracked.php.
References $args, $line, debug(), doOrphanList(), doPage(), and syncDBs().
Referenced by execute().
RecompressTracked::executeParent | ( | ) |
Execute the parent process.
Definition at line 188 of file recompressTracked.php.
References checkTrackingTable(), doAllOrphans(), doAllPages(), killChildProcs(), startChildProcs(), and syncDBs().
Referenced by execute().
RecompressTracked::finishIncompleteMoves | ( | $conds | ) |
Moves are done in two phases: bt_new_url and then bt_moved.
This function completes any moves that only have done bt_new_url. This can happen when the script is interrupted, or when –copy-only is used.
array | $conds |
Definition at line 609 of file recompressTracked.php.
References $dbr, $res, DB_REPLICA, debug(), moveTextRow(), and wfGetDB().
Referenced by doOrphanList(), and doPage().
RecompressTracked::getExtDB | ( | $cluster | ) |
Gets a DB master connection for the given external cluster name.
string | $cluster |
Definition at line 660 of file recompressTracked.php.
References DB_MASTER.
|
static |
Definition at line 97 of file recompressTracked.php.
References $optionsWithArgs.
RecompressTracked::getTargetCluster | ( | ) |
Returns the name of the next target cluster.
Definition at line 646 of file recompressTracked.php.
RecompressTracked::info | ( | $msg | ) |
Definition at line 139 of file recompressTracked.php.
References logToFile().
Referenced by checkTrackingTable(), doAllOrphans(), doAllPages(), killChildProcs(), and report().
RecompressTracked::killChildProcs | ( | ) |
Gracefully terminate the child processes.
Definition at line 268 of file recompressTracked.php.
References $numProcs, critical(), dispatchToChild(), and info().
Referenced by executeParent().
RecompressTracked::logToFile | ( | $msg, | |
$file ) |
Definition at line 153 of file recompressTracked.php.
References $file, $header, and wfHostname().
Referenced by critical(), debug(), and info().
RecompressTracked::moveTextRow | ( | $textId, | |
$url ) |
Atomic move operation.
Write the new URL to the text table and set the bt_moved flag.
This is done in a single transaction to provide restartable behavior without data loss.
The transaction is kept short to reduce locking.
int | $textId | |
string | $url |
Definition at line 574 of file recompressTracked.php.
References critical(), DB_MASTER, and wfGetDB().
Referenced by finishIncompleteMoves().
|
static |
Definition at line 101 of file recompressTracked.php.
References $args.
RecompressTracked::report | ( | $label, | |
$current, | |||
$end ) |
Display a progress report.
string | $label | |
int | $current | |
int | $end |
Definition at line 380 of file recompressTracked.php.
References info().
Referenced by doAllOrphans(), and doAllPages().
RecompressTracked::startChildProcs | ( | ) |
Start the worker processes.
These processes will listen on stdin for commands. This necessary because text recompression is slow: loading, compressing and writing are all slow.
Definition at line 227 of file recompressTracked.php.
References $numProcs, and critical().
Referenced by executeParent().
RecompressTracked::syncDBs | ( | ) |
Wait until the selected replica DB has caught up to the master.
This allows us to use the replica DB for things that were committed in a previous part of this batch process.
Definition at line 167 of file recompressTracked.php.
References $dbr, DB_MASTER, DB_REPLICA, and wfGetDB().
Referenced by doOrphanList(), doPage(), executeChild(), and executeParent().
RecompressTracked::$batchSize = 1000 |
Definition at line 61 of file recompressTracked.php.
|
private |
Definition at line 76 of file recompressTracked.php.
RecompressTracked::$childId = false |
Definition at line 70 of file recompressTracked.php.
Referenced by dispatch(), and dispatchToChild().
RecompressTracked::$childPipes |
Definition at line 67 of file recompressTracked.php.
Referenced by dispatch().
RecompressTracked::$childProcs |
Definition at line 67 of file recompressTracked.php.
|
staticprivate |
Definition at line 86 of file recompressTracked.php.
RecompressTracked::$copyOnly = false |
Definition at line 68 of file recompressTracked.php.
RecompressTracked::$criticalLog |
Definition at line 72 of file recompressTracked.php.
RecompressTracked::$debugLog |
Definition at line 72 of file recompressTracked.php.
RecompressTracked::$destClusters |
Definition at line 60 of file recompressTracked.php.
RecompressTracked::$infoLog |
Definition at line 72 of file recompressTracked.php.
RecompressTracked::$isChild = false |
Definition at line 69 of file recompressTracked.php.
RecompressTracked::$noCount = false |
Definition at line 71 of file recompressTracked.php.
RecompressTracked::$numBatches = 0 |
Definition at line 65 of file recompressTracked.php.
RecompressTracked::$numProcs = 1 |
Definition at line 64 of file recompressTracked.php.
Referenced by dispatch(), killChildProcs(), and startChildProcs().
|
staticprivate |
Definition at line 78 of file recompressTracked.php.
Referenced by getOptionsWithArgs().
RecompressTracked::$orphanBatchSize = 1000 |
Definition at line 62 of file recompressTracked.php.
RecompressTracked::$orphanBlobClass |
Definition at line 66 of file recompressTracked.php.
RecompressTracked::$pageBlobClass |
Definition at line 66 of file recompressTracked.php.
RecompressTracked::$prevChildId |
Definition at line 67 of file recompressTracked.php.
RecompressTracked::$reportingInterval = 10 |
Definition at line 63 of file recompressTracked.php.
ExternalStoreDB RecompressTracked::$store |
Definition at line 74 of file recompressTracked.php.