[JobQueue] Reduced deadlocks in claim() function.
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 31 Oct 2012 21:34:35 +0000 (14:34 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 1 Nov 2012 02:59:39 +0000 (19:59 -0700)
commitc4924bb8bb97112949b968f10384a0d69afc0325
tree0b9318402ba2ea63296ba47b891d20993eeb2ecb
parent78a5729fea2adedc0342d1e36e99f4fcf2c37320
[JobQueue] Reduced deadlocks in claim() function.

* Split claim() into claimRandom() and claimOldest().
* Added a new SELECT+UPDATE method that will automatically be used if there are slaves.
  This is what claimRandom() uses, which is the claim function used for random queues.
  This can handle torture testing with dozens of processes using NullJob without deadlocks.
* Made claimOldest() work using the same method as the old claim() method. Doing SELECT
  first won't really work that well in this case. The useless "job_random > 0" is now gone
  from the query, which actually alleviates deadlock problems too. This method is used for
  "timestamp" ordered queues.

Change-Id: Iaea96ff8eba2c918376f9465b54e9bbc3124f473
includes/job/JobQueue.php
includes/job/JobQueueDB.php