A second failed update rollback restores a stale -wal from an earlier failed rollback

Aperta Adatta ai principianti
#1,234 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
sqlite, typescript
Ambito
backend, databases

Direzione di ricerca

Inizia con backupDatabases e restoreDatabases in src/updater/index.ts, poi leggi il passaggio 5 di src/updater/AGENTS.md sul ciclo di vita della cartella di backup. Controlla la copertura di backup e rollback nei test dell’updater ed esegui i test pertinenti. Il lavoro è completato quando un rollback ripristina solo i file sidecar che esistevano al momento della creazione del backup di quell’aggiornamento, anche dopo un rollback precedente non riuscito.

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

Descrizione

bug:new

An update whose new daemon fails to start can restore a stale SQLite -wal file next to a newer database, when an earlier update's rollback had also failed.

backupDatabases (src/updater/index.ts:159) creates update-backup with mkdirp and copies only the sidecar files that exist now; it never removes ones already in the folder. restoreDatabases (:172) copies back every sidecar it finds there. The folder is deleted after a good start or a good rollback, so it survives only after a rollback that failed (src/updater/AGENTS.md, step 5). A clean daemon stop leaves no -wal, so the old -wal from that earlier attempt stays in the backup, and the second rollback puts it beside the current state.db. SQLite may then replay or reject a WAL that does not belong to that database, so the restored state can be wrong or the database unreadable.

Steps. (1) An update whose start fails and whose rollback also fails, leaving update-backup with a -wal. (2) A clean stop. (3) A second update whose new daemon fails to start, so it rolls back. The live state.db-wal is now the one from step 1.

Expected. A rollback restores exactly the files that existed when that update's backup was taken.

Possible fix. Empty (or remove) update-backup at the start of backupDatabases.

Found in a code review, checked by hand.

Written by an agent.

Lingua principale
TypeScript
Stelle
535
Fork
21
Merge medio
9h 53m
PR unite (30g)
435

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 callstackincubator/simlock

Tutte le issue di callstackincubator/simlock

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.