Skip to content

Allow to put migrations on hold for some time

Andreas Brandl requested to merge ab/hold-migration into master

We would like to be able to react to system signals to throttle or pause migrations. Therefore, we need some sort of mechanic to indicate a migration is "on hold".

This change adds a column on_hold_until timestamptz to indicate this.

This is irrespective of the state of a migration. I'm open for debate here - I think this "on hold" status is slightly different from state as the migration is still considered active, but the system state disallows immediate continuation.

That's why I've added a scope executable: A migration is executable if it's active and not on hold.

The idea is to only put migrations "on_hold" for a short period of time (a few minutes, defaults to 10). During this time executing is on hold and we'll re-evaluate system state only at the end of this period. This may result in extending "on hold time" or the migration will be continued. The idea here is that we don't want to evaluate system state with every invocation of the cron and react to this - the concern is a flapping system behavior, which is rather unpredictable to work with. Instead, if we make a "on hold" decision, we won't change this decision until some time (on_hold_until) later.

This is a preparation for #357248 (closed).

Edited by Andreas Brandl

Merge request reports