hachikuji commented on a change in pull request #10344: URL: https://github.com/apache/kafka/pull/10344#discussion_r596467002
########## 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: For the sake of having an alternative, what if we replaced the concurrent collection with a TreeSet and a lock? The main contention seems to be around accessing the earliest snapshot id. Perhaps we could use an atomic reference or a volatile for the earliest and latest snapshot ids so that we don't need to go through the lock. ---------------------------------------------------------------- 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