dajac commented on code in PR #19497: URL: https://github.com/apache/kafka/pull/19497#discussion_r2081526702
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/OffsetMetadataManager.java: ########## @@ -802,11 +946,18 @@ public OffsetFetchResponseData.OffsetFetchResponseGroup fetchAllOffsets( final List<OffsetFetchResponseData.OffsetFetchResponseTopics> topicResponses = new ArrayList<>(); final TimelineHashMap<String, TimelineHashMap<Integer, OffsetAndMetadata>> groupOffsets = offsets.offsetsByGroup.get(request.groupId(), lastCommittedOffset); + // We inline the lookups from hasPendingTransactionalOffsets here, to avoid repeating string + // comparisons of group ids and topic names for every partition. They're only used when the + // client has requested stable offsets. + final TimelineHashMap<String, TimelineHashMap<Integer, TimelineHashSet<Long>>> openTransactionsByTopic = + requireStable ? openTransactions.openTransactionsByGroup.get(request.groupId()) : null; Review Comment: ditto. ########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/OffsetMetadataManager.java: ########## @@ -736,6 +871,11 @@ public OffsetFetchResponseData.OffsetFetchResponseGroup fetchOffsets( final List<OffsetFetchResponseData.OffsetFetchResponseTopics> topicResponses = new ArrayList<>(request.topics().size()); final TimelineHashMap<String, TimelineHashMap<Integer, OffsetAndMetadata>> groupOffsets = failAllPartitions ? null : offsets.offsetsByGroup.get(request.groupId(), lastCommittedOffset); + // We inline the lookups from hasPendingTransactionalOffsets here, to avoid repeating string + // comparisons of group ids and topic names for every partition. They're only used when the + // client has requested stable offsets. + final TimelineHashMap<String, TimelineHashMap<Integer, TimelineHashSet<Long>>> openTransactionsByTopic = + requireStable ? openTransactions.openTransactionsByGroup.get(request.groupId()) : null; Review Comment: It feels a bit weird that we don't take `lastCommittedOffset` into consideration here. It works because `lastCommittedOffset` is `MAX_VALUE` when `requireStable` is `true` but it still feel weird. Have you considered using `lastCommittedOffset` in order to be consistent with `groupOffsets`? -- 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