Xushaohong commented on code in PR #745:
URL: https://github.com/apache/ratis/pull/745#discussion_r970251243
##########
ratis-server/src/main/java/org/apache/ratis/server/leader/LogAppenderBase.java:
##########
@@ -158,6 +158,11 @@ private TermIndex getPrevious(long nextIndex) {
}
}
+ final long raftLogLastPurgedIndex = getRaftLog().getStartIndex() - 1;
+ if (raftLogLastPurgedIndex == previousIndex) {
+ return TermIndex.valueOf(server.getInfo().getCurrentTerm(),
raftLogLastPurgedIndex);
Review Comment:
This should be fine for the case that the snapshot is installed in the
current term, but we still need to solve the case ```nextIndex == beginIndex```
which is the root cause of the problem.
The leader doesn't know the term when the follower took its snapshot since
the leader's snapshot info has been overwritten and the current
PB(InstallSnapshotReplyProto) has no such snapshot term clues.
We can do either of the following:
1. add the field term in PB
2. loosen the check for consistency when **containsTermIndex**, only
checks the index for the snapshot case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]