Xushaohong commented on code in PR #745:
URL: https://github.com/apache/ratis/pull/745#discussion_r970284076


##########
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:
   > > ...  the case nextIndex == beginIndex which is the root cause of the 
problem.
   > 
   > Why this is the root cause? 
   
   Sorry for the confusing words,  this is the case for what we met.  You can 
take a look at the scenario above.
   
   > Note that beginIndex has nothing to do with log purging
   
   yep, the beginIndex is just for distinguishing whether the **previous** 
entry happened in the current term or before. 



-- 
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]

Reply via email to