squah-confluent commented on code in PR #23883:
URL: https://github.com/apache/kafka/pull/23883#discussion_r4348360469


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/GroupSpecBuilder.java:
##########
@@ -261,15 +242,8 @@ public GroupSpec build() {
             ))
         );
 
-        Map<Uuid, Map<Integer, String>> invertedTargetAssignment = 
this.invertedTargetAssignment;
         Optional<Map<Uuid, Set<Integer>>> topicAssignablePartitionsMap = 
this.topicAssignablePartitionsMap;
         if (assignorOffload) {
-            Map<Uuid, Map<Integer, String>> invertedTargetAssignmentCopy = 
Utils.newHashMap(invertedTargetAssignment.size());
-            for (Map.Entry<Uuid, Map<Integer, String>> entry : 
invertedTargetAssignment.entrySet()) {
-                invertedTargetAssignmentCopy.put(entry.getKey(), 
Map.copyOf(entry.getValue()));
-            }
-            invertedTargetAssignment = invertedTargetAssignmentCopy;
-
             if (topicAssignablePartitionsMap.isPresent()) {

Review Comment:
   I see. The way I see it, the contents of the record types (`Assignment`, 
`ResolvedRegularExpression`) and `Member` classes are immutable by convention 
(yes, I'm aware it's convention only!), so we can assume they are safe to 
re-use, without having to reason about the caller. Whereas the same principle 
doesn't hold for a `Map`.
   
   Let's move this discussion to the next PR!



-- 
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