showuon commented on a change in pull request #10509:
URL: https://github.com/apache/kafka/pull/10509#discussion_r616350866



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java
##########
@@ -234,23 +245,28 @@ private boolean allSubscriptionsEqual(Set<String> 
allTopics,
                 List<TopicPartition> consumerAssignment = 
assignment.get(consumer);
 
                 int expectedAssignedCount = numMaxCapacityMembers < 
numExpectedMaxCapacityMembers ? maxQuota : minQuota;
+                int currentAssignedCount = consumerAssignment.size();
                 if (unassignedPartitionsIter.hasNext()) {
                     TopicPartition tp = unassignedPartitionsIter.next();
                     consumerAssignment.add(tp);
-                    unassignedPartitionsIter.remove();

Review comment:
       Don't do the `unassignedPartitions` list element removal as mentioned, 
it's slow. Instead, we make sure the `unfilledMembers` will be empty in the end 
inside the while loop. After all, the `unassignedPartitions` size will always 
>= `unfilledMembers` size. By only removing `unfilledMembers` makes it faster, 
and also keeps the logic correctness.




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

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


Reply via email to