Skip to content

Wait briefly for the restore target instead of failing the deployment - #168

Merged
ajccarlson merged 1 commit into
developfrom
restore-target-bounded-wait
Jul 31, 2026
Merged

Wait briefly for the restore target instead of failing the deployment#168
ajccarlson merged 1 commit into
developfrom
restore-target-bounded-wait

Conversation

@ajccarlson

Copy link
Copy Markdown
Owner

A deployment takes two backups minutes apart and both verify into the same disposable database. The exclusivity check refused outright whenever another session or prepared transaction was present — no wait, no retry — so a session that had not finished closing failed the post-cutover backup and took the whole deployment with it.

That happened three times on 2026-07-30. Each left the maintenance window open at failed-after-database-mutation with the site returning 502 until the deployment was re-run, and each re-run succeeded because the competing session had gone.

Now waits for the target to become exclusive — bounded and abortable — before asserting. The assertion is unchanged: a target that never frees is still reported busy and the destructive restore still refuses to run. Only the transient case changes.

Mutation-verified against removing the wait, making it unbounded, and ignoring prepared transactions.

I first recorded this in ROADMAP as the hourly backup cron firing mid-cutover. The timings disprove that — cron backups ran at 15:00, 16:00 and 17:00 while the failing deployments started at 15:32 and 16:17 — so the entry is corrected to what the evidence actually shows.

A deployment takes two backups minutes apart, and both verify into the same
disposable database. The exclusivity check refused outright whenever another
session or prepared transaction was present, with no wait and no retry, so a
session that had not finished closing failed the post-cutover backup and took the
whole deployment with it.

That happened three times on 2026-07-30. Each occurrence left the maintenance
window open at failed-after-database-mutation with the site returning 502 until
the deployment was re-run, and each re-run succeeded because the competing
session had gone by then.

Wait for the target to become exclusive, bounded and abortable, before asserting.
The assertion itself is unchanged: a target that never frees is still reported
busy and the destructive restore still refuses to run. Only the transient case
changes.

The competing session is often not identifiable afterwards, which is why this
does not try to name it. An earlier note in ROADMAP blamed the hourly backup
cron; the timings disprove that and the entry has been corrected.
@ajccarlson
ajccarlson merged commit f19c21d into develop Jul 31, 2026
7 checks passed
@ajccarlson
ajccarlson deleted the restore-target-bounded-wait branch July 31, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant