MediaWiki  REL1_31
JobQueueSecondTestQueue Class Reference

A wrapper for the JobQueue that delegates all the method calls to a single, main queue, and also pushes all the jobs to a second job queue that's being debugged. More...

Inheritance diagram for JobQueueSecondTestQueue:
Collaboration diagram for JobQueueSecondTestQueue:

Public Member Functions

 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...
 
- 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...
 
 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 Member Functions

 __construct (array $params)
 
 assertNotReadOnly ()
 
 doAck (Job $job)
 
 doBatchPush (array $jobs, $flags)
 
 doDeduplicateRootJob (IJobSpecification $job)
 
 doDelete ()
 
 doFlushCaches ()
 
 doGetAbandonedCount ()
 
 doGetAcquiredCount ()
 
 doGetDelayedCount ()
 
 doGetSiblingQueueSizes (array $types)
 
 doGetSiblingQueuesWithJobs (array $types)
 
 doGetSize ()
 
 doIsEmpty ()
 
 doIsRootJobOldDuplicate (Job $job)
 
 doPop ()
 
 doWaitForBackups ()
 
 getRootJobCacheKey ( $signature)
 
 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...
 
- Protected Member Functions inherited from JobQueue
 isRootJobOldDuplicate (Job $job)
 Check if the "root" job of a given job has been superseded by a newer one. More...
 

Private Attributes

JobQueue $debugQueue
 
JobQueue $mainQueue
 
bool $onlyWriteToDebugQueue
 

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
 
- 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...
 

Detailed Description

A wrapper for the JobQueue that delegates all the method calls to a single, main queue, and also pushes all the jobs to a second job queue that's being debugged.

This class was temporary added to test transitioning to the JobQueueEventBus and will removed after the transition is completed. This code is only needed while we are testing the new infrastructure to be able to compare the results between the queue implementations and make sure that they process the same jobs, deduplicate correctly, compare the delays, backlogs and make sure no jobs are lost. When the new infrastructure is well tested this will not be needed any more.

Deprecated:
since 1.30
Since
1.30

Definition at line 18 of file JobQueueSecondTestQueue.php.

Constructor & Destructor Documentation

◆ __construct()

JobQueueSecondTestQueue::__construct ( array  $params)
protected
Parameters
array$params
Exceptions
MWException

Reimplemented from JobQueue.

Definition at line 35 of file JobQueueSecondTestQueue.php.

References $params, and JobQueue\factory().

Member Function Documentation

◆ assertNotReadOnly()

JobQueueSecondTestQueue::assertNotReadOnly ( )
protected
Exceptions
JobQueueReadOnlyError

Reimplemented from JobQueue.

Definition at line 287 of file JobQueueSecondTestQueue.php.

◆ doAck()

JobQueueSecondTestQueue::doAck ( Job  $job)
protected
See also
JobQueue::ack()
Parameters
Job$job
Returns
Job|bool

Reimplemented from JobQueue.

Definition at line 151 of file JobQueueSecondTestQueue.php.

References $job.

◆ doBatchPush()

JobQueueSecondTestQueue::doBatchPush ( array  $jobs,
  $flags 
)
protected
See also
JobQueue::batchPush()
Parameters
IJobSpecification[]$jobs
int$flags

Reimplemented from JobQueue.

Definition at line 126 of file JobQueueSecondTestQueue.php.

References MWExceptionHandler\logException().

◆ doDeduplicateRootJob()

JobQueueSecondTestQueue::doDeduplicateRootJob ( IJobSpecification  $job)
protected
See also
JobQueue::deduplicateRootJob()
Parameters
IJobSpecification$job
Exceptions
MWException
Returns
bool

Reimplemented from JobQueue.

Definition at line 161 of file JobQueueSecondTestQueue.php.

References $job.

◆ doDelete()

JobQueueSecondTestQueue::doDelete ( )
protected
See also
JobQueue::delete()
Returns
bool
Exceptions
MWException

Reimplemented from JobQueue.

Definition at line 187 of file JobQueueSecondTestQueue.php.

◆ doFlushCaches()

JobQueueSecondTestQueue::doFlushCaches ( )
protected
See also
JobQueue::flushCaches()
Returns
void

Reimplemented from JobQueue.

Definition at line 203 of file JobQueueSecondTestQueue.php.

◆ doGetAbandonedCount()

JobQueueSecondTestQueue::doGetAbandonedCount ( )
protected
See also
JobQueue::getAbandonedCount()
Returns
int

Reimplemented from JobQueue.

Definition at line 117 of file JobQueueSecondTestQueue.php.

◆ doGetAcquiredCount()

JobQueueSecondTestQueue::doGetAcquiredCount ( )
protected
See also
JobQueue::getAcquiredCount()
Returns
int

Reimplemented from JobQueue.

Definition at line 101 of file JobQueueSecondTestQueue.php.

◆ doGetDelayedCount()

JobQueueSecondTestQueue::doGetDelayedCount ( )
protected
See also
JobQueue::getDelayedCount()
Returns
int

Reimplemented from JobQueue.

Definition at line 109 of file JobQueueSecondTestQueue.php.

◆ doGetSiblingQueueSizes()

JobQueueSecondTestQueue::doGetSiblingQueueSizes ( array  $types)
protected
See also
JobQueue::getSiblingQueuesSize()
Parameters
array$typesList of queues types
Returns
array|null (list of queue types) or null if unsupported

Reimplemented from JobQueue.

Definition at line 280 of file JobQueueSecondTestQueue.php.

◆ doGetSiblingQueuesWithJobs()

JobQueueSecondTestQueue::doGetSiblingQueuesWithJobs ( array  $types)
protected
See also
JobQueue::getSiblingQueuesWithJobs()
Parameters
array$typesList of queues types
Returns
array|null (list of queue types) or null if unsupported

Reimplemented from JobQueue.

Definition at line 271 of file JobQueueSecondTestQueue.php.

◆ doGetSize()

JobQueueSecondTestQueue::doGetSize ( )
protected
See also
JobQueue::getSize()
Returns
int

Reimplemented from JobQueue.

Definition at line 93 of file JobQueueSecondTestQueue.php.

◆ doIsEmpty()

JobQueueSecondTestQueue::doIsEmpty ( )
protected
See also
JobQueue::isEmpty()
Returns
bool

Reimplemented from JobQueue.

Definition at line 85 of file JobQueueSecondTestQueue.php.

◆ doIsRootJobOldDuplicate()

JobQueueSecondTestQueue::doIsRootJobOldDuplicate ( Job  $job)
protected
See also
JobQueue::isRootJobOldDuplicate()
Parameters
Job$job
Returns
bool

Reimplemented from JobQueue.

Definition at line 170 of file JobQueueSecondTestQueue.php.

References $job.

◆ doPop()

JobQueueSecondTestQueue::doPop ( )
protected
See also
JobQueue::pop()
Returns
Job|bool

Reimplemented from JobQueue.

Definition at line 142 of file JobQueueSecondTestQueue.php.

◆ doWaitForBackups()

JobQueueSecondTestQueue::doWaitForBackups ( )
protected
See also
JobQueue::waitForBackups()
Returns
void

Reimplemented from JobQueue.

Definition at line 195 of file JobQueueSecondTestQueue.php.

◆ getAllAbandonedJobs()

JobQueueSecondTestQueue::getAllAbandonedJobs ( )

Get an iterator to traverse over all abandoned jobs in this queue.

Returns
Iterator
Exceptions
JobQueueError
Since
1.25

Reimplemented from JobQueue.

Definition at line 252 of file JobQueueSecondTestQueue.php.

◆ getAllAcquiredJobs()

JobQueueSecondTestQueue::getAllAcquiredJobs ( )

Get an iterator to traverse over all claimed jobs in this queue.

Callers should be quick to iterator over it or few results will be returned due to jobs being acknowledged and deleted

Returns
Iterator
Exceptions
JobQueueError
Since
1.26

Reimplemented from JobQueue.

Definition at line 241 of file JobQueueSecondTestQueue.php.

◆ getAllDelayedJobs()

JobQueueSecondTestQueue::getAllDelayedJobs ( )

Get an iterator to traverse over all delayed jobs in this queue.

Note: results may be stale if the queue is concurrently modified.

Returns
Iterator
Exceptions
JobQueueError
Since
1.22

Reimplemented from JobQueue.

Definition at line 227 of file JobQueueSecondTestQueue.php.

◆ getAllQueuedJobs()

JobQueueSecondTestQueue::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.

Returns
Iterator
Exceptions
JobQueueError

Reimplemented from JobQueue.

Definition at line 215 of file JobQueueSecondTestQueue.php.

◆ getCoalesceLocationInternal()

JobQueueSecondTestQueue::getCoalesceLocationInternal ( )

Do not use this function outside of JobQueue/JobQueueGroup.

Returns
string
Since
1.22

Reimplemented from JobQueue.

Definition at line 262 of file JobQueueSecondTestQueue.php.

◆ getRootJobCacheKey()

JobQueueSecondTestQueue::getRootJobCacheKey (   $signature)
protected
Parameters
string$signatureHash identifier of the root job
Returns
string

Reimplemented from JobQueue.

Definition at line 178 of file JobQueueSecondTestQueue.php.

◆ optimalOrder()

JobQueueSecondTestQueue::optimalOrder ( )
protected

Get the default queue order to use if configuration does not specify one.

Returns
string One of (random, timestamp, fifo, undefined)

Reimplemented from JobQueue.

Definition at line 68 of file JobQueueSecondTestQueue.php.

◆ supportedOrders()

JobQueueSecondTestQueue::supportedOrders ( )
protected

Get the allowed queue orders for configuration validation.

Returns
array Subset of (random, timestamp, fifo, undefined)

Reimplemented from JobQueue.

Definition at line 59 of file JobQueueSecondTestQueue.php.

◆ supportsDelayedJobs()

JobQueueSecondTestQueue::supportsDelayedJobs ( )
protected

Find out if delayed jobs are supported for configuration validation.

Returns
bool Whether delayed jobs are supported

Reimplemented from JobQueue.

Definition at line 77 of file JobQueueSecondTestQueue.php.

Member Data Documentation

◆ $debugQueue

JobQueue JobQueueSecondTestQueue::$debugQueue
private

Definition at line 28 of file JobQueueSecondTestQueue.php.

◆ $mainQueue

JobQueue JobQueueSecondTestQueue::$mainQueue
private

Definition at line 23 of file JobQueueSecondTestQueue.php.

◆ $onlyWriteToDebugQueue

bool JobQueueSecondTestQueue::$onlyWriteToDebugQueue
private

Definition at line 33 of file JobQueueSecondTestQueue.php.


The documentation for this class was generated from the following file: