MediaWiki
1.23.2
|
Class to handle job queues stored in Redis. More...
Public Member Functions | |
__construct (array $params) | |
@params include: More... | |
getAllDelayedJobs () | |
getAllQueuedJobs () | |
getCoalesceLocationInternal () | |
Do not use this function outside of JobQueue/JobQueueGroup. More... | |
getJobFromUidInternal ( $uid, RedisConnRef $conn) | |
This function should not be called outside JobQueueRedis. More... | |
recyclePruneAndUndelayJobs () | |
Recycle or destroy any jobs that have been claimed for too long and release any ready delayed jobs into the queue. More... | |
setTestingPrefix ( $key) | |
Public Member Functions inherited from JobQueue | |
ack (Job $job) | |
Acknowledge that a job was completed. More... | |
batchPush (array $jobs, $flags=0) | |
Push a batch of jobs into the queue. More... | |
deduplicateRootJob (Job $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... | |
getDelayedCount () | |
Get the number of delayed jobs (these are temporarily out of the queue). More... | |
getOrder () | |
getPeriodicTasks () | |
Return a map of task names to task definition maps. More... | |
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 slaves or backup servers to catch up. More... | |
Public Attributes | |
const | MAX_AGE_PRUNE = 604800 |
Public Attributes inherited from JobQueue | |
const | QOS_ATOMIC = 1 |
const | ROOTJOB_TTL = 2419200 |
Protected Member Functions | |
doAck (Job $job) | |
doBatchPush (array $jobs, $flags) | |
doDeduplicateRootJob (Job $job) | |
doDelete () | |
doGetAbandonedCount () | |
doGetAcquiredCount () | |
doGetDelayedCount () | |
doGetPeriodicTasks () | |
doGetSiblingQueueSizes (array $types) | |
doGetSiblingQueuesWithJobs (array $types) | |
doGetSize () | |
doIsEmpty () | |
doIsRootJobOldDuplicate (Job $job) | |
doPop () | |
getConnection () | |
Get a connection to the server that handles all sub-queues for this queue. More... | |
getJobFromFields (array $fields) | |
getNewJobFields (IJobSpecification $job) | |
optimalOrder () | |
Get the default queue order to use if configuration does not specify one. More... | |
popAndAcquireBlob (RedisConnRef $conn) | |
popAndDeleteBlob (RedisConnRef $conn) | |
pushBlobs (RedisConnRef $conn, array $items) | |
serialize (array $fields) | |
supportedOrders () | |
Get the allowed queue orders for configuration validation. More... | |
supportsDelayedJobs () | |
Find out if delayed jobs are supported for configuration validation. More... | |
throwRedisException (RedisConnRef $conn, $e) | |
unserialize ( $blob) | |
Protected Member Functions inherited from JobQueue | |
doFlushCaches () | |
doWaitForBackups () | |
getRootJobCacheKey ( $signature) | |
isRootJobOldDuplicate (Job $job) | |
Check if the "root" job of a given job has been superseded by a newer one. More... | |
Protected Attributes | |
string | $compression |
Compression method to use *. More... | |
string | $key |
Key to prefix the queue keys with (used for testing) *. More... | |
null int | $maximumPeriodicTaskSeconds |
maximum seconds between execution of periodic tasks. More... | |
RedisConnectionPool | $redisPool |
string | $server |
Server address *. More... | |
Protected Attributes inherited from JobQueue | |
bool | $checkDelay |
Allow delayed jobs *. More... | |
int | $claimTTL |
Time to live in seconds *. More... | |
BagOStuff | $dupCache |
int | $maxTries |
Maximum number of times to try a job *. More... | |
string | $order |
Job priority for pop() *. More... | |
string | $type |
Job type *. More... | |
string | $wiki |
Wiki ID *. More... | |
Private Member Functions | |
getQueueKey ( $prop, $type=null) | |
Additional Inherited Members | |
Static Public Member Functions inherited from JobQueue | |
static | factory (array $params) |
Get a job queue object of the specified type. More... | |
static | incrStats ( $key, $type, $delta=1, $wiki=null) |
Call wfIncrStats() for the queue overall and for the queue type. More... | |
Class to handle job queues stored in Redis.
This is faster, less resource intensive, queue that JobQueueDB. All data for a queue using this class is placed into one redis server.
There are eight main redis keys used to track jobs:
Additionally, "rootjob:* keys track "root jobs" used for additional de-duplication. Aside from root job keys, all keys have no expiry, and are only removed when jobs are run. All the keys are prefixed with the relevant wiki ID information.
This class requires Redis 2.6 as it makes use Lua scripts for fast atomic operations. Additionally, it should be noted that redis has different persistence modes, such as rdb snapshots, journaling, and no persistent. Appropriate configuration should be made on the servers based on what queues are using it and what tolerance they have.
Definition at line 59 of file JobQueueRedis.php.
JobQueueRedis::__construct | ( | array | $params | ) |
@params include:
array | $params |
Reimplemented from JobQueue.
Definition at line 89 of file JobQueueRedis.php.
References $params, server, and RedisConnectionPool\singleton().
|
protected |
Job | $job |
MWException|JobQueueError |
Reimplemented from JobQueue.
Definition at line 420 of file JobQueueRedis.php.
References $e, $job, $res, are, array(), as, data, getConnection(), getQueueKey(), of, that, throwRedisException(), and wfDebugLog().
|
protected |
array | $jobs | |
$flags |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 196 of file JobQueueRedis.php.
References $e, $failed, $flags, $job, array(), as, getConnection(), getNewJobFields(), JobQueue\incrStats(), pushBlobs(), throwRedisException(), type, wfDebugLog(), and wiki.
|
protected |
Job | $job |
MWException|JobQueueError |
Reimplemented from JobQueue.
Definition at line 465 of file JobQueueRedis.php.
References $e, $job, $key, $params, $timestamp, getConnection(), JobQueue\getRootJobCacheKey(), and throwRedisException().
|
protected |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 516 of file JobQueueRedis.php.
References $e, $keys, array(), as, false, getConnection(), getQueueKey(), and throwRedisException().
|
protected |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 177 of file JobQueueRedis.php.
References $e, getConnection(), getQueueKey(), and throwRedisException().
|
protected |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 139 of file JobQueueRedis.php.
References $e, getConnection(), getQueueKey(), and throwRedisException().
|
protected |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 160 of file JobQueueRedis.php.
References $e, getConnection(), getQueueKey(), and throwRedisException().
|
protected |
Reimplemented from JobQueue.
Definition at line 726 of file JobQueueRedis.php.
References array().
|
protected |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 587 of file JobQueueRedis.php.
References $e, $res, $size, JobQueue\$type, array(), as, getConnection(), getQueueKey(), and throwRedisException().
Referenced by doGetSiblingQueuesWithJobs().
|
protected |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 583 of file JobQueueRedis.php.
References doGetSiblingQueueSizes().
|
protected |
MWException |
Reimplemented from JobQueue.
Definition at line 125 of file JobQueueRedis.php.
References $e, getConnection(), getQueueKey(), and throwRedisException().
Referenced by doIsEmpty().
|
protected |
MWException |
Reimplemented from JobQueue.
Definition at line 116 of file JobQueueRedis.php.
References doGetSize().
|
protected |
Job | $job |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 493 of file JobQueueRedis.php.
References $e, $job, $params, $timestamp, getConnection(), JobQueue\getRootJobCacheKey(), and throwRedisException().
|
protected |
JobQueueError |
Reimplemented from JobQueue.
Definition at line 304 of file JobQueueRedis.php.
References $blob, $e, $job, getConnection(), getJobFromFields(), JobQueue\incrStats(), popAndAcquireBlob(), popAndDeleteBlob(), recyclePruneAndUndelayJobs(), throwRedisException(), type, unserialize(), wfDebugLog(), and wiki.
JobQueueRedis::getAllDelayedJobs | ( | ) |
Reimplemented from JobQueue.
Definition at line 560 of file JobQueueRedis.php.
References $e, $job, array(), getConnection(), and throwRedisException().
JobQueueRedis::getAllQueuedJobs | ( | ) |
Reimplemented from JobQueue.
Definition at line 537 of file JobQueueRedis.php.
References $e, $job, array(), getConnection(), and throwRedisException().
JobQueueRedis::getCoalesceLocationInternal | ( | ) |
Do not use this function outside of JobQueue/JobQueueGroup.
Reimplemented from JobQueue.
Definition at line 579 of file JobQueueRedis.php.
References $server.
|
protected |
Get a connection to the server that handles all sub-queues for this queue.
JobQueueConnectionError |
Definition at line 828 of file JobQueueRedis.php.
References server.
Referenced by doAck(), doBatchPush(), doDeduplicateRootJob(), doDelete(), doGetAbandonedCount(), doGetAcquiredCount(), doGetDelayedCount(), doGetSiblingQueueSizes(), doGetSize(), doIsRootJobOldDuplicate(), doPop(), getAllDelayedJobs(), getAllQueuedJobs(), and recyclePruneAndUndelayJobs().
|
protected |
$fields | array |
Definition at line 774 of file JobQueueRedis.php.
References $job, $title, Job\factory(), and Title\makeTitleSafe().
Referenced by doPop().
JobQueueRedis::getJobFromUidInternal | ( | $uid, | |
RedisConnRef | $conn | ||
) |
This function should not be called outside JobQueueRedis.
$uid | string |
$conn | RedisConnRef |
MWException|JobQueueError |
Definition at line 617 of file JobQueueRedis.php.
References $e, $job, $title, Job\factory(), getQueueKey(), Title\makeTitle(), throwRedisException(), and unserialize().
|
protected |
IJobSpecification | $job |
Definition at line 752 of file JobQueueRedis.php.
References $job, array(), UIDGenerator\newRawUUIDv4(), UIDGenerator\QUICK_RAND, serialize(), and wfBaseConvert().
Referenced by doBatchPush().
|
private |
$prop | string |
$type | string|null |
Definition at line 852 of file JobQueueRedis.php.
References JobQueue\$type, key, list, wfForeignMemcKey(), wfSplitWikiID(), and wiki.
Referenced by doAck(), doDelete(), doGetAbandonedCount(), doGetAcquiredCount(), doGetDelayedCount(), doGetSiblingQueueSizes(), doGetSize(), getJobFromUidInternal(), popAndAcquireBlob(), popAndDeleteBlob(), pushBlobs(), and recyclePruneAndUndelayJobs().
|
protected |
Get the default queue order to use if configuration does not specify one.
Reimplemented from JobQueue.
Definition at line 103 of file JobQueueRedis.php.
|
protected |
RedisConnRef | $conn |
RedisException |
Definition at line 384 of file JobQueueRedis.php.
References are, array(), as, getQueueKey(), RedisConnRef\luaEval(), of, off, that, and then.
Referenced by doPop().
|
protected |
RedisConnRef | $conn |
RedisException |
Definition at line 351 of file JobQueueRedis.php.
References are, array(), data, getQueueKey(), RedisConnRef\luaEval(), of, off, that, and then.
Referenced by doPop().
|
protected |
RedisConnRef | $conn | |
array | $items | List of results from JobQueueRedis::getNewJobFields() |
RedisException |
Definition at line 251 of file JobQueueRedis.php.
References $args, are, array(), as, getQueueKey(), RedisConnRef\luaEval(), of, release, serialize(), that, and then.
Referenced by doBatchPush().
JobQueueRedis::recyclePruneAndUndelayJobs | ( | ) |
Recycle or destroy any jobs that have been claimed for too long and release any ready delayed jobs into the queue.
MWException|JobQueueError |
Definition at line 644 of file JobQueueRedis.php.
References $count, $e, $res, are, array(), as, from, getConnection(), getQueueKey(), in, JobQueue\incrStats(), is(), list, of, on, that, then, throwRedisException(), too, type, and wiki.
Referenced by doPop().
|
protected |
array | $fields |
Definition at line 790 of file JobQueueRedis.php.
References $blob, array(), and object.
Referenced by getNewJobFields(), and pushBlobs().
JobQueueRedis::setTestingPrefix | ( | $key | ) |
$key | string |
Reimplemented from JobQueue.
Definition at line 866 of file JobQueueRedis.php.
|
protected |
Get the allowed queue orders for configuration validation.
Reimplemented from JobQueue.
Definition at line 99 of file JobQueueRedis.php.
References array().
|
protected |
Find out if delayed jobs are supported for configuration validation.
Reimplemented from JobQueue.
Definition at line 107 of file JobQueueRedis.php.
|
protected |
$conn | RedisConnRef |
$e | RedisException |
JobQueueError |
Definition at line 842 of file JobQueueRedis.php.
References $e.
Referenced by doAck(), doBatchPush(), doDeduplicateRootJob(), doDelete(), doGetAbandonedCount(), doGetAcquiredCount(), doGetDelayedCount(), doGetSiblingQueueSizes(), doGetSize(), doIsRootJobOldDuplicate(), doPop(), getAllDelayedJobs(), getAllQueuedJobs(), getJobFromUidInternal(), and recyclePruneAndUndelayJobs().
|
protected |
string | $blob |
Definition at line 809 of file JobQueueRedis.php.
References $blob.
Referenced by doPop(), and getJobFromUidInternal().
|
protected |
Compression method to use *.
Definition at line 64 of file JobQueueRedis.php.
|
protected |
Key to prefix the queue keys with (used for testing) *.
Definition at line 68 of file JobQueueRedis.php.
Referenced by doDeduplicateRootJob(), and setTestingPrefix().
|
protected |
maximum seconds between execution of periodic tasks.
Used to speed up testing but should otherwise be left unset.
Definition at line 73 of file JobQueueRedis.php.
|
protected |
Definition at line 60 of file JobQueueRedis.php.
|
protected |
Server address *.
Definition at line 62 of file JobQueueRedis.php.
Referenced by getCoalesceLocationInternal().
const JobQueueRedis::MAX_AGE_PRUNE = 604800 |
Definition at line 66 of file JobQueueRedis.php.