AndrewJSchofield commented on code in PR #20168: URL: https://github.com/apache/kafka/pull/20168#discussion_r2227735419
########## 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: Yes, that's a very good point. Thanks for finding it. -- 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