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

State DB pruning #1808

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

State DB pruning #1808

wants to merge 26 commits into from

Conversation

rakanalh
Copy link
Contributor

@rakanalh rakanalh commented Feb 4, 2025

Description

  • Add state DB pruning
  • Introduce citrea-cli
  • Add skeleton for rollback

Linked Issues

@rakanalh rakanalh requested a review from eyusufatik as a code owner February 4, 2025 15:15
@auto-assign auto-assign bot requested a review from ercecan February 4, 2025 15:15
@rakanalh rakanalh requested a review from jfldde February 4, 2025 15:20
@jfldde
Copy link
Contributor

jfldde commented Feb 4, 2025

Is that supposed to be running against a stopped node ? Wonder what the behaviour would be of rolling back from the cli against a running node. (Pruning feels safe but we might need to be cautious still).
If not, we might want to find a way to prevent running these commands against in-use dbs

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 68.19923% with 83 lines in your changes missing coverage. Please review.

Project coverage is 77.4%. Comparing base (36f0e6c) to head (443f9ff).

Files with missing lines Patch % Lines
bin/cli/src/main.rs 0.0% 25 Missing ⚠️
bin/cli/src/commands/prune.rs 0.0% 18 Missing ⚠️
...tes/storage-ops/src/pruning/components/state_db.rs 83.1% 14 Missing ⚠️
crates/storage-ops/src/rollback/service.rs 0.0% 13 Missing ⚠️
crates/storage-ops/src/rollback/mod.rs 0.0% 5 Missing ⚠️
bin/cli/src/commands/rollback.rs 0.0% 3 Missing ⚠️
crates/storage-ops/src/pruning/mod.rs 94.6% 3 Missing ⚠️
bin/citrea/src/main.rs 0.0% 1 Missing ⚠️
crates/storage-ops/src/pruning/service.rs 96.2% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
bin/citrea/src/rollup/mod.rs 79.9% <ø> (ø)
crates/common/src/config.rs 94.8% <ø> (ø)
crates/fullnode/src/lib.rs 100.0% <100.0%> (ø)
...reign-sdk/full-node/db/sov-db/src/schema/tables.rs 91.5% <ø> (ø)
.../sovereign-sdk/full-node/db/sov-db/src/state_db.rs 94.1% <100.0%> (+0.3%) ⬆️
...-sdk/module-system/sov-state/src/prover_storage.rs 94.6% <100.0%> (+0.1%) ⬆️
...es/storage-ops/src/pruning/components/ledger_db.rs 100.0% <ø> (ø)
...es/storage-ops/src/pruning/components/native_db.rs 86.3% <100.0%> (ø)
crates/storage-ops/src/pruning/criteria.rs 100.0% <100.0%> (ø)
crates/storage-ops/src/tests.rs 100.0% <100.0%> (ø)
... and 9 more

... and 4 files with indirect coverage changes

@eyusufatik
Copy link
Member

Is that supposed to be running against a stopped node ? Wonder what the behaviour would be of rolling back from the cli against a running node. (Pruning feels safe but we might need to be cautious still). If not, we might want to find a way to prevent running these commands against in-use dbs

this is supposed to run against a stopped node.

@eyusufatik
Copy link
Member

does this close #1609

@rakanalh
Copy link
Contributor Author

rakanalh commented Feb 4, 2025

does this close #1609

No, to prevent the PR from getting larger and harder to review... i am only placing the skeleton for rollback here and will implement in a follow up PR

@rakanalh
Copy link
Contributor Author

rakanalh commented Feb 4, 2025

Is that supposed to be running against a stopped node ? Wonder what the behaviour would be of rolling back from the cli against a running node. (Pruning feels safe but we might need to be cautious still). If not, we might want to find a way to prevent running these commands against in-use dbs

The design or Pruner vs PrunerService and Rollback vs RollbackService will enable us to spawn the service in the future when we use rollback to actually perform rolling back on a running node in case of forks. For now, this is not going to be used.

You cannot use the subcommand on an in-use DB because rocksdb locks the directory of any other process is using the database.

@jfldde jfldde mentioned this pull request Feb 6, 2025
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.

Pruning: State DB
3 participants