snapshot rm: remove metadata only, print prune command for blobs
The previous change had snapshot rm auto-prune unreferenced blobs. The correct division of labor is: rm removes a snapshot (local DB + remote metadata), prune cleans up blobs. Reverting the auto-prune means rm stays a cheap, deterministic operation: it touches one snapshot's worth of state and emits the exact 'vaultik prune' command the user should run next to delete blobs no longer referenced by any remote manifest. This is correct because prune must consult every remote manifest (including snapshots this host doesn't know about) to determine which blobs are still referenced, and folding that work into rm would silently turn rm into an expensive O(remote snapshots) operation that also assumes the remote is fully reachable.
This commit is contained in:
@@ -324,12 +324,15 @@ func newSnapshotRemoveCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "remove [snapshot-id]",
|
||||
Aliases: []string{"rm"},
|
||||
Short: "Remove a snapshot from local index and remote storage",
|
||||
Short: "Remove a snapshot from local index and remote metadata",
|
||||
Long: `Removes a snapshot.
|
||||
|
||||
By default, this removes the snapshot from the local index database, strips
|
||||
the snapshot's metadata from the backup destination store, and prunes any
|
||||
blobs that are no longer referenced by any remaining remote snapshot.
|
||||
By default, this removes the snapshot from the local index database and
|
||||
strips the snapshot's metadata from the backup destination store. Blobs
|
||||
are NOT touched: deleting them requires reading every remaining remote
|
||||
manifest (the destination store may hold snapshots this host doesn't
|
||||
know about), which is what 'vaultik prune' does. On success the command
|
||||
prints the exact 'vaultik prune' invocation to run as a follow-up.
|
||||
|
||||
Use --local-only to skip the remote half (e.g. when you want to forget a
|
||||
snapshot locally without touching the destination store).
|
||||
|
||||
Reference in New Issue
Block a user