fix(raft): repair snapshot compaction#3
Merged
Conversation
0fdecd0 to
5871e0d
Compare
3a9a6bf to
b2fb2de
Compare
56c5b04 to
bb11867
Compare
bb11867 to
941e903
Compare
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.
Pull Request
Summary
What: Repair snapshot compaction metadata, suffix retention, snapshot responses, and post-snapshot AppendEntries boundaries.
Why: Raft snapshot installation is not just "clear the log"; the snapshot carries the configuration at its boundary, and a snapshot that describes a log prefix must preserve the valid suffix.
Lines added: +221
Thesis Cross-Reference
Snapshot metadata includes configuration:
compaction/memsnapshot.tex#L48-L60
Key phrase: "latest configuration at that point".
Context: InstallSnapshot must carry last included index, last included term, and the configuration at that index.
Snapshot prefix retention:
compaction/memsnapshot.tex#L69-L78
Key phrase: "must be retained".
Context: conflicting/new snapshots supersede the log, but snapshots describing a prefix delete only covered entries.
Compaction invalidates contiguous-log assumptions:
compaction/memsnapshot.tex#L244-L260
Key phrase: "might have been discarded".
Context: every log lookup around
prev_log_indexmust handle compacted prefixes.AppendEntries consistency boundary:
basicraft/consensus.tex#L320-L334
Key phrase: "same index and term".
Context: the snapshot boundary term is needed so followers can satisfy AppendEntries matching at
lastIncludedIndex.Test Plan
cargo test -p cloud9-raftTests Added
snapshot_termfor AppendEntries matching.Notes for Reviewers
The important invariant is that compaction turns
snapshot_indexinto the synthetic log entry immediately beforefirst_index. Treating its term as unavailable breaks replication after compaction.