Reserve logs before truncation boundary - #931
Merged
Merged
Conversation
xiaoxichen
reviewed
Sep 30, 2026
xiaoxichen
reviewed
Sep 30, 2026
xiaoxichen
left a comment
Collaborator
There was a problem hiding this comment.
lgtm in general except some nit
This change fixes a false-negative snapshot case where the leader can truncate up to a lagging peer's replication index, making the local log start at replication_idx + 1. NuRaft still treats append from that start index as log-range-valid, but it needs prevLogTerm for replication_idx and term_for_log() fails because that entry has already been truncated. Keep a configurable number of logs before the minimum peer replication index so the leader can either append with a valid prevLogIdx term or correctly fall back to snapshot when the peer is farther behind.
xiaoxichen
approved these changes
Sep 30, 2026
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## stable/v7.x #931 +/- ##
==============================================
Coverage ? 48.27%
==============================================
Files ? 110
Lines ? 13122
Branches ? 6330
==============================================
Hits ? 6335
Misses ? 2557
Partials ? 4230 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
This change fixes a false-negative snapshot case where the leader can truncate up to a lagging peer's replication index, making the local log start at replication_idx + 1. NuRaft still treats append from that start index as log-range-valid, but it needs prevLogTerm for replication_idx and term_for_log() fails because that entry has already been truncated.
Keep a configurable number of logs before the minimum peer replication index so the leader can either append with a valid prevLogIdx term or correctly fall back to snapshot when the peer is farther behind.