MediaWiki
1.34.0
|
Class to handle job queues stored in the DB. More...
Public Member Functions | |
doBatchPushInternal (IDatabase $dbw, array $jobs, $flags, $method) | |
This function should not be called outside of JobQueueDB. More... | |
getAllAcquiredJobs () | |
getAllQueuedJobs () | |
getCoalesceLocationInternal () | |
Do not use this function outside of JobQueue/JobQueueGroup. More... | |
recycleAndDeleteStaleJobs () | |
Recycle or destroy any jobs that have been claimed for too long. More... | |
Public Member Functions inherited from JobQueue | |
ack (RunnableJob $job) | |
Acknowledge that a job was completed. More... | |
batchPush (array $jobs, $flags=0) | |
Push a batch of jobs into the queue. More... | |
deduplicateRootJob (IJobSpecification $job) | |
Register the "root job" of a given job into the queue for de-duplication. More... | |
delayedJobsEnabled () | |
delete () | |
Deleted all unclaimed and delayed jobs from the queue. More... | |
flushCaches () | |
Clear any process and persistent caches. More... | |
getAbandonedCount () | |
Get the number of acquired jobs that can no longer be attempted. More... | |
getAcquiredCount () | |
Get the number of acquired jobs (these are temporarily out of the queue). More... | |
getAllAbandonedJobs () | |
Get an iterator to traverse over all abandoned jobs in this queue. More... | |
getAllDelayedJobs () | |
Get an iterator to traverse over all delayed jobs in this queue. More... | |
getDelayedCount () | |
Get the number of delayed jobs (these are temporarily out of the queue). More... | |
getDomain () | |
getOrder () | |
getReadOnlyReason () | |
getSiblingQueueSizes (array $types) | |
Check the size of each of the given queues. More... | |
getSiblingQueuesWithJobs (array $types) | |
Check whether each of the given queues are empty. More... | |
getSize () | |
Get the number of available (unacquired, non-delayed) jobs in the queue. More... | |
getType () | |
getWiki () | |
isEmpty () | |
Quickly check if the queue has no available (unacquired, non-delayed) jobs. More... | |
pop () | |
Pop a job off of the queue. More... | |
push ( $jobs, $flags=0) | |
Push one or more jobs into the queue. More... | |
waitForBackups () | |
Wait for any replica DBs or backup servers to catch up. More... | |
Static Public Member Functions | |
static | selectFields () |
Return the list of job fields that should be selected. More... | |
Static Public Member Functions inherited from JobQueue | |
static | factory (array $params) |
Get a job queue object of the specified type. More... | |
Public Attributes | |
const | CACHE_TTL_SHORT = 30 |
const | MAX_AGE_PRUNE = 604800 |
const | MAX_JOB_RANDOM = 2147483647 |
const | MAX_OFFSET = 255 |
Public Attributes inherited from JobQueue | |
const | QOS_ATOMIC = 1 |
const | ROOTJOB_TTL = 2419200 |
Protected Member Functions | |
__construct (array $params) | |
Additional parameters include: More... | |
claimOldest ( $uuid) | |
Reserve a row with a single UPDATE without holding row locks over RTTs... More... | |
claimRandom ( $uuid, $rand, $gte) | |
Reserve a row with a single UPDATE without holding row locks over RTTs... More... | |
doAck (RunnableJob $job) | |
doBatchPush (array $jobs, $flags) | |
doDeduplicateRootJob (IJobSpecification $job) | |
doDelete () | |
doFlushCaches () | |
doGetAbandonedCount () | |
doGetAcquiredCount () | |
doGetSiblingQueueSizes (array $types) | |
doGetSiblingQueuesWithJobs (array $types) | |
doGetSize () | |
doIsEmpty () | |
doPop () | |
doWaitForBackups () | |
getDB ( $index) | |
getDBException (DBError $e) | |
getJobIterator (array $conds) | |
getMasterDB () | |
getReplicaDB () | |
insertFields (IJobSpecification $job, IDatabase $db) | |
jobFromRow ( $row) | |
optimalOrder () | |
Get the default queue order to use if configuration does not specify one. More... | |
supportedOrders () | |
Get the allowed queue orders for configuration validation. More... | |
Protected Member Functions inherited from JobQueue | |
assertNotReadOnly () | |
doGetDelayedCount () | |
doIsRootJobOldDuplicate (IJobSpecification $job) | |
factoryJob ( $command, $params) | |
getRootJobCacheKey ( $signature) | |
incrStats ( $key, $type, $delta=1) | |
Call wfIncrStats() for the queue overall and for the queue type. More... | |
isRootJobOldDuplicate (IJobSpecification $job) | |
Check if the "root" job of a given job has been superseded by a newer one. More... | |
supportsDelayedJobs () | |
Find out if delayed jobs are supported for configuration validation. More... | |
Static Protected Member Functions | |
static | makeBlob ( $params) |
Protected Attributes | |
string null | $cluster |
Name of an external DB cluster or null for the local DB cluster. More... | |
IMaintainableDatabase DBError null | $conn |
array null | $server |
Server configuration array. More... | |
Protected Attributes inherited from JobQueue | |
int | $claimTTL |
Time to live in seconds. More... | |
string | $domain |
DB domain ID. More... | |
int | $maxTries |
Maximum number of times to try a job. More... | |
string | $order |
Job priority for pop() More... | |
string bool | $readOnlyReason |
Read only rationale (or false if r/w) More... | |
StatsdDataFactoryInterface | $stats |
string | $type |
Job type. More... | |
WANObjectCache | $wanCache |
Private Member Functions | |
getCacheKey ( $property) | |
getScopedNoTrxFlag (IDatabase $db) | |
Class to handle job queues stored in the DB.
Definition at line 36 of file JobQueueDB.php.
|
protected |
Additional parameters include:
array | $params |
Reimplemented from JobQueue.
Definition at line 59 of file JobQueueDB.php.
|
protected |
Reserve a row with a single UPDATE without holding row locks over RTTs...
string | $uuid | 32 char hex string |
Definition at line 417 of file JobQueueDB.php.
References getMasterDB(), getScopedNoTrxFlag(), and wfDebug().
Referenced by doPop().
|
protected |
Reserve a row with a single UPDATE without holding row locks over RTTs...
string | $uuid | 32 char hex string |
int | $rand | Random unsigned integer (31 bits) |
bool | $gte | Search for job_random >= $random (otherwise job_random <= $random) |
Definition at line 339 of file JobQueueDB.php.
References JobQueue\$type, getCacheKey(), getMasterDB(), and getScopedNoTrxFlag().
Referenced by doPop().
|
protected |
RunnableJob | $job |
MWException |
Reimplemented from JobQueue.
Definition at line 479 of file JobQueueDB.php.
References $job, getDBException(), getMasterDB(), getScopedNoTrxFlag(), and JobQueue\incrStats().
|
protected |
IJobSpecification[] | $jobs | |
int | $flags |
DBError|Exception |
Reimplemented from JobQueue.
Definition at line 201 of file JobQueueDB.php.
References doBatchPushInternal(), getMasterDB(), and getScopedNoTrxFlag().
JobQueueDB::doBatchPushInternal | ( | IDatabase | $dbw, |
array | $jobs, | ||
$flags, | |||
$method | |||
) |
This function should not be called outside of JobQueueDB.
SecurityCheck-SQLInjection Bug in phan-taint-check handling bulk inserts
IDatabase | $dbw | |
IJobSpecification[] | $jobs | |
int | $flags | |
string | $method |
DBError |
Definition at line 234 of file JobQueueDB.php.
References $job, $res, Wikimedia\Rdbms\IDatabase\endAtomic(), getDBException(), JobQueue\incrStats(), Wikimedia\Rdbms\IDatabase\insert(), insertFields(), Wikimedia\Rdbms\IDatabase\select(), Wikimedia\Rdbms\IDatabase\startAtomic(), and wfDebug().
Referenced by doBatchPush().
|
protected |
IJobSpecification | $job |
MWException |
Reimplemented from JobQueue.
Definition at line 508 of file JobQueueDB.php.
References $job, getMasterDB(), and getScopedNoTrxFlag().
|
protected |
Reimplemented from JobQueue.
Definition at line 531 of file JobQueueDB.php.
References getDBException(), getMasterDB(), and getScopedNoTrxFlag().
|
protected |
Reimplemented from JobQueue.
Definition at line 563 of file JobQueueDB.php.
References JobQueue\$type, and getCacheKey().
|
protected |
MWException |
Reimplemented from JobQueue.
Definition at line 161 of file JobQueueDB.php.
References $dbr, getCacheKey(), getDBException(), getReplicaDB(), and getScopedNoTrxFlag().
|
protected |
Reimplemented from JobQueue.
Definition at line 128 of file JobQueueDB.php.
References $dbr, getCacheKey(), getDBException(), getReplicaDB(), and getScopedNoTrxFlag().
|
protected |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 634 of file JobQueueDB.php.
References $dbr, $res, getReplicaDB(), and getScopedNoTrxFlag().
|
protected |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 615 of file JobQueueDB.php.
References $dbr, $res, getReplicaDB(), and getScopedNoTrxFlag().
|
protected |
Reimplemented from JobQueue.
Definition at line 100 of file JobQueueDB.php.
References $dbr, getCacheKey(), getDBException(), getReplicaDB(), and getScopedNoTrxFlag().
|
protected |
Reimplemented from JobQueue.
Definition at line 81 of file JobQueueDB.php.
References $dbr, getDBException(), getReplicaDB(), and getScopedNoTrxFlag().
|
protected |
Reimplemented from JobQueue.
Definition at line 291 of file JobQueueDB.php.
References $job, claimOldest(), claimRandom(), getDBException(), getMasterDB(), getScopedNoTrxFlag(), JobQueue\incrStats(), jobFromRow(), recycleAndDeleteStaleJobs(), and wfRandomString().
|
protected |
Reimplemented from JobQueue.
Definition at line 548 of file JobQueueDB.php.
JobQueueDB::getAllAcquiredJobs | ( | ) |
Reimplemented from JobQueue.
Definition at line 581 of file JobQueueDB.php.
References getJobIterator(), and JobQueue\getType().
JobQueueDB::getAllQueuedJobs | ( | ) |
Reimplemented from JobQueue.
Definition at line 573 of file JobQueueDB.php.
References getJobIterator(), and JobQueue\getType().
|
private |
string | $property |
Definition at line 841 of file JobQueueDB.php.
References $cluster.
Referenced by claimRandom(), doFlushCaches(), doGetAbandonedCount(), doGetAcquiredCount(), and doGetSize().
JobQueueDB::getCoalesceLocationInternal | ( | ) |
Do not use this function outside of JobQueue/JobQueueGroup.
Reimplemented from JobQueue.
Definition at line 605 of file JobQueueDB.php.
|
protected |
int | $index | (DB_REPLICA/DB_MASTER) |
Definition at line 787 of file JobQueueDB.php.
References $conn.
Referenced by getMasterDB(), and getReplicaDB().
|
protected |
DBError | $e |
Definition at line 888 of file JobQueueDB.php.
Referenced by doAck(), doBatchPushInternal(), doDelete(), doGetAbandonedCount(), doGetAcquiredCount(), doGetSize(), doIsEmpty(), doPop(), getJobIterator(), and recycleAndDeleteStaleJobs().
|
protected |
array | $conds | Query conditions |
Definition at line 589 of file JobQueueDB.php.
References $dbr, getDBException(), getReplicaDB(), getScopedNoTrxFlag(), and jobFromRow().
Referenced by getAllAcquiredJobs(), and getAllQueuedJobs().
|
protected |
JobQueueConnectionError |
Definition at line 775 of file JobQueueDB.php.
References DB_MASTER, and getDB().
Referenced by claimOldest(), claimRandom(), doAck(), doBatchPush(), doDeduplicateRootJob(), doDelete(), doPop(), and recycleAndDeleteStaleJobs().
|
protected |
JobQueueConnectionError |
Definition at line 763 of file JobQueueDB.php.
References DB_REPLICA, and getDB().
Referenced by doGetAbandonedCount(), doGetAcquiredCount(), doGetSiblingQueueSizes(), doGetSiblingQueuesWithJobs(), doGetSize(), doIsEmpty(), and getJobIterator().
|
private |
IDatabase | $db |
Definition at line 826 of file JobQueueDB.php.
References Wikimedia\Rdbms\IDatabase\clearFlag(), DBO_TRX, Wikimedia\Rdbms\IDatabase\getFlag(), and Wikimedia\Rdbms\IDatabase\setFlag().
Referenced by claimOldest(), claimRandom(), doAck(), doBatchPush(), doDeduplicateRootJob(), doDelete(), doGetAbandonedCount(), doGetAcquiredCount(), doGetSiblingQueueSizes(), doGetSiblingQueuesWithJobs(), doGetSize(), doIsEmpty(), doPop(), getJobIterator(), and recycleAndDeleteStaleJobs().
|
protected |
IJobSpecification | $job | |
IDatabase | $db |
Definition at line 742 of file JobQueueDB.php.
References $job, makeBlob(), NS_SPECIAL, serialize(), and Wikimedia\Rdbms\IDatabase\timestamp().
Referenced by doBatchPushInternal().
|
protected |
stdClass | $row |
Definition at line 869 of file JobQueueDB.php.
References $job, JobQueue\factoryJob(), and unserialize().
Referenced by doPop(), and getJobIterator().
|
staticprotected |
array | bool | $params |
Definition at line 857 of file JobQueueDB.php.
References serialize().
Referenced by insertFields().
|
protected |
Get the default queue order to use if configuration does not specify one.
Reimplemented from JobQueue.
Definition at line 73 of file JobQueueDB.php.
JobQueueDB::recycleAndDeleteStaleJobs | ( | ) |
Recycle or destroy any jobs that have been claimed for too long.
Definition at line 655 of file JobQueueDB.php.
References $res, JobQueue\$type, getDBException(), getMasterDB(), getScopedNoTrxFlag(), and JobQueue\incrStats().
Referenced by doPop().
|
static |
Return the list of job fields that should be selected.
Definition at line 897 of file JobQueueDB.php.
|
protected |
Get the allowed queue orders for configuration validation.
Reimplemented from JobQueue.
Definition at line 69 of file JobQueueDB.php.
|
protected |
Name of an external DB cluster or null for the local DB cluster.
Definition at line 48 of file JobQueueDB.php.
Referenced by getCacheKey().
|
protected |
Definition at line 43 of file JobQueueDB.php.
Referenced by getDB().
|
protected |
Server configuration array.
Definition at line 46 of file JobQueueDB.php.
const JobQueueDB::CACHE_TTL_SHORT = 30 |
Definition at line 37 of file JobQueueDB.php.
const JobQueueDB::MAX_AGE_PRUNE = 604800 |
Definition at line 38 of file JobQueueDB.php.
const JobQueueDB::MAX_JOB_RANDOM = 2147483647 |
Definition at line 39 of file JobQueueDB.php.
const JobQueueDB::MAX_OFFSET = 255 |
Definition at line 40 of file JobQueueDB.php.