Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

(Ledger-Tool) Add command --purge-older-slots #26905

Closed
wants to merge 1 commit into from
Closed

(Ledger-Tool) Add command --purge-older-slots #26905

wants to merge 1 commit into from

Conversation

yhchiang-sol
Copy link
Contributor

@yhchiang-sol yhchiang-sol commented Aug 3, 2022

Problem

The current ledger tool does not have a subcommand to purge older slots.
Example use cases of this subcommand include:

  • Deleting slots older than the slot-range of a corrupted sst file in order to quickly restart the validator.
  • Freeing up ledger disk space.

Summary of Changes

This PR adds --purge-older-slots to the ledger tool that allows users to
delete slots that are older than or equal to the specified slot.

This PR depends on #26651 and is related to #26790.

@yhchiang-sol yhchiang-sol marked this pull request as draft August 3, 2022 14:51
@stale
Copy link

stale bot commented Aug 13, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Aug 13, 2022
@yhchiang-sol yhchiang-sol removed the stale [bot only] Added to stale content; results in auto-close after a week. label Aug 27, 2022
@yhchiang-sol yhchiang-sol marked this pull request as ready for review August 29, 2022 16:50
@yhchiang-sol yhchiang-sol requested a review from steviez August 29, 2022 16:50
Comment on lines +2217 to +2221
match blockstore.run_purge(
0, // from_slot
ending_slot,
PurgeType::CompactionFilter,
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The existing purge command can accomplish the same behavior; I believe the following are equivalent:

solana-ledger-tool purge --start_slot 0 --end_slot SLOT ...
solana-ledger-tool purge-older-slots --ending_slot SLOT ...

As such, I don't think this warrants a new subcommand unless there is some subtlety that I'm overlooking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't notice we already have the purge command. Then I will just improve the comment saying if the starting slot is 0, then all files whose slot range is older than the ending_slot will be deleted immediately.

@yhchiang-sol
Copy link
Contributor Author

A similar command already exists in ledger-tool. Closing this PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants