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


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/consumer/CurrentAssignmentBuilder.java:
##########
@@ -215,6 +284,64 @@ private boolean ownsRevokedPartitions(
         return false;
     }
 
+    /**
+     * Updates the current assignment, removing any partitions that are not 
part of the subscribed topics.
+     * This method is a lot faster than running the full reconciliation logic 
in computeNextAssignment.
+     *
+     * @param memberAssignedPartitions  The assigned partitions of the member 
to use.
+     * @return A new ConsumerGroupMember.
+     */
+    private ConsumerGroupMember updateCurrentAssignment(
+        Map<Uuid, Set<Integer>> memberAssignedPartitions
+    ) {
+        Set<Uuid> subscribedTopicIds = subscribedTopicIds();
+
+        // Reuse the original map if no topics need to be removed.
+        Map<Uuid, Set<Integer>> newAssignedPartitions = 
memberAssignedPartitions;
+        Map<Uuid, Set<Integer>> newPartitionsPendingRevocation = new 
HashMap<>(member.partitionsPendingRevocation());
+        for (Map.Entry<Uuid, Set<Integer>> entry : 
memberAssignedPartitions.entrySet()) {

Review Comment:
   Sure, we can do that. I pushed the change. It does introduce extra code 
paths to test.



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