FAQ: sharpen the restic-interop caveat — restic prune vs any rustic write - #144
Open
l1a wants to merge 1 commit into
Open
FAQ: sharpen the restic-interop caveat — restic prune vs any rustic write#144l1a wants to merge 1 commit into
l1a wants to merge 1 commit into
Conversation
The restic-compatibility answer says the only thing to take care of is "that you don't run prune with restic and rustic at the same time", which reads as prune-versus-prune. The case that actually destroys data is a restic prune against a rustic writer of any kind, and the sentence as written does not cover it. rustic and restic reach safe concurrency by different mechanisms that do not compose: rustic defers deletion by --keep-delete, restic takes an exclusive lock which is what lets its prune delete immediately. rustic neither takes nor honours that lock, so a restic prune can remove packs an in-flight rustic run has written and not yet referenced. Measured on rustic 0.11.3 and restic 0.19.1: with a rustic backup frozen mid-write, restic prune deleted 14 packs and restic check --read-data then reported the repository damaged. The control, the same prune against a repository where a restic client held a lock, refused correctly. Docs only; no behaviour change is proposed. rustic's lock-free design is correct and working, which is exactly why the interop caveat is narrower and sharper than the current sentence suggests. Assisted-By: Claude Opus 5
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.
The current wording says the only thing to take care of is "that you don't run prune with restic and rustic at the same time", which reads as prune-versus-prune. The case that actually destroys data is
restic pruneagainst a rustic writer of any kind, and the sentence as written does not cover it.This is docs-only and proposes no behaviour change. rustic's lock-free design is correct and works — that is precisely why the interop caveat is narrower and sharper than the current sentence suggests.
Measured — rustic 0.11.3, restic 0.19.1, throwaway local repositories
rustic's grace period works exactly as documented. A repository holding three unreferenced packs:
rustic prune(default)to delete: 3 packs, removed nonerustic prune --instant-deleteThe mixed case does not. A
rustic backupwas frozen mid-write withSIGSTOP, thenrestic prunewas run against the same repository:It did not wait — rustic had written no lock for it to see. Letting the rustic backup finish, then:
As a control, the same
restic pruneagainst a repository where a restic client held a lock refused correctly:So the mechanism is confirmed in both directions: restic's immediate deletion is safe only because of the lock, and rustic is invisible to it.
Why I ran into this
I maintain rusticprofile, a small per-machine scheduler for rustic, and was migrating a 7-machine fleet from restic to rustic one host at a time.
Before the first cutover, the designated prune host's
restic prunesaw the other machines' restic locks and waited. After it, the migrated host wrote with rustic and became invisible to that prune. Nothing about the prune host changed — the cutover removed the only thing making the two tools mutually visible, and there was no signal that anything had.I initially concluded rustic was unsafe under concurrent access and disabled the prune schedule entirely. Reading your FAQ properly showed that was wrong: rustic's design is sound, and the real rule is much narrower. That round trip is what makes me think the extra precision earns its place — the mid-migration window is exactly the situation this FAQ entry gets read in.
Happy to trim the table, soften the wording, or split the caveat into its own FAQ entry if you'd prefer a different shape.