-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database BackupManager #1711
base: nightly
Are you sure you want to change the base?
Database BackupManager #1711
Conversation
crates/sovereign-sdk/full-node/sov-prover-storage-manager/src/snapshot_manager.rs
Outdated
Show resolved
Hide resolved
…rocksdb-backup
Holding merge until devops' feedback |
…rocksdb-backup
This reverts commit 67ad3f6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backup & Restore Observations and Questions
Backup Creation (backup_create
)
- Why do we pass the
id
field? - I tested whether it blocks ongoing synchronization and RPC operations. It does not. ✅
Backup Information (backup_info
)
- Regardless of which
id
we pass, it always returns all backup information. - If
id
is ignored, what is the purpose of passing it?
Backup Validation (backup_validate
)
- If we pass a non-existent path, it fails. Otherwise, it always returns
true
. - The
id
field doesn’t seem to have any effect—tested withid: -73
, and it still returnedtrue
.
Restore (restore
)
- I tested restore several times with
--restore-db "/mnt/task/backup"
, and it worked consistently. ✅ - Question: Can we specify which
id
to restore? It seems to always restore the latest version.
Other Observations (Not necessarily issues, just for awareness)
1. Version Tracking Behavior
- Deleted the latest (6th) backup and then restored. It reverted to the 5th version, which became the latest.
- After restoring, creating a new backup resulted in version 7.
- It seems the system tracks previously created versions even after a restore. Is this expected behavior?
2. Partial Backup Deletion & Restore Behavior
- Deleted the last 3 versions from
native-db
, last 2 versions fromstate
, and the last one fromledger
. - After restore, each database seemed to restore to its latest available backup.
- However, once the restore was completed, an error occurred:
"error": "Timestamp should be greater"
Suggestion:
- We, ops, can validate if all DBs are at the same version before restoring to avoid inconsistency.
- This validation doesn’t necessarily have to be handled inside Citrea’s binary, but we need a way to validate individual versions by passing the
id
parameter tobackup_validate
.
3. Post-Restore Backup Behavior
After restore completion, a new directory citrea-db.bak-{EPOCH}
appears.
Question:
- Does this directory contain a backup of the newly restored version?
- Or is it the previous
citrea-db
backup just before it was replaced bycitrea-db.tmp-{EPOCH}
?
P.S: All tests are tried on Dev-Net Full-Node EU
I think there's a confusion on the API. The three routes expect only a backup path (optional for backup_create if set in config). jsonrpsee typing is a bit loose here and just ignore extra parameters.
I'll amend so that we can pass an optional id to restore to a previous backup. At the root of the backup dir, you can find a mapping between L2 height and backup id.
This is probably due to inconsistency between you manually deleting 6th backup and rocksdb backup engine pulling the id from some remaining parts. Just tested with removing the latest on every subdir and it succesfully used the right id
The thing is, the backup is made out of 3 different rocksdb backup, one state, one native, one ledger.
This is a backup of the previous citrea-db |
Description
BackupManager
to backup all databases required by a citrea node.backup_create <optional_path>
to create a node backup. Defaults to using path from config if None. Errors if both config backup path and path are not set.backup_validate <path>
to validate a node backup atpath
backup_info <path>
to get info about backup atpath
--restore-db <path>
arg to restore a node from a backup atpath
.Linked Issues
Depends on #1714Pending on newly introduce
citrea-cli
in #1808 to extract and moverestore-db
as a cli command