-
Notifications
You must be signed in to change notification settings - Fork 346
Description
Bug Description
Hey all, I'm currently working on integrating Litestream into one of our production workloads but I keep running into seemingly random database corruption issues.
I set up Litestream following this guide. My service is deployed as a statefulset; an init container restores the most recent replica from S3/GCS/ABS on startup then a sidecar container continuously replicates new changes to blob storage.
However, every now and again I'll start seeing database disk image is malformed errors in my application. Running an integrity check always returns warnings along the lines of
sqlite> pragma integrity_check;
pragma integrity_check;
integrity_check
---------------------------------------------------------------------
wrong # of entries in index my_table_uid_idx
wrong # of entries in index sqlite_autoindex_my_table_1
There don't appear to be any error logs coming from litestream, neither during the replication nor the restoration. There also haven't been any pod crashes or unclean shutdowns that could explain the corruptions.
I understand that this ticket is a bit thin on information, I'll try to enable trace logging and update the issue with more information if the issue occurs again. Unfortunately I haven't been able to manually trigger the corruption, so it might be a while until I have any more details. I thought I'd raise the issue anyways in case anyone has seen this before and there's a known fix.
Environment
Litestream version:
0.5.8
Operating system & version:
litestream/litestream:0.5.8 Docker image
Installation method:
Kubernetes init container to restore / sidecar container to replicate, following this setup
Storage backend:
S3, GCS, ABS
Steps to Reproduce
I haven't been able to reproduce this, it seems to happen randomly.
Configuration
litestream.yml
addr: ":9090"
dbs:
- path: /mnt/db/database.db
replica:
url: s3://my-bucket/my-service/database.dbLogs
No logs outside of the usual compaction complete and l0 retention enforced. Will enable trace logs and try to capture more information the next time this occurs.
Additional Context
Running sqlite version 3.51.1 2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af3alt1 (64-bit). The main application is a Go app using the mattn/go-sqlite3 driver. The database is stored in an emptyDir mount i.e. there is no persistent state across pods.