0.7 migration can deadlock with a live released 0.6 fleet on awa.deferred_jobs

Aperta
#877 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
postgresql, rust
Ambito
backend, databases

Direzione di ricerca

Start with rolling_upgrade_rehearsal_test -- --ignored and reproduce the failing 0.6.3 cell with Postgres log_lock_waits enabled and a lower deadlock_timeout. Trace the migration step that alters awa.deferred_jobs and the 0.6.3 promotion, rescue, or retry path to identify the lock order; compare that path with 0.6.19. Done when the deadlock is reproducible and a fix or operational requirement is supported by the rehearsal.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What was seen

A full local run of rolling_upgrade_rehearsal_test -- --ignored against awa-pg==0.6.3 failed test_binary_first_current_refuses_v040_then_rolls_after_migration. migrations::run hit a Postgres deadlock (40P01): the current migration's ALTER TABLE awa.deferred_jobs was waiting on a 0.6.3 backend, which was waiting on the migration. The cell passed 2 of 2 when rerun alone, so the deadlock is intermittent. The 6-cell run against 0.6.19 passed (#876).

Why it matters

0.6.2 and later are supported rolling-upgrade sources, and the upgrade guide allows migrating while a 0.6 fleet runs. A deadlock aborts the migration transaction. It can be retried, but an operator following the guide gets an error partway through.

To find out

  • Which migration step issues the ALTER TABLE awa.deferred_jobs, and what lock it takes.
  • What the 0.6.3 backend was doing (promotion, rescue or retry into deferred_jobs) and which lock it already held when it waited on the migration. Lock order is a likely cause: the migration locks another table first, then deferred_jobs, while the 0.6 path takes them in the opposite order.
  • Whether 0.6.19 can hit the same cycle, or whether the 0.6 path changed between 0.6.3 and 0.6.19.
  • Fix options:
    • take the migration's locks in the order the runtime uses;
    • add a lock_timeout and retry around that step;
    • document that this migration needs a quiet window for that table.

The failing cell's evidence (Postgres log with the deadlock detail) was not kept. Reproduce with the rehearsal against 0.6.3, log_lock_waits = on and deadlock_timeout lowered.

Lingua principale
Rust
Stelle
37
Fork
8
Merge medio
14h 16m
PR unite (30g)
244

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hardbyte/awa

Tutte le issue di hardbyte/awa

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.