chia7712 commented on code in PR #20168:
URL: https://github.com/apache/kafka/pull/20168#discussion_r2221826208


##########
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:
   if there is a topic having three partitions, and the `t-2` partition is 
offline, then if `partitionsToReset` is `t-0,t-1`, `filterNoneLeaderPartitions` 
will return `t-2`, causing the tool to fail. Is it expected?



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

Reply via email to