Homec4science

Fix an issue where PhabricatorWorkerLeaseQuery may lease different tasks than…

Authored by epriestley <git@epriestley.com> on Nov 1 2012, 19:30.

Description

Fix an issue where PhabricatorWorkerLeaseQuery may lease different tasks than it selects

Summary:
We lock tasks by setting leaseOwner to a unique value, but the value is currently unique-to-the-process rather than unique-to-the-query. This means that if a process leases a task, then leases another task, both tasks will have the same leaseOwner. This can cause an issue where we go to select the task we just leased and get the other task instead, if we aren't careful about the select construction.

We can avoid this by being clever and making sure the select is constructed correctly, but making the leaseOwner unique to the query is much simpler and more foolproof. This guarantees we always select only the rows we just leased.

Also remove PhabricatorGoodForNothingWorker since PhabricatorTestWorker fills its role of allowing things to be tested, and simplify the unit tests since we don't need to be clever about avoiding this issue any more.

Test Plan: Ran unit tests.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2015

Differential Revision: https://secure.phabricator.com/D3862

Details

Committed
epriestley <git@epriestley.com>Nov 1 2012, 19:30
Pushed
aubortJan 31 2017, 17:16
Parents
rPHf0fdcf1a516c: Undumb the Drydock resource allocator pipeline
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH0364ccdd5f4d: Fix an issue where PhabricatorWorkerLeaseQuery may lease different tasks than… (authored by epriestley <git@epriestley.com>).Nov 1 2012, 19:30