chia7712 commented on code in PR #20168: URL: https://github.com/apache/kafka/pull/20168#discussion_r2227295797
########## tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java: ########## @@ -1024,6 +1029,38 @@ private Map<TopicPartition, OffsetAndMetadata> prepareOffsetsToReset(String grou return null; } + private void checkAllTopicPartitionsValid(Collection<TopicPartition> partitionsToReset) { + // check the partitions exist + List<TopicPartition> partitionsNotExistList = filterNonExistentPartitions(partitionsToReset); + if (!partitionsNotExistList.isEmpty()) { + String partitionStr = partitionsNotExistList.stream().map(TopicPartition::toString).collect(Collectors.joining(",")); + throw new UnknownTopicOrPartitionException("The partitions \"" + partitionStr + "\" do not exist"); + } + + // check the partitions have leader + List<TopicPartition> partitionsWithoutLeader = filterNoneLeaderPartitions(partitionsToReset); Review Comment: ``` chia7712@chia7712-ubuntu:~/project/kafka$ ./bin/kafka-consumer-groups.sh \ --bootstrap-server 172.20.10.2:20001 \ --reset-offsets \ --to-earliest \ --execute \ --group perf-consumer-19460 \ --topic chia:1 Error: Executing consumer group command failed due to The partitions "chia-2" have no leader org.apache.kafka.common.errors.LeaderNotAvailableException: The partitions "chia-2" have no leader ``` It is indeed a bug that unrelated topic partitions could fail the tool. -- 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