lucasbru commented on code in PR #21508:
URL: https://github.com/apache/kafka/pull/21508#discussion_r2834934664


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorRecordHelpers.java:
##########
@@ -804,13 +804,19 @@ public static CoordinatorRecord 
newShareGroupStatePartitionMetadataRecord(
     }
 
     private static 
List<ConsumerGroupCurrentMemberAssignmentValue.TopicPartitions> 
toTopicPartitions(
-        Map<Uuid, Set<Integer>> topicPartitions
-    ) {
-        List<ConsumerGroupCurrentMemberAssignmentValue.TopicPartitions> topics 
= new ArrayList<>(topicPartitions.size());
-        topicPartitions.forEach((topicId, partitions) ->
+        Map<Uuid, Map<Integer, Integer>> topicPartitionsWithEpochs
+    ) {
+        List<ConsumerGroupCurrentMemberAssignmentValue.TopicPartitions> topics 
= new ArrayList<>(topicPartitionsWithEpochs.size());
+        topicPartitionsWithEpochs.forEach((topicId, partitionEpochMap) -> {
+            List<Integer> partitionList = new 
ArrayList<>(partitionEpochMap.keySet());
+            List<Integer> epochList = partitionList.stream()
+                .map(partitionId -> 
partitionEpochMap.getOrDefault(partitionId, 0))

Review Comment:
   why getOrDefault and not just get



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/consumer/ConsumerGroupMember.java:
##########
@@ -66,6 +69,8 @@ public static class Builder {
         private Map<Uuid, Set<Integer>> assignedPartitions = Map.of();
         private Map<Uuid, Set<Integer>> partitionsPendingRevocation = Map.of();
         private ConsumerGroupMemberMetadataValue.ClassicMemberMetadata 
classicMemberMetadata = null;
+        private Map<Uuid, Map<Integer, Integer>> assignedPartitionsWithEpochs 
= Map.of();

Review Comment:
   I think this makes sense - are there so many places that require 
`assignedPartitions` and `partitionsPendingRevocation` that we cannot convert 
the calling context to use the map instead of the set? Or do we require it 
because of the sharing with the share group?
   
   I wonder if it could be worth implementing a view on the keySet to avoid the 
second collection here, as it's probably one of the larger collections in the 
GC.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to