Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

bottomless: don't ever restore if WAL file exists #733

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Horusiath
Copy link
Contributor

In the latest changes we decided not to restore if a non-empty db file was found. Additionally we expand it if a non-empty WAL exists (even if db file was was none or empty).

@Horusiath Horusiath requested review from penberg and psarna October 4, 2023 14:32
self.reset_frames(wal_pages + 1);
Ok(Some(RestoreAction::ReuseGeneration(generation)))
} else {
// db file is empty, but WAL exists. Calling for new snapshot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is incorrect. An empty db with pragma journal_mode=wal in practice always has a change counter >= 1. If we detect 0 here, it means we have an empty/incorrect file, which also means we don't have any metadata necessary to decide what to restore from this WAL file. From consistency point of view, it's best to error out here and require manual intervention to see what's in the WAL file and why it was left here even though we don't have a valid main db file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants