showuon commented on code in PR #13456: URL: https://github.com/apache/kafka/pull/13456#discussion_r1158148779
########## storage/src/main/java/org/apache/kafka/storage/internals/epoch/LeaderEpochFileCache.java: ########## @@ -147,6 +152,16 @@ private List<EpochEntry> removeWhileMatching(Iterator<Map.Entry<Integer, EpochEn return removedEpochs; } + public LeaderEpochFileCache cloneWithLeaderEpochCheckpoint(LeaderEpochCheckpoint leaderEpochCheckpoint) { + lock.readLock().lock(); + try { + flushTo(leaderEpochCheckpoint, epochEntries()); Review Comment: Yes, since we'll write with a copy of the entries, it'll be safe to use the `epochs.values()` directly now. -- 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