Loading
Add minimum floor to Elastic migration throttle_delay
What does this MR do and why?
A migration declaring throttle_delay <= 1 second can be blocked by its own self-enqueued successor. The exclusive-lease TTL is [throttle_delay.to_i - 1, 1].max, which equals 1 when throttle_delay is 1 second. The lease can still be held when the successor arrives, inverting the throttle it is meant to apply.
This MR adds MINIMUM_THROTTLE_DELAY = 2.seconds and enforces it in the throttle_delay class method so the lease TTL formula always produces a value strictly less than the delay. No existing migration declares a delay below 5 seconds, so this is a preventive guard.
Changes
ee/app/workers/concerns/elastic/migration_options.rb: addMINIMUM_THROTTLE_DELAY = 2.secondsconstant; raiseArgumentErrorinthrottle_delay(value)when the value is below the minimum.ee/spec/workers/concerns/elastic/migration_options_spec.rb: two new examples — one asserting the error is raised for a sub-minimum value, one asserting the minimum itself is accepted.
How to verify
bundle exec rspec ee/spec/workers/concerns/elastic/migration_options_spec.rbMR acceptance checklist
- This MR has been reviewed against the MR acceptance checklist.
- This contribution was prepared with the help of an AI assistant. I reviewed the changes and take responsibility for them.
Changelog: fixed Closes #630966