dongnuo123 commented on code in PR #19497: URL: https://github.com/apache/kafka/pull/19497#discussion_r2067418921
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/OffsetMetadataManager.java: ########## @@ -192,10 +193,165 @@ public OffsetMetadataManager build() { */ private final TimelineHashMap<Long, Offsets> pendingTransactionalOffsets; + private final OpenTransactions openTransactions; + /** - * The open transactions (producer ids) keyed by group. + * Tracks open transactions (producer ids) by group id, topic name and partition id. + * It is the responsiblity of the caller to update {@link #pendingTransactionalOffsets}. */ - private final TimelineHashMap<String, TimelineHashSet<Long>> openTransactionsByGroup; + private class OpenTransactions { + /** + * The open transactions (producer ids) keyed by group id, topic name and partition id. + * Tracks whether partitions have any pending transactional offsets that have not been deleted. + * + * Values in each level of the map will never be empty collections. + */ + private final TimelineHashMap<String, TimelineHashMap<String, TimelineHashMap<Integer, TimelineHashSet<Long>>>> openTransactionsByGroup; Review Comment: The current 3-layer map has already improved the performance significantly. If we are still not happy with the perf maybe we can consider flattening the map to (group id, topic, partition) -- producer id set -- 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