Litestream stops replicating after switching to a new or emptied backup bucket
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
- 56/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- sqlite, typescript
- Ambito
- devops, infrastructure
Direzione di ricerca
Start in scripts/run-cloud-boot.js and trace when start_replication() runs; then read the README section on Automated backups and check how the deployment supplies BUCKET_NAME. Reproduce or inspect the empty-bucket case with Litestream 0.5.17, and compare the proposed reset and bucket-marker approaches. Done when replication recovers after a bucket change or emptying, or the documented reset procedure clearly covers both cloud and VPS deployments.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
When a site with automated backups starts using a new or empty bucket, Litestream never writes the database to it. That covers a changed BUCKET_NAME, a new Tigris bucket after moving the app to another Fly org, or a bucket whose db/ folder was cleared.
Litestream's local state in /data/.db.sqlite3-litestream still matches the old replica. Seeing the empty bucket, it tries to upload from the first transaction. Those LTX files were cleaned up locally long ago, so every sync fails:
level=ERROR msg="monitor error" ... error="open ltx file /data/.db.sqlite3-litestream/ltx/0/0000000000000001-0000000000000001.ltx: no such file or directory" hint="LTX file is missing. ... Run 'litestream reset <db>' or delete the .sqlite-litestream directory and restart."
It doesn't recover on its own. The site stays up, and the rest of the backup layer keeps working: the boot sweep uploads all assets, and the daily snapshot lands in snapshots/. So the bucket looks healthy while db/ stays empty, and point-in-time recovery is off without anyone noticing unless they read the logs.
Seen on veitsdorf (Litestream 0.5.17) after moving the app to another Fly org and creating a new Tigris bucket.
Workaround
Reset Litestream's local state, which doesn't touch the database, then restart:
fly ssh console -a <app> -C "litestream reset -config /app/scripts/litestream.yml /data/db.sqlite3"
fly machine restart <machine-id> -a <app>
After the restart, Litestream uploads a fresh snapshot and the errors stop. litestream ltx -config /app/scripts/litestream.yml /data/db.sqlite3 lists it.
Running the reset while replication is running logs cannot verify wal state errors until the restart. That's harmless, but it shows the reset belongs before replication starts.
Possible fixes
- In
scripts/run-cloud-boot.js, beforestart_replication(): if the local metadata directory exists but the replica has no LTX files, runlitestream reset. This costs one list request per boot and also covers a bucket emptied in place. - Or record which bucket the local state belongs to, for example
BUCKET_NAMEand the endpoint in a marker file, and reset when it changes. That needs no network call, but it misses a bucket emptied in place. - At minimum, document how to change the bucket in README → Automated backups, including the reset step. VPS deployments that change
BUCKET_NAMEthroughpnpm vps:env sethit the same problem. - Check whether a newer Litestream release recovers from this on its own. If it does, upgrading would make the rest unnecessary.
- Lingua principale
- TypeScript
- Stelle
- 1.8k
- Fork
- 148
- Merge medio
- 2h 47m
- PR unite (30g)
- 13
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di michael/editable
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
michael/editable#181 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di michael/editable
Issue simili
-
bug data-types
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
ClickHouse/clickhouse-js#1293 ·
I maintainer di solito rispondono entro 1 giorno
-
area: middleware enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
agent/quality testing
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
juspay/agent-distro#203 ·
I maintainer di solito rispondono entro 1 giorno