ChangeMergeQueue: Fix race condition
To the multiple triggers of submit action belong:
* ChangeMergeQueue.merge() method called from the UI
* ChangeMergeQueue.schedule() method called by background
ReloadSubmitQueueOp
active map in ChangeMergeQueue acts as a guard for submit job
scheduling. However schedule() ignores the fact that the submit
processing was already started for a specific branch and double
submit action is scheduled.
Specifically for cherry-pick submit strategy that cannot end
good and fails with database constraints violation or similar,
depending on the underlying database implementation.
Guard the background scheduling similar to the UI scheduling.
Defining unique index prevents the database corruption: [1], [2]
but not the collision between manual and background merge jobs.
[1] http://paste.openstack.org/show/83883
[2] http://paste.openstack.org/show/83888
Bug: issue 2034
Bug: issue 2383
Bug: issue 2702
Change-Id: I5b23f9d481351280e26412b82b525947338d9c00
1 file changed