mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 14:16:12 +00:00
fix(migrations): retry a marked migration that lost a deadlock
A marked migration's DO block holds the locks it takes until it commits, so an app transaction taking two of its tables in the other order can deadlock with it. The block then rolled back whole, exactly as on a lock timeout, so the boot retries 40P01 for marked migrations as it does 55P03. Corrects 0415's note that the drops hold their lock for an instant.
This commit is contained in:
1 parent
2b81b4f23e
commit
408ae35b7c
4 files changed
+108
-22
No files matched your search
@@ -68,6 +68,11 @@ Database error code: 55P03
|
||||
HealthLog: migration 0412_measurement_hot_updates timed out waiting for a lock (55P03) and changed nothing; marking it rolled back and retrying in 15s (retry 1 of 5).
|
||||
```
|
||||
|
||||
A marked migration that loses a deadlock against an app transaction
|
||||
(`Database error code: 40P01`) is in the same state, its block rolled back
|
||||
whole, and is handled the same way; the entrypoint's line then says
|
||||
`was cancelled in a deadlock (40P01)`.
|
||||
|
||||
What happens on its own: such a migration is written so that a timed-out
|
||||
attempt changes nothing, and it says so in its file
|
||||
(`-- @retry-on-lock-timeout`). The entrypoint then marks that one migration
|
||||
|
||||
Reference in new issue
Block a user