MediaWiki  REL1_21
JobQueueDB Class Reference

Class to handle job queues stored in the DB. More...

Inheritance diagram for JobQueueDB:
Collaboration diagram for JobQueueDB:

List of all members.

Public Member Functions

 getAllQueuedJobs ()
 recycleAndDeleteStaleJobs ()
 Recycle or destroy any jobs that have been claimed for too long.

Public Attributes

const CACHE_TTL_LONG = 300
const CACHE_TTL_SHORT = 30
const MAX_AGE_PRUNE = 604800
const MAX_JOB_RANDOM = 2147483647
const MAX_OFFSET = 255
const ROOTJOB_TTL = 1209600

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 (Job $job)
 doFlushCaches ()
 doGetAcquiredCount ()
 doGetPeriodicTasks ()
 doGetSize ()
 doIsEmpty ()
 doPop ()
 doWaitForBackups ()
 getDB ($index)
 getMasterDB ()
 getSlaveDB ()
 insertFields (Job $job)
 isRootJobOldDuplicate (Job $job)
 Check if the "root" job of a given job has been superseded by a newer one.
 optimalOrder ()
 supportedOrders ()

Static Protected Member Functions

static extractBlob ($blob)
static makeBlob ($params)

Protected Attributes

 $cluster = false

Private Member Functions

 getCacheKey ($property)
 getRootJobCacheKey ($signature)

Detailed Description

Class to handle job queues stored in the DB.

Since:
1.21

Definition at line 30 of file JobQueueDB.php.


Constructor & Destructor Documentation

JobQueueDB::__construct ( array params) [protected]

Additional parameters include:

  • cluster : The name of an external cluster registered via LBFactory. If not specified, the primary DB cluster for the wiki will be used. This can be overridden with a custom cluster so that DB handles will be retrieved via LBFactory::getExternalLB() and getConnection().
    Parameters:
    $paramsarray

Reimplemented from JobQueue.

Definition at line 48 of file JobQueueDB.php.


Member Function Documentation

JobQueueDB::claimOldest ( uuid) [protected]

Reserve a row with a single UPDATE without holding row locks over RTTs...

Parameters:
string$uuid32 char hex string
Returns:
Row|false

Definition at line 357 of file JobQueueDB.php.

References array(), getMasterDB(), list, type, and wfDebugLog().

Referenced by doPop().

JobQueueDB::claimRandom ( uuid,
rand,
gte 
) [protected]

Reserve a row with a single UPDATE without holding row locks over RTTs...

Parameters:
string$uuid32 char hex string
$randinteger Random unsigned integer (31 bits)
bool$gteSearch for job_random >= $random (otherwise job_random <= $random)
Returns:
Row|false

Definition at line 279 of file JobQueueDB.php.

References $dir, $wgMemc, array(), getCacheKey(), getMasterDB(), global, list, and type.

Referenced by doPop().

JobQueueDB::doAck ( Job job) [protected]
See also:
JobQueue::doAck()
Parameters:
Job$job
Exceptions:
MWException
Returns:
Job|bool

Reimplemented from JobQueue.

Definition at line 491 of file JobQueueDB.php.

References array(), Job\getId(), getMasterDB(), list, type, and use.

JobQueueDB::doBatchPush ( array jobs,
flags 
) [protected]
See also:
JobQueue::doBatchPush()
Parameters:
array$jobs
$flags
Exceptions:
DBError|Exception
Returns:
bool

Reimplemented from JobQueue.

Definition at line 145 of file JobQueueDB.php.

References $flags, $job, $res, $wgMemc, array(), as, CACHE_TTL_LONG, getCacheKey(), getMasterDB(), global, insertFields(), list, JobQueue\QoS_Atomic, use, wfDebug(), and wfIncrStats().

JobQueueDB::doDeduplicateRootJob ( Job job) [protected]
See also:
JobQueue::doDeduplicateRootJob()
Parameters:
Job$job
Exceptions:
MWException
Returns:
bool

Reimplemented from JobQueue.

Definition at line 517 of file JobQueueDB.php.

References $params, $timestamp, $wgMemc, getMasterDB(), Job\getParams(), getRootJobCacheKey(), global, list, ROOTJOB_TTL, and use.

JobQueueDB::doFlushCaches ( ) [protected]
Returns:
void

Reimplemented from JobQueue.

Definition at line 593 of file JobQueueDB.php.

References JobQueue\$type, $wgMemc, array(), as, getCacheKey(), and global.

See also:
JobQueue::doGetAcquiredCount()
Returns:
integer

Reimplemented from JobQueue.

Definition at line 114 of file JobQueueDB.php.

References $count, $dbr, $wgMemc, array(), getCacheKey(), getSlaveDB(), global, list, and type.

Returns:
Array

Reimplemented from JobQueue.

Definition at line 581 of file JobQueueDB.php.

References array().

JobQueueDB::doGetSize ( ) [protected]
See also:
JobQueue::doGetSize()
Returns:
integer

Reimplemented from JobQueue.

Definition at line 90 of file JobQueueDB.php.

References $dbr, $size, $wgMemc, array(), getCacheKey(), getSlaveDB(), global, list, and type.

JobQueueDB::doIsEmpty ( ) [protected]
See also:
JobQueue::doIsEmpty()
Returns:
bool

Reimplemented from JobQueue.

Definition at line 65 of file JobQueueDB.php.

References $dbr, $wgMemc, array(), getCacheKey(), getSlaveDB(), global, list, and type.

See also:
JobQueue::doWaitForBackups()
Returns:
void

Reimplemented from JobQueue.

Definition at line 574 of file JobQueueDB.php.

References wfWaitForSlaves().

static JobQueueDB::extractBlob ( blob) [static, protected]
Parameters:
$blob
Returns:
bool|mixed

Definition at line 709 of file JobQueueDB.php.

References $blob.

See also:
JobQueue::getAllQueuedJobs()
Returns:
Iterator

Reimplemented from JobQueue.

Definition at line 605 of file JobQueueDB.php.

References $dbr, $job, array(), JobQueue\factory(), getSlaveDB(), JobQueue\getType(), list, Title\makeTitle(), and use.

JobQueueDB::getDB ( index) [protected]
Parameters:
$indexinteger (DB_SLAVE/DB_MASTER)
Returns:
Array (DatabaseBase, ScopedCallback)

Definition at line 640 of file JobQueueDB.php.

References $lb, array(), false, use, wfGetLB(), wfGetLBFactory(), and wiki.

Referenced by getMasterDB(), and getSlaveDB().

JobQueueDB::getRootJobCacheKey ( signature) [private]
Parameters:
string$signatureHash identifier of the root job
Returns:
string

Definition at line 688 of file JobQueueDB.php.

References list, type, wfForeignMemcKey(), wfSplitWikiID(), and wiki.

Referenced by doDeduplicateRootJob(), and isRootJobOldDuplicate().

JobQueueDB::getSlaveDB ( ) [protected]
Returns:
Array (DatabaseBase, ScopedCallback)

Definition at line 625 of file JobQueueDB.php.

References getDB().

Referenced by doGetAcquiredCount(), doGetSize(), doIsEmpty(), and getAllQueuedJobs().

JobQueueDB::insertFields ( Job job) [protected]
Parameters:
$jobJob
Returns:
array

Definition at line 657 of file JobQueueDB.php.

References array(), Job\getDeduplicationInfo(), getMasterDB(), Job\getParams(), Job\getTitle(), Job\getType(), list, makeBlob(), and wfBaseConvert().

Referenced by doBatchPush().

JobQueueDB::isRootJobOldDuplicate ( Job job) [protected]

Check if the "root" job of a given job has been superseded by a newer one.

Parameters:
$jobJob
Returns:
bool

Definition at line 552 of file JobQueueDB.php.

References $params, $timestamp, $wgMemc, Job\getParams(), getRootJobCacheKey(), and global.

Referenced by doPop().

static JobQueueDB::makeBlob ( params) [static, protected]
Parameters:
$params
Returns:
string

Definition at line 697 of file JobQueueDB.php.

References $params.

Referenced by insertFields().

JobQueueDB::optimalOrder ( ) [protected]
Returns:
string One of (random, timestamp, fifo)

Reimplemented from JobQueue.

Definition at line 57 of file JobQueueDB.php.

Recycle or destroy any jobs that have been claimed for too long.

Returns:
integer Number of jobs recycled/deleted

Definition at line 417 of file JobQueueDB.php.

References $count, $res, $wgMemc, array(), getCacheKey(), getMasterDB(), global, list, type, and wfIncrStats().

JobQueueDB::supportedOrders ( ) [protected]
Returns:
Array Subset of (random, timestamp, fifo)

Reimplemented from JobQueue.

Definition at line 53 of file JobQueueDB.php.

References array().


Member Data Documentation

JobQueueDB::$cluster = false [protected]

Definition at line 38 of file JobQueueDB.php.

Definition at line 33 of file JobQueueDB.php.

Referenced by doBatchPush().

Definition at line 32 of file JobQueueDB.php.

const JobQueueDB::MAX_AGE_PRUNE = 604800

Definition at line 34 of file JobQueueDB.php.

const JobQueueDB::MAX_JOB_RANDOM = 2147483647

Definition at line 35 of file JobQueueDB.php.

Definition at line 36 of file JobQueueDB.php.

const JobQueueDB::ROOTJOB_TTL = 1209600

Definition at line 31 of file JobQueueDB.php.

Referenced by doDeduplicateRootJob().


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