You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/08/07 17:57:06 UTC

[GitHub] [kafka] lbradstreet commented on a change in pull request #7222: KAFKA-8806 Reduce calls to validateOffsetsIfNeeded

lbradstreet commented on a change in pull request #7222:
URL: https://github.com/apache/kafka/pull/7222#discussion_r467187874



##########
File path: clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java
##########
@@ -422,10 +421,13 @@ synchronized int numAssignedPartitions() {
     }
 
     synchronized List<TopicPartition> fetchablePartitions(Predicate<TopicPartition> isAvailable) {
-        return assignment.stream()
-                .filter(tpState -> isAvailable.test(tpState.topicPartition()) && tpState.value().isFetchable())
-                .map(PartitionStates.PartitionState::topicPartition)
-                .collect(Collectors.toList());
+        List<TopicPartition> result = new ArrayList<>();

Review comment:
       We should add a small comment that this is in the hotpath and is written the "ugly" way for a reason. It's also probably worth mentioning that we do the cheap isFetchable check first.




----------------------------------------------------------------
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:
users@infra.apache.org