DL1231 commented on code in PR #20101:
URL: https://github.com/apache/kafka/pull/20101#discussion_r2184130330


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -2692,7 +2690,27 @@ private boolean initializedAssignmentPending(ShareGroup 
group) {
             }
         }
 
-        return !initializedTps.equals(currentAssigned);
+        Set<String> subscribedTopicNames = 
group.subscribedTopicNames().keySet();
+        for (Map.Entry<Uuid, InitMapValue> entry : 
shareGroupStatePartitionMetadata.get(group.groupId()).initializedTopics().entrySet())
 {
+            if (subscribedTopicNames.contains(entry.getValue().name())) {
+                // This topic is currently subscribed, so investigate further.
+                Set<Integer> currentAssignedPartitions = 
currentAssigned.get(entry.getKey());
+                if (currentAssignedPartitions != null) {
+                    if 
(currentAssignedPartitions.equals(entry.getValue().partitions())) {
+                        // The assigned and initialized partitions match, so 
assignment does not need to be recomputed.
+                        continue;
+                    } else {
+                        // The assigned and initialized partitions do not 
match, so recompute the assignment.
+                        return true;
+                    }

Review Comment:
   What do you think of the implementation below?
   ```suggestion
                       if 
(!currentAssignedPartitions.equals(entry.getValue().partitions())) {
                           // The assigned and initialized partitions do not 
match, so recompute the assignment.
                           return true;
                       }
   ```



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -2692,7 +2690,27 @@ private boolean initializedAssignmentPending(ShareGroup 
group) {
             }
         }
 
-        return !initializedTps.equals(currentAssigned);
+        Set<String> subscribedTopicNames = 
group.subscribedTopicNames().keySet();

Review Comment:
   Should we add integration tests for this scenario?



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

Reply via email to