Skip to content

feat(cli): Add --dry-run flag to prune command for safer operations #132

@kariy

Description

@kariy

Description:
Currently, the katana db prune command immediately executes database pruning operations which permanently delete historical trie data. This poses a risk for users who might accidentally run the wrong command or want to preview the impact before execution.

Feature Request:
Add a --dry-run flag that:

  • Simulates the pruning operation without actually deleting data
  • Reports what would be deleted (number of entries, affected tables, estimated space to be reclaimed)
  • Shows which blocks would be pruned
  • Validates the operation parameters

Example Usage:

# Preview what would be deleted
katana db prune --latest --dry-run -p path/to/db

# Preview keeping last 1000 blocks
katana db prune --keep-last 1000 --dry-run -p path/to/db

Implementation Notes:

  • Modify bin/katana/src/cli/db/prune.rs to add the dry-run flag
  • Count entries that would be deleted without performing actual deletions
  • Display summary statistics after the dry run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions