MediaWiki
1.23.2
|
Class to handle enqueueing and running of background jobs for federated queues. More...
Public Member Functions | |
getAllDelayedJobs () | |
Get an iterator to traverse over all delayed jobs in this queue. More... | |
getAllQueuedJobs () | |
Get an iterator to traverse over all available jobs in this queue. More... | |
getCoalesceLocationInternal () | |
Do not use this function outside of JobQueue/JobQueueGroup. More... | |
setTestingPrefix ( $key) | |
Namespace the queue with a key to isolate it for testing. More... | |
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 | CACHE_TTL_LONG = 300 |
const | CACHE_TTL_SHORT = 30 |
Public Attributes inherited from JobQueue | |
const | QOS_ATOMIC = 1 |
const | ROOTJOB_TTL = 2419200 |
Protected Member Functions | |
__construct (array $params) | |
@params include: More... | |
doAck (Job $job) | |
doBatchPush (array $jobs, $flags) | |
doDeduplicateRootJob (Job $job) | |
doDelete () | |
doFlushCaches () | |
doGetAbandonedCount () | |
doGetAcquiredCount () | |
doGetDelayedCount () | |
doGetPeriodicTasks () | |
doGetSiblingQueueSizes (array $types) | |
doGetSiblingQueuesWithJobs (array $types) | |
doGetSize () | |
doIsEmpty () | |
doIsRootJobOldDuplicate (Job $job) | |
doPop () | |
doWaitForBackups () | |
getCrossPartitionSum ( $type, $method) | |
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... | |
supportsDelayedJobs () | |
Find out if delayed jobs are supported for configuration validation. More... | |
throwErrorIfAllPartitionsDown ( $down) | |
Throw an error if no partitions available. More... | |
tryJobInsertions (array $jobs, HashRing &$partitionRing, $flags) | |
Protected Member Functions inherited from JobQueue | |
getRootJobCacheKey ( $signature) | |
isRootJobOldDuplicate (Job $job) | |
Check if the "root" job of a given job has been superseded by a newer one. More... | |
Protected Attributes | |
BagOStuff | $cache |
int | $maxPartitionsTry |
Maximum number of partitions to try *. More... | |
array | $partitionMap = array() |
(partition name => weight) reverse sorted by weight * More... | |
HashRing | $partitionPushRing |
array | $partitionQueues = array() |
(partition name => JobQueue) reverse sorted by weight * 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 | |
getCacheKey ( $property) | |
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 enqueueing and running of background jobs for federated queues.
This class allows for queues to be partitioned into smaller queues. A partition is defined by the configuration for a JobQueue instance. For example, one can set $wgJobTypeConf['refreshLinks'] to point to a JobQueueFederated instance, which itself would consist of three JobQueueRedis instances, each using their own redis server. This would allow for the jobs to be split (evenly or based on weights) accross multiple servers if a single server becomes impractical or expensive. Different JobQueue classes can be mixed.
The basic queue configuration (e.g. "order", "claimTTL") of a federated queue is inherited by the partition queues. Additional configuration defines what section each wiki is in, what partition queues each section uses (and their weight), and the JobQueue configuration for each partition. Some sections might only need a single queue partition, like the sections for groups of small wikis.
If used for performance, then $wgMainCacheType should be set to memcached/redis. Note that "fifo" cannot be used for the ordering, since the data is distributed. One can still use "timestamp" instead, as in "roughly timestamp ordered". Also, queue classes used by this should ignore down servers (with TTL) to avoid slowness.
Definition at line 49 of file JobQueueFederated.php.
|
protected |
@params include:
array | $params |
MWException |
Reimplemented from JobQueue.
Definition at line 83 of file JobQueueFederated.php.
References $params, $partitionMap, $section, JobQueue\$wiki, array(), as, cache, JobQueue\factory(), wfGetMainCache(), and wiki.
|
protected |
Job | $job |
Reimplemented from JobQueue.
Definition at line 346 of file JobQueueFederated.php.
References $job.
|
protected |
array | $jobs | |
$flags |
Reimplemented from JobQueue.
Definition at line 209 of file JobQueueFederated.php.
References $flags, $partitionPushRing, and tryJobInsertions().
|
protected |
Job | $job |
MWException |
Reimplemented from JobQueue.
Definition at line 368 of file JobQueueFederated.php.
|
protected |
MWException |
Reimplemented from JobQueue.
Definition at line 382 of file JobQueueFederated.php.
References $e, $failed, as, MWExceptionHandler\logException(), and throwErrorIfAllPartitionsDown().
|
protected |
Reimplemented from JobQueue.
Definition at line 423 of file JobQueueFederated.php.
References JobQueue\$type, array(), as, cache, and getCacheKey().
|
protected |
Reimplemented from JobQueue.
Definition at line 176 of file JobQueueFederated.php.
References getCrossPartitionSum().
|
protected |
Reimplemented from JobQueue.
Definition at line 168 of file JobQueueFederated.php.
References getCrossPartitionSum().
|
protected |
Reimplemented from JobQueue.
Definition at line 172 of file JobQueueFederated.php.
References getCrossPartitionSum().
|
protected |
Reimplemented from JobQueue.
Definition at line 411 of file JobQueueFederated.php.
|
protected |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 495 of file JobQueueFederated.php.
References $e, $failed, $size, JobQueue\$type, array(), as, MWExceptionHandler\logException(), and throwErrorIfAllPartitionsDown().
|
protected |
array | $types | List of queues types |
Reimplemented from JobQueue.
Definition at line 469 of file JobQueueFederated.php.
References $e, $failed, array(), as, MWExceptionHandler\logException(), and throwErrorIfAllPartitionsDown().
|
protected |
Reimplemented from JobQueue.
Definition at line 164 of file JobQueueFederated.php.
References getCrossPartitionSum().
|
protected |
Reimplemented from JobQueue.
Definition at line 138 of file JobQueueFederated.php.
References $e, $failed, as, cache, getCacheKey(), MWExceptionHandler\logException(), and throwErrorIfAllPartitionsDown().
|
protected |
Job | $job |
Reimplemented from JobQueue.
Definition at line 354 of file JobQueueFederated.php.
|
protected |
Reimplemented from JobQueue.
Definition at line 305 of file JobQueueFederated.php.
References $e, $failed, $job, $partitionMap, cache, JobQueueDB\CACHE_TTL_LONG, getCacheKey(), MWExceptionHandler\logException(), ArrayUtils\pickRandom(), and throwErrorIfAllPartitionsDown().
|
protected |
Reimplemented from JobQueue.
Definition at line 397 of file JobQueueFederated.php.
References $e, $failed, as, MWExceptionHandler\logException(), and throwErrorIfAllPartitionsDown().
JobQueueFederated::getAllDelayedJobs | ( | ) |
Get an iterator to traverse over all delayed jobs in this queue.
Note: results may be stale if the queue is concurrently modified.
JobQueueError |
Reimplemented from JobQueue.
Definition at line 453 of file JobQueueFederated.php.
References as.
JobQueueFederated::getAllQueuedJobs | ( | ) |
Get an iterator to traverse over all available jobs in this queue.
This does not include jobs that are currently acquired or delayed. Note: results may be stale if the queue is concurrently modified.
JobQueueError |
Reimplemented from JobQueue.
Definition at line 442 of file JobQueueFederated.php.
References as.
|
private |
$property |
Definition at line 543 of file JobQueueFederated.php.
References $property, list, type, wfForeignMemcKey(), wfSplitWikiID(), and wiki.
Referenced by doFlushCaches(), doIsEmpty(), doPop(), getCrossPartitionSum(), and tryJobInsertions().
JobQueueFederated::getCoalesceLocationInternal | ( | ) |
Do not use this function outside of JobQueue/JobQueueGroup.
Reimplemented from JobQueue.
Definition at line 464 of file JobQueueFederated.php.
|
protected |
string | $type | |
string | $method |
Definition at line 185 of file JobQueueFederated.php.
References $count, $e, $failed, JobQueue\$type, as, cache, getCacheKey(), MWExceptionHandler\logException(), and throwErrorIfAllPartitionsDown().
Referenced by doGetAbandonedCount(), doGetAcquiredCount(), doGetDelayedCount(), and doGetSize().
|
protected |
Get the default queue order to use if configuration does not specify one.
Reimplemented from JobQueue.
Definition at line 130 of file JobQueueFederated.php.
JobQueueFederated::setTestingPrefix | ( | $key | ) |
Namespace the queue with a key to isolate it for testing.
string | $key |
MWException |
Reimplemented from JobQueue.
Definition at line 532 of file JobQueueFederated.php.
References as.
|
protected |
Get the allowed queue orders for configuration validation.
Reimplemented from JobQueue.
Definition at line 125 of file JobQueueFederated.php.
References array().
|
protected |
Find out if delayed jobs are supported for configuration validation.
Reimplemented from JobQueue.
Definition at line 134 of file JobQueueFederated.php.
|
protected |
Throw an error if no partitions available.
int | $down | The number of up partitions down |
JobQueueError |
Definition at line 526 of file JobQueueFederated.php.
Referenced by doDelete(), doGetSiblingQueueSizes(), doGetSiblingQueuesWithJobs(), doIsEmpty(), doPop(), doWaitForBackups(), and getCrossPartitionSum().
array | $jobs | |
HashRing | $partitionRing | |
int | $flags |
JobQueueError |
Definition at line 233 of file JobQueueFederated.php.
References $e, $flags, $job, $ok, array(), as, cache, JobQueueDB\CACHE_TTL_LONG, getCacheKey(), HashRing\getLocation(), HashRing\getLocationWeights(), MWExceptionHandler\logException(), HashRing\newWithoutLocation(), and ArrayUtils\pickRandom().
Referenced by doBatchPush().
|
protected |
Definition at line 56 of file JobQueueFederated.php.
|
protected |
Maximum number of partitions to try *.
Definition at line 58 of file JobQueueFederated.php.
(partition name => weight) reverse sorted by weight *
Definition at line 50 of file JobQueueFederated.php.
Referenced by __construct(), and doPop().
|
protected |
(partition name => JobQueue) reverse sorted by weight *
Definition at line 52 of file JobQueueFederated.php.
const JobQueueFederated::CACHE_TTL_LONG = 300 |
Definition at line 61 of file JobQueueFederated.php.
const JobQueueFederated::CACHE_TTL_SHORT = 30 |
Definition at line 60 of file JobQueueFederated.php.