chia7712 commented on code in PR #20235:
URL: https://github.com/apache/kafka/pull/20235#discussion_r2228948879
##########
tools/src/test/java/org/apache/kafka/tools/consumer/group/ResetConsumerGroupOffsetTest.java:
##########
@@ -153,6 +154,28 @@ public void
testResetOffsetsNotExistingGroup(ClusterInstance cluster) throws Exc
}
}
+ @ClusterTest(
+ brokers = 3,
Review Comment:
It seems two brokers could work well for this test, right?
##########
tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java:
##########
@@ -653,7 +653,7 @@ private List<TopicPartition>
filterNoneLeaderPartitions(Collection<TopicPartitio
return
adminClient.describeTopics(topics).allTopicNames().get().entrySet()
.stream()
.flatMap(entry ->
entry.getValue().partitions().stream()
- .filter(partitionInfo ->
partitionInfo.leader() == null)
+ .filter(partitionInfo ->
partitionInfo.leader() == null && topicPartitions.contains(new
TopicPartition(entry.getKey(), partitionInfo.partition())))
.map(partitionInfo -> new
TopicPartition(entry.getKey(), partitionInfo.partition())))
Review Comment:
Please add the filter after `map` to avoid creating extra `TopicPartition`
object.
```java
.filter(partitionInfo ->
partitionInfo.leader() == null)
.map(partitionInfo -> new
TopicPartition(entry.getKey(), partitionInfo.partition()))
.filter(topicPartitions::contains))
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]