jsancio commented on a change in pull request #11345:
URL: https://github.com/apache/kafka/pull/11345#discussion_r765978037



##########
File path: raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java
##########
@@ -443,7 +443,7 @@ private void onBecomeLeader(long currentTimeMs) {
     private void flushLeaderLog(LeaderState<T> state, long currentTimeMs) {
         // We update the end offset before flushing so that parked fetches can 
return sooner.
         updateLeaderEndOffsetAndTimestamp(state, currentTimeMs);
-        log.flush();
+        log.flush(false);

Review comment:
       Yes. Looking at the code, we don't need to have segments to determine 
the log end offset. When loading the `KafkaMetadataLog`, KRaft 
`truncateFullyAndStartAt` using the latest snapshot if the log's end offset 
(`0`) is less than the latest snapshot's end offset. As @hachikuji mentioned, 
we only delete inactive segments if there is a snapshot that covers the largest 
offset in the segment.




-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to