MediaWiki REL1_33
|
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. | |
getAllAcquiredJobs () | |
getAllQueuedJobs () | |
getCoalesceLocationInternal () | |
Do not use this function outside of JobQueue/JobQueueGroup. | |
recycleAndDeleteStaleJobs () | |
Recycle or destroy any jobs that have been claimed for too long. | |
Public Member Functions inherited from JobQueue | |
ack (Job $job) | |
Acknowledge that a job was completed. | |
batchPush (array $jobs, $flags=0) | |
Push a batch of jobs into the queue. | |
deduplicateRootJob (IJobSpecification $job) | |
Register the "root job" of a given job into the queue for de-duplication. | |
delayedJobsEnabled () | |
delete () | |
Deleted all unclaimed and delayed jobs from the queue. | |
flushCaches () | |
Clear any process and persistent caches. | |
getAbandonedCount () | |
Get the number of acquired jobs that can no longer be attempted. | |
getAcquiredCount () | |
Get the number of acquired jobs (these are temporarily out of the queue). | |
getAllAbandonedJobs () | |
Get an iterator to traverse over all abandoned jobs in this queue. | |
getAllDelayedJobs () | |
Get an iterator to traverse over all delayed jobs in this queue. | |
getDelayedCount () | |
Get the number of delayed jobs (these are temporarily out of the queue). | |
getDomain () | |
getOrder () | |
getReadOnlyReason () | |
getSiblingQueueSizes (array $types) | |
Check the size of each of the given queues. | |
getSiblingQueuesWithJobs (array $types) | |
Check whether each of the given queues are empty. | |
getSize () | |
Get the number of available (unacquired, non-delayed) jobs in the queue. | |
getType () | |
getWiki () | |
isEmpty () | |
Quickly check if the queue has no available (unacquired, non-delayed) jobs. | |
pop () | |
Pop a job off of the queue. | |
push ( $jobs, $flags=0) | |
Push one or more jobs into the queue. | |
waitForBackups () | |
Wait for any replica DBs or backup servers to catch up. | |
Static Public Member Functions | |
static | selectFields () |
Return the list of job fields that should be selected. | |
Static Public Member Functions inherited from JobQueue | |
static | factory (array $params) |
Get a job queue object of the specified type. | |
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: | |
claimOldest ( $uuid) | |
Reserve a row with a single UPDATE without holding row locks over RTTs... | |
claimRandom ( $uuid, $rand, $gte) | |
Reserve a row with a single UPDATE without holding row locks over RTTs... | |
doAck (Job $job) | |
doBatchPush (array $jobs, $flags) | |
doDeduplicateRootJob (IJobSpecification $job) | |
doDelete () | |
doFlushCaches () | |
doGetAbandonedCount () | |
doGetAcquiredCount () | |
doGetSiblingQueueSizes (array $types) | |
doGetSiblingQueuesWithJobs (array $types) | |
doGetSize () | |
doIsEmpty () | |
doPop () | |
doWaitForBackups () | |
getDB ( $index) | |
getJobIterator (array $conds) | |
getMasterDB () | |
getReplicaDB () | |
insertFields (IJobSpecification $job, IDatabase $db) | |
optimalOrder () | |
Get the default queue order to use if configuration does not specify one. | |
supportedOrders () | |
Get the allowed queue orders for configuration validation. | |
throwDBException (DBError $e) | |
Protected Member Functions inherited from JobQueue | |
assertNotReadOnly () | |
doGetDelayedCount () | |
doIsRootJobOldDuplicate (Job $job) | |
getRootJobCacheKey ( $signature) | |
incrStats ( $key, $type, $delta=1) | |
Call wfIncrStats() for the queue overall and for the queue type. | |
isRootJobOldDuplicate (Job $job) | |
Check if the "root" job of a given job has been superseded by a newer one. | |
supportsDelayedJobs () | |
Find out if delayed jobs are supported for configuration validation. | |
Static Protected Member Functions | |
static | extractBlob ( $blob) |
static | makeBlob ( $params) |
Protected Attributes | |
WANObjectCache | $cache |
string null | $cluster |
Name of an external DB cluster or null for the local DB cluster. | |
IDatabase DBError null | $conn |
array null | $server |
Server configuration array. | |
Protected Attributes inherited from JobQueue | |
int | $claimTTL |
Time to live in seconds. | |
string | $domain |
DB domain ID. | |
BagOStuff | $dupCache |
int | $maxTries |
Maximum number of times to try a job. | |
string | $order |
Job priority for pop() | |
string bool | $readOnlyReason |
Read only rationale (or false if r/w) | |
StatsdDataFactoryInterface | $stats |
string | $type |
Job type. | |
Private Member Functions | |
getCacheKey ( $property) | |
getScopedNoTrxFlag (IDatabase $db) | |
Class to handle job queues stored in the DB.
Definition at line 35 of file JobQueueDB.php.
|
protected |
Additional parameters include:
array | $params |
Reimplemented from JobQueue.
Definition at line 61 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 425 of file JobQueueDB.php.
References getMasterDB(), getScopedNoTrxFlag(), type, 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 346 of file JobQueueDB.php.
References cache, getCacheKey(), getMasterDB(), getScopedNoTrxFlag(), and type.
Referenced by doPop().
|
protected |
Job | $job |
MWException |
Reimplemented from JobQueue.
Definition at line 487 of file JobQueueDB.php.
References $e, $job, getMasterDB(), getScopedNoTrxFlag(), JobQueue\incrStats(), throwDBException(), and type.
|
protected |
IJobSpecification[] | $jobs | |
int | $flags |
DBError|Exception |
Reimplemented from JobQueue.
Definition at line 205 of file JobQueueDB.php.
References $fname, doBatchPushInternal(), getMasterDB(), getScopedNoTrxFlag(), and use.
This function should not be called outside of JobQueueDB.
@suppress SecurityCheck-SQLInjection Bug in phan-taint-check handling bulk inserts
IDatabase | $dbw | |
IJobSpecification[] | $jobs | |
int | $flags | |
string | $method |
DBError |
Definition at line 238 of file JobQueueDB.php.
References $e, $job, $res, $rows, as, Wikimedia\Rdbms\IDatabase\endAtomic(), JobQueue\incrStats(), Wikimedia\Rdbms\IDatabase\insert(), insertFields(), Wikimedia\Rdbms\IDatabase\select(), Wikimedia\Rdbms\IDatabase\startAtomic(), throwDBException(), type, and wfDebug().
Referenced by doBatchPush().
|
protected |
IJobSpecification | $job |
MWException |
Reimplemented from JobQueue.
Definition at line 516 of file JobQueueDB.php.
References $cache, JobQueue\$dupCache, $job, $params, WANObjectCache\get(), getMasterDB(), JobQueue\getRootJobCacheKey(), getScopedNoTrxFlag(), JobQueue\ROOTJOB_TTL, WANObjectCache\set(), and use.
|
protected |
Reimplemented from JobQueue.
Definition at line 554 of file JobQueueDB.php.
References $e, getMasterDB(), getScopedNoTrxFlag(), throwDBException(), and type.
|
protected |
Reimplemented from JobQueue.
Definition at line 586 of file JobQueueDB.php.
References JobQueue\$type, as, cache, and getCacheKey().
|
protected |
MWException |
Reimplemented from JobQueue.
Definition at line 165 of file JobQueueDB.php.
References $dbr, $e, cache, getCacheKey(), getReplicaDB(), getScopedNoTrxFlag(), and throwDBException().
|
protected |
Reimplemented from JobQueue.
Definition at line 132 of file JobQueueDB.php.
References $dbr, $e, cache, getCacheKey(), getReplicaDB(), getScopedNoTrxFlag(), and throwDBException().
|
protected |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 665 of file JobQueueDB.php.
References $dbr, $res, as, getReplicaDB(), and getScopedNoTrxFlag().
|
protected |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 646 of file JobQueueDB.php.
References $dbr, $res, as, getReplicaDB(), and getScopedNoTrxFlag().
|
protected |
Reimplemented from JobQueue.
Definition at line 104 of file JobQueueDB.php.
References $dbr, $e, cache, getCacheKey(), getReplicaDB(), getScopedNoTrxFlag(), and throwDBException().
|
protected |
Reimplemented from JobQueue.
Definition at line 85 of file JobQueueDB.php.
References $dbr, $e, getReplicaDB(), getScopedNoTrxFlag(), throwDBException(), and type.
|
protected |
Reimplemented from JobQueue.
Definition at line 295 of file JobQueueDB.php.
References $e, $job, $title, claimOldest(), claimRandom(), Job\factory(), getMasterDB(), getScopedNoTrxFlag(), JobQueue\incrStats(), recycleAndDeleteStaleJobs(), throwDBException(), type, and wfRandomString().
|
protected |
Reimplemented from JobQueue.
Definition at line 571 of file JobQueueDB.php.
|
staticprotected |
string | $blob |
Definition at line 896 of file JobQueueDB.php.
References $blob, and unserialize().
JobQueueDB::getAllAcquiredJobs | ( | ) |
Reimplemented from JobQueue.
Definition at line 604 of file JobQueueDB.php.
References getJobIterator(), and JobQueue\getType().
JobQueueDB::getAllQueuedJobs | ( | ) |
Reimplemented from JobQueue.
Definition at line 596 of file JobQueueDB.php.
References getJobIterator(), and JobQueue\getType().
|
private |
string | $property |
Definition at line 868 of file JobQueueDB.php.
References $cluster, $property, cache, and type.
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 636 of file JobQueueDB.php.
References server.
|
protected |
int | $index | (DB_REPLICA/DB_MASTER) |
Reimplemented in JobQueueDBSingle.
Definition at line 818 of file JobQueueDB.php.
References $conn, $e, and server.
Referenced by getMasterDB(), and getReplicaDB().
|
protected |
array | $conds | Query conditions |
Definition at line 612 of file JobQueueDB.php.
References $dbr, $e, $job, Job\factory(), function, getReplicaDB(), getScopedNoTrxFlag(), throwDBException(), and unserialize().
Referenced by getAllAcquiredJobs(), and getAllQueuedJobs().
|
protected |
JobQueueConnectionError |
Definition at line 806 of file JobQueueDB.php.
References $e, DB_MASTER, and getDB().
Referenced by claimOldest(), claimRandom(), doAck(), doBatchPush(), doDeduplicateRootJob(), doDelete(), doPop(), and recycleAndDeleteStaleJobs().
|
protected |
JobQueueConnectionError |
Definition at line 794 of file JobQueueDB.php.
References $e, DB_REPLICA, and getDB().
Referenced by doGetAbandonedCount(), doGetAcquiredCount(), doGetSiblingQueueSizes(), doGetSiblingQueuesWithJobs(), doGetSize(), doIsEmpty(), and getJobIterator().
|
private |
IDatabase | $db |
Definition at line 853 of file JobQueueDB.php.
References Wikimedia\Rdbms\IDatabase\clearFlag(), DBO_TRX, Wikimedia\Rdbms\IDatabase\getFlag(), Wikimedia\Rdbms\IDatabase\setFlag(), and use.
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 773 of file JobQueueDB.php.
References $job, makeBlob(), serialize(), and Wikimedia\Rdbms\IDatabase\timestamp().
Referenced by doBatchPushInternal().
|
staticprotected |
array | bool | $params |
Definition at line 884 of file JobQueueDB.php.
References $params, and serialize().
Referenced by insertFields().
|
protected |
Get the default queue order to use if configuration does not specify one.
Reimplemented from JobQueue.
Definition at line 77 of file JobQueueDB.php.
JobQueueDB::recycleAndDeleteStaleJobs | ( | ) |
Recycle or destroy any jobs that have been claimed for too long.
Definition at line 686 of file JobQueueDB.php.
References $e, $res, JobQueue\$type, getMasterDB(), getScopedNoTrxFlag(), JobQueue\incrStats(), throwDBException(), and type.
Referenced by doPop().
|
static |
Return the list of job fields that should be selected.
Definition at line 917 of file JobQueueDB.php.
|
protected |
Get the allowed queue orders for configuration validation.
Reimplemented from JobQueue.
Definition at line 73 of file JobQueueDB.php.
|
protected |
DBError | $e |
JobQueueError |
Definition at line 908 of file JobQueueDB.php.
References $e.
Referenced by doAck(), doBatchPushInternal(), doDelete(), doGetAbandonedCount(), doGetAcquiredCount(), doGetSize(), doIsEmpty(), doPop(), getJobIterator(), and recycleAndDeleteStaleJobs().
|
protected |
Definition at line 42 of file JobQueueDB.php.
Referenced by doDeduplicateRootJob().
|
protected |
Name of an external DB cluster or null for the local DB cluster.
Definition at line 49 of file JobQueueDB.php.
Referenced by getCacheKey().
Definition at line 44 of file JobQueueDB.php.
Referenced by getDB().
Server configuration array.
Definition at line 47 of file JobQueueDB.php.
const JobQueueDB::CACHE_TTL_SHORT = 30 |
Definition at line 36 of file JobQueueDB.php.
const JobQueueDB::MAX_AGE_PRUNE = 604800 |
Definition at line 37 of file JobQueueDB.php.
const JobQueueDB::MAX_JOB_RANDOM = 2147483647 |
Definition at line 38 of file JobQueueDB.php.
const JobQueueDB::MAX_OFFSET = 255 |
Definition at line 39 of file JobQueueDB.php.