jsancio commented on a change in pull request #10344: URL: https://github.com/apache/kafka/pull/10344#discussion_r596455495
########## File path: core/src/main/scala/kafka/raft/KafkaMetadataLog.scala ########## @@ -37,8 +37,9 @@ final class KafkaMetadataLog private ( log: Log, scheduler: Scheduler, // This object needs to be thread-safe because it is used by the snapshotting thread to notify the - // polling thread when snapshots are created. - snapshotIds: ConcurrentSkipListSet[OffsetAndEpoch], + // polling thread when snapshots are created. Using a Map instead of a Set so that there is no + // need to handle NoSuchElementException. + snapshotIds: ConcurrentSkipListMap[OffsetAndEpoch, Unit], Review comment: `ConcurrentSkipListMap` has `lastEntry` and `firstEntry` that return `null` if the map is empty. `ConcurrentSkipListSet` only has `last` and `first` which throws if the set is empty. :dizzy: This show up as a performance issue in the simulation test which use `MockLog`. https://github.com/apache/kafka/pull/10323 fixes the issue in `MockLog`. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org