You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "squah-confluent (via GitHub)" <gi...@apache.org> on 2025/06/30 04:55:41 UTC

Re: [PR] KAFKA-19431: Ensure consumer and share assignment consistency with subscriptions [kafka]

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


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/consumer/CurrentAssignmentBuilder.java:
##########
@@ -215,6 +254,56 @@ private boolean ownsRevokedPartitions(
         return false;
     }
 
+    /**
+     * Updates the current assignment, removing any partitions that are not part of the subscribed topics.
+     *
+     * @param memberAssignedPartitions  The assigned partitions of the member to use.
+     * @return A new ConsumerGroupMember.
+     */
+    private ConsumerGroupMember computeCurrentAssignment(
+        Map<Uuid, Set<Integer>> memberAssignedPartitions
+    ) {
+        Set<Uuid> subscribedTopicIds = subscribedTopicIds();
+        if (subscribedTopicIds == null) {
+            // The member's subscribed topic regex is unresolved, so we cannot tell whether topics
+            // are part of its subscription.
+            return member;
+        }

Review Comment:
   I guess that would be better for consistency with the client's subscription. I've made the change and added tests for unresolved vs resolved regexes at the `CurrentAssignmentBuilder` level. There's an existing `GroupMetadataManager` test that runs through the regex update flow.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org