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


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/assignor/AssignmentConfigsImpl.java:
##########
@@ -78,6 +86,20 @@ private static List<String> 
parseRackAwareAssignmentTags(String rackAwareAssignm
         return rackAwareAssignmentTags.isEmpty() ? List.of() : 
List.of(rackAwareAssignmentTags.split(","));
     }
 
+    /**
+     * Converts the typed configs into the raw configs recorded for the group; 
the inverse of {@link #fromRecord(List)}.
+     */
+    public static Map<String, String> toMap(AssignmentConfigs 
assignmentConfigs) {
+        // A config recorded from the start is always written; a config added 
later is only written when it is not at
+        // its default, matching what older versions write.

Review Comment:
   It's not clear to me what "from the start" means.
   ```suggestion
           // Configs recorded in all broker versions that write 
LastAssignmentConfigs in streams group metadata are always included.
           // Configs added in later versions are only written when not at the 
default, matching what older versions write.
   ```



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/StreamsGroup.java:
##########
@@ -265,10 +265,10 @@ private record RefinedAssignment(int assignmentEpoch, 
Map<String, TasksTuple> as
     private final TimelineObject<Optional<ConfiguredTopology>> 
configuredTopology;
 
     /**
-     * The last used assignment configurations for this streams group.
+     * The last used assignment configurations for this streams group; the 
defaults until any were recorded.

Review Comment:
   It's not clear to me what this means.



##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/streams/GroupSpecBuilderTest.java:
##########
@@ -241,9 +236,7 @@ public void testAssignorOffload() {
                 // members and taskOffsets
                 Map.of("member-1", createMemberMetadataAndState(member, 
memberTaskOffsets)),
                 // assignmentConfigs

Review Comment:
   ```suggestion
   ```
   We can drop this marker comment, since the assignmentConfigs are no longer 
mutable.



##########
group-coordinator/group-coordinator-api/src/main/java/org/apache/kafka/coordinator/group/api/streams/assignor/GroupAssignment.java:
##########
@@ -36,11 +35,11 @@ public class GroupAssignment {
     public GroupAssignment(
         Map<String, MemberAssignment> members
     ) {
-        this.members = Objects.requireNonNull(members);
+        this.members = Map.copyOf(members);
     }
 
     /**
-     * @return The member assignments keyed by member ID.
+     * @return The member assignments keyed by member ID. The map is 
unmodifiable.

Review Comment:
   Do we really need to call this out? Isn't the default expectation that 
callers do not own the maps returned by methods like this and should not try to 
modify them anyway?
   
   ```suggestion
        * @return The member assignments keyed by member ID.
   ```



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -2270,9 +2268,10 @@ private CoordinatorResult<StreamsGroupHeartbeatResult, 
CoordinatorRecord> stream
             assignmentUpdate = AssignmentUpdate.RECOMPUTE;
         }
 
-        // Check if assignment configurations have changed
-        Map<String, String> currentAssignmentConfigs = 
streamsGroupAssignmentConfigs(groupId);
-        Map<String, String> storedAssignmentConfigs = 
group.lastAssignmentConfigs();
+        // Check if assignment configurations have changed. A group with no 
recorded configs holds the defaults,

Review Comment:
   > holds the defaults
   
   Does this mean the group's assignment was calculated using the default 
assignment configuration or that we just don't know?



##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java:
##########
@@ -24178,7 +24177,91 @@ public void 
testStreamsGroupEpochIncreaseWithNumStandbyReplicasConfigChanges() {
         StreamsGroup group = 
context.groupMetadataManager.streamsGroup(groupId);
         int newGroupEpoch = group.groupEpoch();
         assertEquals(11, newGroupEpoch);
-        assertEquals("2", 
group.lastAssignmentConfigs().get("num.standby.replicas"));
+        assertEquals(2, group.lastAssignmentConfigs().numStandbyReplicas());
+    }
+
+    @Test
+    public void 
testStreamsGroupEpochDoesNotIncreaseWhenEveryAssignmentConfigIsAtItsDefault() {
+        // A group that sets nothing must compare equal to a record without 
configs, or upgrading the
+        // broker rebalances every group.

Review Comment:
   It's not clear what this means. Groups and their records are different 
things and can't be compared.



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