You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 18, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 18, 2023. It is now read-only.
bottomless: validate snapshots before queuing them to be sent #717
Snapshots sent to bottomless are just regular db files. Let's make sure that before they get sent to S3, we know that they are correct. The best way to do that that comes to my mind is to create a local connection to the database and run pragma integrity_check;.
My idea was to: currently the snapshot upload comes in two parts:
Gzip db file into local disk.
Upload gzipped db file as /db.gz.
Upload change counter (which keeps [u8;4] used to compare local and remote db versions) as /.changecounter.
My idea was to change snapshotting process to:
Gzip db file - to be sure that we have enough disk space to do so.
While gzipping, compute a checksum (any one will do).
Upload gzipped db file as /db.gz.
Upload change counter AND checksum as /.changecounter. This is basically our finaliser.
Now during restore, first thing we do is always downloading remote .changecounter first and comparing it against local. With this change we can also download checksum. When we download db file, compute its checksum and verify it again against the one from .changecounter file.
Now if the checksum will fail, let's try to see if we have a .dep file which describes previous generation. If there is any let's try to recover from it instead and then potentially try to apply the WAL from current generation, skipping the damaged snapshot.
Activity
psarna commentedon Oct 2, 2023
ah and since we probably compress the snapshots, we should also check if our compression libraries support additional validation/checksumming.
Horusiath commentedon Oct 2, 2023
My idea was to: currently the snapshot upload comes in two parts:
/db.gz.[u8;4]used to compare local and remote db versions) as/.changecounter.My idea was to change snapshotting process to:
/db.gz./.changecounter. This is basically our finaliser.Now during restore, first thing we do is always downloading remote
.changecounterfirst and comparing it against local. With this change we can also download checksum. When we download db file, compute its checksum and verify it again against the one from.changecounterfile.Now if the checksum will fail, let's try to see if we have a
.depfile which describes previous generation. If there is any let's try to recover from it instead and then potentially try to apply the WAL from current generation, skipping the damaged snapshot.