Page MenuHomePhabricator

After a Drydock lease triggers a resource to be reclaimed, stop it from triggering another reclaim until the first one completes

Authored by epriestley on Oct 24 2018, 4:15 PM.



Depends on D19752. Ref T13210. If resources take a long time to reclaim/destroy (normally, more than 15 seconds) a single new lease may update several times during the reclaim/destroy process and end up reclaiming multiple resources.

Instead: after a lease triggers a reclaim, prevent it from triggering another reclaim as long as the resource it is reclaiming hasn't finished its reclaim/destroy cycle. Basically, each lease only gets to destroy one resource at a time.

Test Plan
  • Added a sleep(120) to destroyResource() to simulate a long reclaim/destroy cycle.
  • Allocated A, A, A working copies. Leased a B working copy.
  • Before patch: saw "B" lease destroy all three "A" working copies after ~0, ~15, and ~30 seconds, then build a new "B" resource after ~120 seconds (when the first reclaim/destroy finished).
  • After patch: saw "B" lease destroy one "A" working copy after ~0 seconds, then wait patiently until it finished up, then build a new "B" resource.

Diff Detail

rP Phabricator
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Oct 24 2018, 4:15 PM
Owners added a subscriber: Restricted Owners Package.Oct 24 2018, 4:15 PM
epriestley requested review of this revision.Oct 24 2018, 4:17 PM
epriestley updated this revision to Diff 47186.Oct 24 2018, 4:19 PM
  • Put the $command->save() entirely inside the transaction block.
amckinley accepted this revision.Oct 26 2018, 1:49 AM
This revision is now accepted and ready to land.Oct 26 2018, 1:49 AM
This revision was automatically updated to reflect the committed changes.