-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Safe DB migrations using RocksDB Checkpoints (#6282)
RocksDB checkpoints hardlink files and therefore are free as long as the files are on the same filesystem. Because we usually a separate disk into ~/.near/data, this PR by default writes checkpoints inside that directory. The PR detects if a checkpoint already exists and if it does refuses a DB migration. Checkpoints are deleted after successful migrations. Test plan: * [x] Enable checkpoints even if no DB migrations are needed and run localnet * [x] Use 1.21 version on localnet. Check that restarting with the current branch creates a checkpoint before applying DB migrations. * [x] Use 1.21 version on localnet. When restarting with the current branch, kill the process before the migration is complete. * [x] Check that the checkpoint still exists * [x] Check that neard panics if tries to restart * [x] Restore from the checkpoint, delete the checkpoint and check that the migration starts over. * [x] Repeat the test above with `use_checkpoints_for_db_migration = false` and see that the DB gets corrupted and can't be recovered.
- Loading branch information
Showing
3 changed files
with
121 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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