Persist zones#550
Merged
Merged
Conversation
Closed
bal-e
reviewed
Apr 7, 2026
bal-e
left a comment
Contributor
There was a problem hiding this comment.
@ximon18 and I had a discussion while I was writing this review, and decided that I will add commits changing the PR to implement a new approach for the zone data storage state machine. I've left these comments here for us to come back once I'm done; I also didn't review everything, so there will be more to come.
1 task
1 task
Will need changing based on PR #589.
As `finish()` requires the zone to have a SOA record which it does not if is empty.
As this causes a panic currently.
…gning state. As: a) I am unable to get the storage state machine internals into the right state such that the Signing state and the states thereafter work correctly, b) If there was a problem with loading the signed persisted state maybe it is better to start from a known good source zone rather than trust the loaded persisted state to be correct in this unexpected situation, c) It is much simpler to code and to reason about.
Test if the signed paths collection is empty on restoring from signed data, not if the loaded paths collection is empty.
…ted by incremental signing. Also improve and make IXFR in-memory diff manipulation log messages more consistent.
bal-e
approved these changes
May 28, 2026
…e other way around. This will prevent leaving orphaned files behind that are not used and thus potentially confusing. It causes another edge case for which a TODO has been added for now.
Defending against out of state dir paths makes little sense as the attacker already has the ability to do a lot of they can affect the content of the Cascade state files.
On restore error re-signing should be blocked, but only the nothing-to-restore match branch was doing that. Factor out the common code and re-use it so that the error branch also correctly resets state.
…ds the zone contents.
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.
Status
Zone edits (e.g. via file edit and
zone reloador due to changes received via XFR) are persisted both for loaded and signed zones. On application restart persisted zones are restored andcascade zone statusanddig AXFRappear to work as they did prior to application shutdown.The code has been initially reviewed and led to some wanted changes:
zonedatacrate interface to enable moving some of the changes to Cascade itself.save_now()instead ofmark_dirty(). This is because persisting zone data to disk not enough, as if there was a power outage between callingmark_dirty()and publication of the zone the paths to the persisted files (that are recorded in state) would not have been written to disk, thussave_now()should be invoked instead. We may actually want to invokesave_now()in the publication server itself to ensure all published zone related state is persisted, but that is out of scope for this PR.tl;dr
src/persistence/persist.rsto write snapshots and deltas to disk (currently in DNS AXFR/IXFR wire format).src/persistence/restore.rsto restore zones by loading the zone snapshot into a zone replacer and passing the zone diffs one at a time to a zone patcher.src/persistence/to store generated/restored diffs for use by IXFR out.ZoneStatewith two vecs of paths to persisted snapshot and delta files.cascade zone statusoutput.Known issues:
zone-state.Alternative snapshot/delta storage formats
A choice would need to be driven by requirements:
Some ideas:
DiffDatato JSON/CBOR/whatever. Would tie the format to the internal format, changing the internal format would require writing additional code to handle storage format migration or support parsing old as well as new format. A PRO of this approach is being able to storage additional meta data with the snapshot/delta, if needed.Cargo.*,crates/,etc/,integration-tests/,src/):actthrough theact-wrapper(as described inTESTING.md)?