Repository navigation
fix(backup): upgrade restored snapshots and keep the working db on failure - #193
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restoring a snapshot swapped in its handle directly. Snapshots taken before a migration (
-pre-workspace-migration,-pre-tag-migration, documented as restorable) kept their old schema until the next restart, because_initSchema()only runs at startup. The old connection was never closed, and an unreadable file was adopted before anything checked it (sql.js only fails on the first query).restoreBackupnow queries the snapshot before adopting it, closes the previous connection after the switch, and runs_initSchema()on the restored database. The behaviour is documented indocs/reference/settings.md. The three tests insrc/__tests__/restoreBackup.test.jswere red before the change.