szetszwo commented on code in PR #1091: URL: https://github.com/apache/ratis/pull/1091#discussion_r1619199546
########## ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java: ########## @@ -1853,6 +1853,7 @@ CompletableFuture<Message> applyLogToStateMachine(ReferenceCountedObject<LogEntr void notifyTruncatedLogEntry(LogEntryProto logEntry) { if (logEntry.hasStateMachineLogEntry()) { getTransactionManager().remove(TermIndex.valueOf(logEntry)); + Optional.ofNullable(getState()).ifPresent(s -> s.truncate(logEntry.getIndex())); Review Comment: Oops, it should be outside the if-statement, i.e. ```java +++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java @@ -1851,6 +1851,8 @@ class RaftServerImpl implements RaftServer.Division, * @param logEntry the log entry being truncated */ void notifyTruncatedLogEntry(LogEntryProto logEntry) { + getState().truncate(logEntry.getIndex()); + if (logEntry.hasStateMachineLogEntry()) { getTransactionManager().remove(TermIndex.valueOf(logEntry)); ``` -- 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: issues-unsubscr...@ratis.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org