Repository navigation
Conversation
openraft writes a cluster's first membership entry at index 0, but the
fold of per-entry log files into a segment anchored a log with no purge
marker at index 1. On a v4.2.0 node that had never purged its log the
contiguous run came out empty, so no segment was written, every entry
file was then deleted, and the node failed to start ("Failed to get log
entries, expected index: [10, 12)"). Entries past the last snapshot were
lost. Anchor a never-purged log at 0.
raft-clusters.md placed the segment layout in "v4.3"; it shipped in
4.2.1.
This branch has not been deployed
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.
When a node first opens a Raft log written in the one-file-per-entry layout (v4.2.0), it folds the entries into a segment. The fold keeps the contiguous run above the purge cutoff, and with no purge marker it started that run at index 1. openraft writes a cluster's first membership entry at index 0. So on a v4.2.0 node that had never purged its log, the run came out empty: no segment was written, every entry file was then deleted, and the node failed to start:
Committed entries past the last snapshot are gone from that node. Without a snapshot, that is the whole replicated log. Every release since segments shipped in 4.2.1 does this. A v4.2.0 node that has purged its log is not affected: its run starts above the purge marker.
The fix starts a never-purged log's run at 0. The existing unit test wrote legacy entries from index 1, which openraft never does.
a_never_purged_legacy_log_folds_from_index_0uses the real layout.raft-clusters.mdplaced the segment layout in "v4.3". It shipped in 4.2.1. The page now also tells operators to upgrade a node still on v4.2.0 directly to a release with this fix.The bug was found by the golden v4 Raft fixtures in #2485 (#1689), where a real v4.2.0 node's directory failed to reopen.
Already on
nextnexthas this fix through #2485 (commit 967658d). Thefs.rschange, its test and the doc paragraph are identical on both branches, so amain→nextmerge should resolve them without a conflict. If either PR changes in review, keepnext's version when merging. Check that the merge leaves oneanchorline and one copy ofa_never_purged_legacy_log_folds_from_index_0.