feat: add snapshot cleanup command for automatic snapshot expiration - #10
Merged
Merged
Conversation
This commit adds a new CLI command for managing and cleaning up old snapshots based on configurable retention policies. New features: - `icepick snapshot list <table>`: List all snapshots with age and refs - `icepick snapshot cleanup <table>`: Expire old snapshots based on policy - `--older-than-days N`: Minimum age before a snapshot can expire (default: 7) - `--retain-last N`: Minimum snapshots to always retain (default: 10) - `--dry-run`: Preview what would be removed without executing - Both conditions must be met before a snapshot is expired Implementation details: - Added `snapshot_cleanup` module with planning and execution logic - Extended Catalog trait with `expire_snapshots()` method - Added `RemoveSnapshots` variant to REST API TableUpdate enum - Added `snapshot` CLI subcommand with `list` and `cleanup` operations - Snapshots referenced by branches/tags or marked as current are protected
- Remove unused TableMetadata import - Remove dead code in execute_snapshot_cleanup that built metadata but was never used - Apply rustfmt formatting
- Remove unused `dry_run` field from CleanupOptions (CLI handles it) - Remove unused `parent_snapshot_id` field from SnapshotInfo - Remove unused `removal_count()` and `retention_count()` methods - Extract `format_age()` helper to DRY age formatting logic - Update tests to match simplified API
Document the new snapshot cleanup feature in AGENTS.md and README.md: - CLI commands (snapshot list, snapshot cleanup) in quick start - New public API items (plan_snapshot_cleanup, execute_snapshot_cleanup) - Pattern 8 code example for snapshot cleanup workflow - Performance profile and comparison matrix entries - Full README section with Rust example and CLI usage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds a new CLI command for managing and cleaning up old
snapshots based on configurable retention policies.
New features:
icepick snapshot list <table>: List all snapshots with age and refsicepick snapshot cleanup <table>: Expire old snapshots based on policy--older-than-days N: Minimum age before a snapshot can expire (default: 7)--retain-last N: Minimum snapshots to always retain (default: 10)--dry-run: Preview what would be removed without executingImplementation details:
snapshot_cleanupmodule with planning and execution logicexpire_snapshots()methodRemoveSnapshotsvariant to REST API TableUpdate enumsnapshotCLI subcommand withlistandcleanupoperations