smjn commented on code in PR #18677: URL: https://github.com/apache/kafka/pull/18677#discussion_r1926963735
########## core/src/main/java/kafka/server/share/SharePartition.java: ########## @@ -287,6 +288,12 @@ public static RecordState forId(byte id) { */ private long endOffset; + /** + * This maintains the set of gaps in the cachedState after initialization. Some of these gaps might correspond to batches + * which were fetched but not acknowledged yet. The gaps are used in determining the next fetch offset. + */ + private final TreeSet<Long> gapsAfterInitialization; Review Comment: Is TreeSet necessary (`lg(n)` time data structure). You are assured that the readState reponse will always be sorted on the intervals - the order is firstOffset, lastOffset, deliveryCount, deliveryState -- 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