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:
2026-06-28 06:20:09 +02:00
parent c06d53ad45
commit c17426b556
4 changed files with 54 additions and 107 deletions

View File

@@ -199,13 +199,16 @@ latest globally).
* `--force`: Skip confirmation prompt
**`snapshot remove`**: Remove a snapshot. By default this removes the
snapshot from the local index, strips the snapshot's metadata from the
backup destination store, and prunes any blobs that are no longer
referenced by any remaining remote manifest. Local row cleanup (files,
chunks, blobs the snapshot was the last referrer for) runs automatically;
no separate prune step is needed. If the destination store is unreachable,
the local-DB removal still completes and a warning is emitted; rerun
`vaultik prune` once the store is reachable to finish remote cleanup.
snapshot from the local index and strips the snapshot's metadata from
the backup destination store. Blobs are NOT touched — deleting blobs
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. Local row cleanup (files,
chunks, blobs the snapshot was the last referrer for) runs
automatically. If the destination store is unreachable, the local-DB
removal still completes and a warning is emitted; rerun `vaultik prune`
once the store is reachable to finish remote cleanup.
* `--local-only`: Skip remote cleanup; only touch the local index
* `--all`: Remove all snapshots (requires `--force`)
* `--dry-run`: Show what would be deleted without deleting