Skip to content
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

Open
wants to merge 21 commits into
base: nightly
Choose a base branch
from
Open

Database BackupManager #1711

wants to merge 21 commits into from

Conversation

jfldde
Copy link
Contributor

@jfldde jfldde commented Jan 15, 2025

Description

  • Introduces new BackupManager to backup all databases required by a citrea node.
  • Introduces two new RPCs:
    • backup_create <path> to create a node backup at path
    • backup_validate <path> to validate a node backup at path
    • backup_info <path> to get info about backup at path
  • Adds new --restore-db <path> arg to restore a node from a backup at path. TBD

Linked Issues

Depends on #1714

@jfldde jfldde requested a review from eyusufatik as a code owner January 15, 2025 13:32
@auto-assign auto-assign bot requested a review from kpp January 15, 2025 13:32
@jfldde jfldde marked this pull request as draft January 15, 2025 13:32
@jfldde jfldde requested a review from Chinacolt January 15, 2025 13:37
@@ -761,6 +766,7 @@ where
missed_da_blocks_count = 0;
}

let _l2_lock = backup_manager.start_l2_processing().await;
Copy link
Member

Choose a reason for hiding this comment

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

does this mean taking backups would lock us here and we won't be able to produce blocks?

Copy link
Member

Choose a reason for hiding this comment

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

from my understanding coupled with WAL rocksdb::backup::BackupEngine doesn't really need you to lock the database.

once concern here maybe would be the state_db and native_db are expected to always be in the same version so we have to guarantee somehow they are backed up at the same point in time -- which is not really possible.

is that the case?

if so, we'll soon be working on fixing this incompatibility problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to err on the safe side and guarantee that all databases are at an initial l2 block state.
The lock is held to access l2 block height and spawn the backup tasks in this safe state and then released. Block production should tick along while backup is on-going

Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 25.15464% with 363 lines in your changes missing coverage. Please review.

Project coverage is 76.3%. Comparing base (1265a26) to head (6f32feb).
Report is 1 commits behind head on nightly.

Files with missing lines Patch % Lines
crates/common/src/backup/manager.rs 20.0% 156 Missing ⚠️
crates/common/src/backup/utils.rs 0.0% 70 Missing ⚠️
crates/common/src/backup/rpc.rs 20.4% 66 Missing ⚠️
bin/citrea/src/rollup/mod.rs 61.1% 26 Missing ⚠️
...overeign-sdk/full-node/db/sov-schema-db/src/lib.rs 0.0% 14 Missing ⚠️
...reign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs 0.0% 6 Missing ⚠️
...es/sovereign-sdk/full-node/db/sov-db/src/mmr_db.rs 0.0% 6 Missing ⚠️
...sov-prover-storage-manager/src/snapshot_manager.rs 0.0% 6 Missing ⚠️
crates/light-client-prover/src/da_block_handler.rs 0.0% 5 Missing ⚠️
crates/light-client-prover/src/runner.rs 0.0% 3 Missing ⚠️
... and 2 more
Additional details and impacted files
Files with missing lines Coverage Δ
bin/citrea/src/rollup/bitcoin.rs 0.0% <ø> (ø)
bin/citrea/src/rollup/mock.rs 77.7% <100.0%> (+0.7%) ⬆️
crates/batch-prover/src/da_block_handler.rs 74.2% <100.0%> (+0.2%) ⬆️
crates/batch-prover/src/runner.rs 86.0% <100.0%> (+0.1%) ⬆️
crates/common/src/config.rs 94.8% <100.0%> (+<0.1%) ⬆️
crates/fullnode/src/runner.rs 82.3% <100.0%> (+0.1%) ⬆️
crates/sequencer/src/runner.rs 88.3% <100.0%> (+<0.1%) ⬆️
...dk/full-node/sov-prover-storage-manager/src/lib.rs 97.4% <100.0%> (+<0.1%) ⬆️
...ule-system/sov-modules-rollup-blueprint/src/lib.rs 100.0% <ø> (ø)
bin/citrea/src/main.rs 0.0% <0.0%> (ø)
... and 11 more

... and 2 files with indirect coverage changes

@jfldde jfldde marked this pull request as ready for review January 20, 2025 10:59
@auto-assign auto-assign bot requested a review from rakanalh January 20, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RocksDB backups through RPC
2 participants