RATIS-2487. Trigger installSnapshot if leader cannot get previous entry#1420
Open
ivandika3 wants to merge 8 commits intoapache:masterfrom
Open
RATIS-2487. Trigger installSnapshot if leader cannot get previous entry#1420ivandika3 wants to merge 8 commits intoapache:masterfrom
ivandika3 wants to merge 8 commits intoapache:masterfrom
Conversation
…extIndex == startIndex
ivandika3
commented
Apr 2, 2026
| @@ -238,6 +217,15 @@ public AppendEntriesRequestProto newAppendEntriesRequest(long callId, boolean he | |||
| final long snapshotIndex = follower.getSnapshotIndex(); | |||
| final long leaderNext = getRaftLog().getNextIndex(); | |||
| final long followerNext = follower.getNextIndex(); | |||
Contributor
Author
There was a problem hiding this comment.
Seems getNextIndex is called twice in this method, we might need to call it only once per method.
szetszwo
reviewed
Apr 2, 2026
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
@ivandika3 , thanks for working on this!
The change looks good. The current shouldInstallSnapshot code is distributed in three difference places, LogAppender, LogAppenderBase and GrpcLogAppender. How about we refactor the code and move them together? See https://issues.apache.org/jira/secure/attachment/13081541/1420_review.patch
Contributor
Author
|
@szetszwo Thanks for the review and the suggestion. Updated. |
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.
What changes were proposed in this pull request?
See https://issues.apache.org/jira/browse/RATIS-2487
The current approach is to make
newAppendEntriesRequestreturns null which will skip the current iteration and change theshouldInstallSnapshot(if installSnapshot is enabled) andshouldNotifyToInstallSnapshot(if installSnapshot is disabled) so that subsequent LogAppender run will trigger snapshot since the leader cannot get the previous log (otherwise the logAppender is not going to send any RPC to the follower).What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-2487
How was this patch tested?
UT.