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

feat(bin): delete snapshot jars in db clear #6311

Merged
merged 5 commits into from
Feb 2, 2024

Conversation

shekhirin
Copy link
Collaborator

This PR makes reth db clear delete static files for the associated segments:

Subcommands::Snapshot { segment } => {
let snapshot_provider = provider_factory
.snapshot_provider()
.expect("snapshot provider initialized via provider factory");
let snapshots = iter_snapshots(snapshot_provider.directory())?;
if let Some(segment_snapshots) = snapshots.get(&segment) {
for (block_range, _) in segment_snapshots {
snapshot_provider
.delete_jar(segment, find_fixed_range(*block_range.start()))?;
}
}
}
}

We now have two subcommands for reth db clear:

  • reth db clear mdbx <TABLE>
  • reth db clear snapshot <SEGMENT>.

@shekhirin shekhirin marked this pull request as ready for review January 31, 2024 21:13
@shekhirin shekhirin added C-enhancement New feature or request A-cli Related to the reth CLI A-static-files Related to static files labels Jan 31, 2024
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

Base automatically changed from alexey/stage-drop-snapshots to feat/static-files February 2, 2024 12:40
Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

lgtm

@shekhirin shekhirin merged commit 3ac6a7d into feat/static-files Feb 2, 2024
24 checks passed
@shekhirin shekhirin deleted the alexey/db-clear-snapshots branch February 2, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI A-static-files Related to static files C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants