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.
bottomless: checkpoint before initializing bottomless (#726)
* bottomless: checkpoint before initializing bottomless
Due to a bug in wallog recovery, we need to checkpoint
the database *strictly before* we initialize bottomless.
A proper fix should be to use our virtual WAL methods
for checkpointing, but there's an initialization cycle
and resolving it will be a larger patch - a connection
with WAL methods wants us to already have the replication
logger created, and replication logger wants to perform
a checkpoint on creation.
As a mid-term solution, we just perform the forbidden
regular checkpoint before bottomless is ever launched.
Combined with the fact that bottomless treats existing
databases as the source of truth, it just creates
a new backup generation and continues working properly.
The following scenario was buggy before:
1. We leave the db in the state where some WAL frames
still exist in data-wal file
2. We restart sqld
3. bottomless is initialized, it reuses the existing db
and WAL frames and uploads them to S3, to avoid
creating a potentially costly snapshot
4. ReplicationLogger::new() incorrectly calls
sqlite3_wal_checkpoint which swipes data from under
bottomless.
5. Bottomless thinks it hasn't checkpointed and continues
to write WAL frames. As a result, it writes garbage
to S3, because the db was checkpointed outside
of bottomless control
* fmt fix
0 commit comments