AndrewJSchofield commented on code in PR #22197:
URL: https://github.com/apache/kafka/pull/22197#discussion_r3184194828


##########
tools/src/main/java/org/apache/kafka/tools/consumer/group/ShareGroupCommand.java:
##########
@@ -448,14 +483,32 @@ private Collection<TopicPartition> 
getPartitionsToReset(String groupId) throws E
             return partitionsToReset;
         }
 
-        private Map<TopicPartition, OffsetAndMetadata> 
prepareOffsetsToReset(Collection<TopicPartition> partitionsToReset) {
+        private Map<TopicPartition, SharePartitionOffsetInfo> 
getOffsetInfo(String groupId) {
+            try {
+                return adminClient.listShareGroupOffsets(
+                    Map.of(groupId, new ListShareGroupOffsetsSpec()),
+                    withTimeoutMs(new ListShareGroupOffsetsOptions())
+                ).partitionsToOffsetInfo(groupId).get();
+            } catch (InterruptedException | ExecutionException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        private Map<TopicPartition, OffsetAndMetadata> 
prepareOffsetsToReset(String groupId, Collection<TopicPartition> 
partitionsToReset) {
             offsetsUtils.checkAllTopicPartitionsValid(partitionsToReset);
-            if (opts.options.has(opts.resetToEarliestOpt)) {
+            if (opts.options.has(opts.resetToOffsetOpt)) {
+                return offsetsUtils.resetToOffset(partitionsToReset);

Review Comment:
   I think that's a tiny piece of defensive code in 
`OffsetsUtils.resetToOffset`. In practice, the command line argument spec for 
`resetToOffsetOpt` requires an argument of type Long. If no argument or a 
non-Long argument is specified with `--to-offset`, the command does fail.



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

Reply via email to