MediaWiki
1.28.0
|
Class to handle enqueueing and running of background jobs for federated queues. More...
Public Member Functions | |
getAllAbandonedJobs () | |
getAllAcquiredJobs () | |
getAllDelayedJobs () | |
getAllQueuedJobs () | |
getCoalesceLocationInternal () | |
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 (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... | |
getAllAcquiredJobs () | |
Get an iterator to traverse over all claimed jobs in this queue. More... | |
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... | |
getDelayedCount () | |
Get the number of delayed jobs (these are temporarily out of the queue). More... | |
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... | |
Protected Attributes | |
int | $maxPartitionsTry |
Maximum number of partitions to try. More... | |
JobQueue[] | $partitionQueues = [] |
(partition name => JobQueue) reverse sorted by weight More... | |
HashRing | $partitionRing |
Protected Attributes inherited from JobQueue | |
JobQueueAggregator | $aggr |
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 bool | $readOnlyReason |
Read only rationale (or false if r/w) More... | |
string | $type |
Job type. More... | |
string | $wiki |
Wiki ID. More... | |
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) |
Call wfIncrStats() for the queue overall and for the queue type. More... | |
Public Attributes inherited from JobQueue | |
const | QOS_ATOMIC = 1 |
const | ROOTJOB_TTL = 2419200 |
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 |
array | $params | Possible keys:
|
MWException |
Definition at line 75 of file JobQueueFederated.php.
References $params, $section, JobQueue\$wiki, as, JobQueue\factory(), and wiki.
|
protected |
Definition at line 309 of file JobQueueFederated.php.
|
protected |
Definition at line 182 of file JobQueueFederated.php.
References $e, $flags, $partitionRing, HashRing\getLiveRing(), and tryJobInsertions().
|
protected |
Definition at line 332 of file JobQueueFederated.php.
References $e, and IJobSpecification\getRootJobParams().
|
protected |
Definition at line 347 of file JobQueueFederated.php.
References $e, $queue, as, logException(), and throwErrorIfAllPartitionsDown().
|
protected |
Definition at line 376 of file JobQueueFederated.php.
|
protected |
Definition at line 157 of file JobQueueFederated.php.
References getCrossPartitionSum().
|
protected |
Definition at line 149 of file JobQueueFederated.php.
References getCrossPartitionSum().
|
protected |
Definition at line 153 of file JobQueueFederated.php.
References getCrossPartitionSum().
|
protected |
Definition at line 458 of file JobQueueFederated.php.
References $e, $queue, JobQueue\$type, as, logException(), and throwErrorIfAllPartitionsDown().
|
protected |
Definition at line 432 of file JobQueueFederated.php.
References $e, $queue, as, logException(), and throwErrorIfAllPartitionsDown().
|
protected |
Definition at line 145 of file JobQueueFederated.php.
References getCrossPartitionSum().
|
protected |
Definition at line 129 of file JobQueueFederated.php.
References $e, $queue, as, logException(), and throwErrorIfAllPartitionsDown().
|
protected |
Definition at line 317 of file JobQueueFederated.php.
References $e, and Job\getRootJobParams().
|
protected |
Definition at line 277 of file JobQueueFederated.php.
References $e, $job, $queue, logException(), ArrayUtils\pickRandom(), and throwErrorIfAllPartitionsDown().
|
protected |
Definition at line 362 of file JobQueueFederated.php.
References $e, $queue, as, logException(), and throwErrorIfAllPartitionsDown().
JobQueueFederated::getAllAbandonedJobs | ( | ) |
Definition at line 416 of file JobQueueFederated.php.
JobQueueFederated::getAllAcquiredJobs | ( | ) |
Definition at line 405 of file JobQueueFederated.php.
JobQueueFederated::getAllDelayedJobs | ( | ) |
Definition at line 394 of file JobQueueFederated.php.
JobQueueFederated::getAllQueuedJobs | ( | ) |
Definition at line 383 of file JobQueueFederated.php.
JobQueueFederated::getCoalesceLocationInternal | ( | ) |
Definition at line 427 of file JobQueueFederated.php.
References serialize().
|
protected |
string | $type | |
string | $method |
Definition at line 166 of file JobQueueFederated.php.
References $count, $e, $queue, as, logException(), and throwErrorIfAllPartitionsDown().
Referenced by doGetAbandonedCount(), doGetAcquiredCount(), doGetDelayedCount(), and doGetSize().
|
protected |
Definition at line 482 of file JobQueueFederated.php.
References wfDebugLog().
Referenced by doDelete(), doGetSiblingQueueSizes(), doGetSiblingQueuesWithJobs(), doIsEmpty(), doPop(), doWaitForBackups(), getCrossPartitionSum(), and tryJobInsertions().
|
protected |
Definition at line 115 of file JobQueueFederated.php.
|
protected |
Definition at line 110 of file JobQueueFederated.php.
|
protected |
Definition at line 119 of file JobQueueFederated.php.
|
protected |
Throw an error if no partitions available.
int | $down | The number of up partitions down |
JobQueueError |
Definition at line 493 of file JobQueueFederated.php.
Referenced by doDelete(), doGetSiblingQueueSizes(), doGetSiblingQueuesWithJobs(), doIsEmpty(), doPop(), doWaitForBackups(), and getCrossPartitionSum().
array | $jobs | |
HashRing | $partitionRing | |
int | $flags |
JobQueueError |
Definition at line 211 of file JobQueueFederated.php.
References $e, $flags, $job, $queue, as, HashRing\ejectFromLiveRing(), HashRing\getLiveLocation(), HashRing\getLiveLocationWeights(), logException(), ArrayUtils\pickRandom(), and serialize().
Referenced by doBatchPush().
|
protected |
Maximum number of partitions to try.
Definition at line 56 of file JobQueueFederated.php.
|
protected |
(partition name => JobQueue) reverse sorted by weight
Definition at line 53 of file JobQueueFederated.php.
|
protected |
Definition at line 51 of file JobQueueFederated.php.
Referenced by doBatchPush().