chia7712 commented on code in PR #23165:
URL: https://github.com/apache/kafka/pull/23165#discussion_r4206012722


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/assignor/AssignmentConfigsImpl.java:
##########
@@ -52,22 +54,28 @@ public record AssignmentConfigsImpl(
     }
 
     /**
-     * Converts the raw assignment configs computed for the group into the 
typed configs passed to the assignor.
+     * Converts the assignment configs recorded for the group into the typed 
configs passed to the assignor.
+     *
+     * @param configs The configs from the group metadata record, or null if 
the record has none.
      */
-    public static AssignmentConfigsImpl fromMap(Map<String, String> configs) {
-        // The map is empty when it was replayed from a group metadata record 
written before the last assignment
-        // configs were persisted.
-        if (configs.isEmpty()) {
+    public static AssignmentConfigsImpl 
fromRecord(List<StreamsGroupMetadataValue.LastAssignmentConfig> configs) {
+        // If a config is not present, we use its default value. A record 
written before the configs were persisted has
+        // none, and a config added later is only written when it is not at 
its default.
+        if (configs == null) {
             return DEFAULT;
         }
-        // The rack-aware assignment tags are only recorded when any are 
configured, so an absent value means the
-        // configuration is at its default.
-        String rackAwareAssignmentTags = configs.getOrDefault(
-            RACK_AWARE_ASSIGNMENT_TAGS_CONFIG, 
GroupCoordinatorConfig.STREAMS_GROUP_RACK_AWARE_ASSIGNMENT_TAGS_DEFAULT);
-        return new AssignmentConfigsImpl(
-            Integer.parseInt(configs.get(NUM_STANDBY_REPLICAS_CONFIG)),
-            parseRackAwareAssignmentTags(rackAwareAssignmentTags)
-        );
+        int numStandbyReplicas = DEFAULT.numStandbyReplicas();

Review Comment:
   I'm thinking about the case where we change the default value in the future. 
A rebalance should happen in that case, since the configs did change on this 
broker, right? If so, filling the omitted item with the current default may 
miss a required rebalance.
   
   We can handle it once a default value gets changed. Or we can add separate 
constants (v0) that hold the same values as the current defaults, and use them 
here instead of DEFAULT.
   
   Also, we probably need to make toMap write all configs. That way an omitted 
key can only come from a broker that did not know the config yet (v0).



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