Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-23 Thread via GitHub


nizhikov commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1905956206

   Thanks for review and merge!


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


jolshan merged PR #14856:
URL: https://github.com/apache/kafka/pull/14856


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


jolshan commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1904833683

   Thanks. I will wait for the tests to finish  


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


mimaison commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1904738103

   @jolshan Feel free to merge once you're happy with the changes.


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1462263439


##
tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumer.group;
+
+import joptsimple.OptionSpec;
+import org.apache.kafka.server.util.CommandDefaultOptions;
+import org.apache.kafka.server.util.CommandLineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.apache.kafka.common.utils.Utils.join;
+import static org.apache.kafka.tools.ToolsUtils.minus;
+
+public class ConsumerGroupCommandOptions extends CommandDefaultOptions {
+public static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerGroupCommandOptions.class);
+
+public static final String BOOTSTRAP_SERVER_DOC = "REQUIRED: The server(s) 
to connect to.";
+public static final String GROUP_DOC = "The consumer group we wish to act 
on.";
+public static final String TOPIC_DOC = "The topic whose consumer group 
information should be deleted or topic whose should be included in the reset 
offset process. " +
+"In `reset-offsets` case, partitions can be specified using this 
format: `topic1:0,1,2`, where 0,1,2 are the partition to be included in the 
process. " +
+"Reset-offsets also supports multiple topic inputs.";
+public static final String ALL_TOPICS_DOC = "Consider all topics assigned 
to a group in the `reset-offsets` process.";
+public static final String LIST_DOC = "List all consumer groups.";
+public static final String DESCRIBE_DOC = "Describe consumer group and 
list offset lag (number of messages not yet processed) related to given group.";
+public static final String ALL_GROUPS_DOC = "Apply to all consumer 
groups.";
+public static final String NL = System.lineSeparator();
+public static final String DELETE_DOC = "Pass in groups to delete topic 
partition offsets and ownership information " +
+"over the entire consumer group. For instance --group g1 --group g2";
+public static final String TIMEOUT_MS_DOC = "The timeout that can be set 
for some use cases. For example, it can be used when describing the group " +
+"to specify the maximum amount of time in milliseconds to wait before 
the group stabilizes (when the group is just created, " +
+"or is going through some changes).";
+public static final String COMMAND_CONFIG_DOC = "Property file containing 
configs to be passed to Admin Client and Consumer.";
+public static final String RESET_OFFSETS_DOC = "Reset offsets of consumer 
group. Supports one consumer group at the time, and instances should be 
inactive" + NL +
+"Has 2 execution options: --dry-run (the default) to plan which 
offsets to reset, and --execute to update the offsets. " +
+"Additionally, the --export option is used to export the results to a 
CSV format." + NL +
+"You must choose one of the following reset specifications: 
--to-datetime, --by-duration, --to-earliest, " +
+"--to-latest, --shift-by, --from-file, --to-current, --to-offset." + 
NL +
+"To define the scope use --all-topics or --topic. One scope must be 
specified unless you use '--from-file'.";
+public static final String DRY_RUN_DOC = "Only show results without 
executing changes on Consumer Groups. Supported operations: reset-offsets.";
+public static final String EXECUTE_DOC = "Execute operation. Supported 
operations: reset-offsets.";
+public static final String EXPORT_DOC = "Export operation execution to a 
CSV file. Supported operations: reset-offsets.";
+public static final String RESET_TO_OFFSET_DOC = "Reset offsets to a 
specific offset.";
+public static final String RESET_FROM_FILE_DOC = "Reset offsets to values 
defined in CSV file.";
+public static final String RESET_TO_DATETIME_DOC = "Reset offsets to 
offset from datetime. Format: '-MM-DDTHH:mm:SS.sss'";
+public static final String RESET_BY_DURATION_DOC = "Reset offsets to 

Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


jolshan commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1904570844

   Thanks @nizhikov just one more small comment from me.


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


jolshan commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1462243818


##
tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumer.group;
+
+import joptsimple.OptionSpec;
+import org.apache.kafka.server.util.CommandDefaultOptions;
+import org.apache.kafka.server.util.CommandLineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.apache.kafka.common.utils.Utils.join;
+import static org.apache.kafka.tools.ToolsUtils.minus;
+
+public class ConsumerGroupCommandOptions extends CommandDefaultOptions {
+public static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerGroupCommandOptions.class);
+
+public static final String BOOTSTRAP_SERVER_DOC = "REQUIRED: The server(s) 
to connect to.";
+public static final String GROUP_DOC = "The consumer group we wish to act 
on.";
+public static final String TOPIC_DOC = "The topic whose consumer group 
information should be deleted or topic whose should be included in the reset 
offset process. " +
+"In `reset-offsets` case, partitions can be specified using this 
format: `topic1:0,1,2`, where 0,1,2 are the partition to be included in the 
process. " +
+"Reset-offsets also supports multiple topic inputs.";
+public static final String ALL_TOPICS_DOC = "Consider all topics assigned 
to a group in the `reset-offsets` process.";
+public static final String LIST_DOC = "List all consumer groups.";
+public static final String DESCRIBE_DOC = "Describe consumer group and 
list offset lag (number of messages not yet processed) related to given group.";
+public static final String ALL_GROUPS_DOC = "Apply to all consumer 
groups.";
+public static final String NL = System.lineSeparator();
+public static final String DELETE_DOC = "Pass in groups to delete topic 
partition offsets and ownership information " +
+"over the entire consumer group. For instance --group g1 --group g2";
+public static final String TIMEOUT_MS_DOC = "The timeout that can be set 
for some use cases. For example, it can be used when describing the group " +
+"to specify the maximum amount of time in milliseconds to wait before 
the group stabilizes (when the group is just created, " +
+"or is going through some changes).";
+public static final String COMMAND_CONFIG_DOC = "Property file containing 
configs to be passed to Admin Client and Consumer.";
+public static final String RESET_OFFSETS_DOC = "Reset offsets of consumer 
group. Supports one consumer group at the time, and instances should be 
inactive" + NL +
+"Has 2 execution options: --dry-run (the default) to plan which 
offsets to reset, and --execute to update the offsets. " +
+"Additionally, the --export option is used to export the results to a 
CSV format." + NL +
+"You must choose one of the following reset specifications: 
--to-datetime, --by-duration, --to-earliest, " +
+"--to-latest, --shift-by, --from-file, --to-current, --to-offset." + 
NL +
+"To define the scope use --all-topics or --topic. One scope must be 
specified unless you use '--from-file'.";
+public static final String DRY_RUN_DOC = "Only show results without 
executing changes on Consumer Groups. Supported operations: reset-offsets.";
+public static final String EXECUTE_DOC = "Execute operation. Supported 
operations: reset-offsets.";
+public static final String EXPORT_DOC = "Export operation execution to a 
CSV file. Supported operations: reset-offsets.";
+public static final String RESET_TO_OFFSET_DOC = "Reset offsets to a 
specific offset.";
+public static final String RESET_FROM_FILE_DOC = "Reset offsets to values 
defined in CSV file.";
+public static final String RESET_TO_DATETIME_DOC = "Reset offsets to 
offset from datetime. Format: '-MM-DDTHH:mm:SS.sss'";
+public static final String RESET_BY_DURATION_DOC = "Reset offsets to 

Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1462054246


##
tools/src/main/java/org/apache/kafka/tools/consumer/group/PartitionAssignmentState.java:
##
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumer.group;
+
+import org.apache.kafka.common.Node;
+
+import java.util.Optional;
+
+class PartitionAssignmentState {
+public final String group;
+public final Optional coordinator;
+public final Optional topic;
+public final Optional partition;

Review Comment:
   Fixed



##
tools/src/main/java/org/apache/kafka/tools/consumer/group/PartitionAssignmentState.java:
##
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumer.group;
+
+import org.apache.kafka.common.Node;
+
+import java.util.Optional;
+
+class PartitionAssignmentState {
+public final String group;
+public final Optional coordinator;
+public final Optional topic;
+public final Optional partition;
+public final Optional offset;

Review Comment:
   Fixed



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


mimaison commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1462033029


##
tools/src/main/java/org/apache/kafka/tools/consumer/group/PartitionAssignmentState.java:
##
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumer.group;
+
+import org.apache.kafka.common.Node;
+
+import java.util.Optional;
+
+class PartitionAssignmentState {
+public final String group;
+public final Optional coordinator;
+public final Optional topic;
+public final Optional partition;
+public final Optional offset;

Review Comment:
   We can use `OptionalLong`



##
tools/src/main/java/org/apache/kafka/tools/consumer/group/PartitionAssignmentState.java:
##
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumer.group;
+
+import org.apache.kafka.common.Node;
+
+import java.util.Optional;
+
+class PartitionAssignmentState {
+public final String group;
+public final Optional coordinator;
+public final Optional topic;
+public final Optional partition;

Review Comment:
   We can use `OptionalInt`



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-22 Thread via GitHub


nizhikov commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1903571070

   Hello @mimaison , @jolshan do you have any other comments?


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-18 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1457691847


##
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##
@@ -1492,6 +1501,20 @@ public static  Set diff(final Supplier> 
constructor, final Set l
 return result;
 }
 
+/**
+ * @param set Source set.
+ * @param toRemove Elements to remove.
+ * @return {@code set} copy without {@code toRemove} elements.
+ * @param  Element type.
+ */
+@SuppressWarnings("unchecked")
+public static  Set minus(Set set, T...toRemove) {

Review Comment:
   Moved



##
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##
@@ -594,6 +594,15 @@ public static  String join(T[] strs, String separator) {
 return join(Arrays.asList(strs), separator);
 }
 
+/**
+ * Create a string representation of a collection joined by ", ".
+ * @param collection The list of items
+ * @return The string representation.
+ */
+public static  String join(Collection collection) {

Review Comment:
   Method removed



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-18 Thread via GitHub


mimaison commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1457296352


##
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##
@@ -1492,6 +1501,20 @@ public static  Set diff(final Supplier> 
constructor, final Set l
 return result;
 }
 
+/**
+ * @param set Source set.
+ * @param toRemove Elements to remove.
+ * @return {@code set} copy without {@code toRemove} elements.
+ * @param  Element type.
+ */
+@SuppressWarnings("unchecked")
+public static  Set minus(Set set, T...toRemove) {

Review Comment:
   Let's not add methods in the client module that are only used in tools. This 
can be moved to ToolsUtils.



##
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##
@@ -594,6 +594,15 @@ public static  String join(T[] strs, String separator) {
 return join(Arrays.asList(strs), separator);
 }
 
+/**
+ * Create a string representation of a collection joined by ", ".
+ * @param collection The list of items
+ * @return The string representation.
+ */
+public static  String join(Collection collection) {

Review Comment:
   Do we really need this method? Why can't we call the existing `join()` 
method and pass the separator? If you want to keep it, since it's only used in 
tools let's move it to the tools module.



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-18 Thread via GitHub


nizhikov commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1898096530

   @mimaison CI seems OK. I addressed all your comments. Please, take a look.


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456589544


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*

Review Comment:
   package renamed.



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


jolshan commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456587593


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*

Review Comment:
   That works for me. Thanks!



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456546534


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*

Review Comment:
   > I think when we have had two word folders we usually put a dash between 
them (ie consumer-group)
   
   Dash can't be used in java package name.
   
   > They follow a pattern of coordinator/group
   
   We can move classes to `org.apache.kafka.tools.consumer.group` package.
   What do you think?



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


jolshan commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456536862


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*

Review Comment:
   I wasn't sure if we wanted to use the same convention of the other java 
consumer group files. But maybe that is confusing. They follow a pattern of 
coordinator/group. Not sure if we really have reusability amongst coordinator 
tools though. 
   
   I think when we have had two word folders we usually put a dash between them 
(ie consumer-group)



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456530381


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*

Review Comment:
   > Is the tools/consumergroup a new folder?
   
   yes.
   
   > I wonder if there is a name that is more consistent with the other folders.
   
   Couldn't come up with the better naming :) 
   Do you have one in mind?



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


nizhikov commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1896962207

   @jolshan 
   
   > Did we want to delete the old files in this PR or a follow up?
   
   For the previous command we remove old files only when command was merged 
   
   1. Reassign case classes and options moved to java - 
1fd58e30cf38587a66c1f7188c7667b555624485
   3. Command moved to java and old classes removed - 
76b1b50b644149e77ee1ec42d882e2cb80742bdf
   
   
   


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456523688


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumergroup;
+
+import joptsimple.OptionSpec;
+import org.apache.kafka.common.utils.Utils;
+import org.apache.kafka.server.util.CommandDefaultOptions;
+import org.apache.kafka.server.util.CommandLineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class ConsumerGroupCommandOptions extends CommandDefaultOptions {
+public static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerGroupCommandOptions.class);
+
+public static final String BOOTSTRAP_SERVER_DOC = "REQUIRED: The server(s) 
to connect to.";
+public static final String GROUP_DOC = "The consumer group we wish to act 
on.";
+public static final String TOPIC_DOC = "The topic whose consumer group 
information should be deleted or topic whose should be included in the reset 
offset process. " +
+"In `reset-offsets` case, partitions can be specified using this 
format: `topic1:0,1,2`, where 0,1,2 are the partition to be included in the 
process. " +
+"Reset-offsets also supports multiple topic inputs.";
+public static final String ALL_TOPICS_DOC = "Consider all topics assigned 
to a group in the `reset-offsets` process.";
+public static final String LIST_DOC = "List all consumer groups.";
+public static final String DESCRIBE_DOC = "Describe consumer group and 
list offset lag (number of messages not yet processed) related to given group.";
+public static final String ALL_GROUPS_DOC = "Apply to all consumer 
groups.";
+public static final String NL = System.getProperty("line.separator");
+public static final String DELETE_DOC = "Pass in groups to delete topic 
partition offsets and ownership information " +
+"over the entire consumer group. For instance --group g1 --group g2";
+public static final String TIMEOUT_MS_DOC = "The timeout that can be set 
for some use cases. For example, it can be used when describing the group " +
+"to specify the maximum amount of time in milliseconds to wait before 
the group stabilizes (when the group is just created, " +
+"or is going through some changes).";
+public static final String COMMAND_CONFIG_DOC = "Property file containing 
configs to be passed to Admin Client and Consumer.";
+public static final String RESET_OFFSETS_DOC = "Reset offsets of consumer 
group. Supports one consumer group at the time, and instances should be 
inactive" + NL +
+"Has 2 execution options: --dry-run (the default) to plan which 
offsets to reset, and --execute to update the offsets. " +
+"Additionally, the --export option is used to export the results to a 
CSV format." + NL +
+"You must choose one of the following reset specifications: 
--to-datetime, --by-duration, --to-earliest, " +
+"--to-latest, --shift-by, --from-file, --to-current, --to-offset." + 
NL +
+"To define the scope use --all-topics or --topic. One scope must be 
specified unless you use '--from-file'.";
+public static final String DRY_RUN_DOC = "Only show results without 
executing changes on Consumer Groups. Supported operations: reset-offsets.";
+public static final String EXECUTE_DOC = "Execute operation. Supported 
operations: reset-offsets.";
+public static final String EXPORT_DOC = "Export operation execution to a 
CSV file. Supported operations: reset-offsets.";
+public static final String RESET_TO_OFFSET_DOC = "Reset offsets to a 
specific offset.";
+public static final String RESET_FROM_FILE_DOC = "Reset offsets to values 
defined in CSV file.";
+public static final String RESET_TO_DATETIME_DOC = "Reset offsets to 
offset from datetime. Format: '-MM-DDTHH:mm:SS.sss'";
+public static final String RESET_BY_DURATION_DOC = "Reset offsets to 
offset by duration from current timestamp. Format: 

Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456521165


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumergroup;
+
+import joptsimple.OptionSpec;
+import org.apache.kafka.common.utils.Utils;
+import org.apache.kafka.server.util.CommandDefaultOptions;
+import org.apache.kafka.server.util.CommandLineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class ConsumerGroupCommandOptions extends CommandDefaultOptions {
+public static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerGroupCommandOptions.class);
+
+public static final String BOOTSTRAP_SERVER_DOC = "REQUIRED: The server(s) 
to connect to.";
+public static final String GROUP_DOC = "The consumer group we wish to act 
on.";
+public static final String TOPIC_DOC = "The topic whose consumer group 
information should be deleted or topic whose should be included in the reset 
offset process. " +
+"In `reset-offsets` case, partitions can be specified using this 
format: `topic1:0,1,2`, where 0,1,2 are the partition to be included in the 
process. " +
+"Reset-offsets also supports multiple topic inputs.";
+public static final String ALL_TOPICS_DOC = "Consider all topics assigned 
to a group in the `reset-offsets` process.";
+public static final String LIST_DOC = "List all consumer groups.";
+public static final String DESCRIBE_DOC = "Describe consumer group and 
list offset lag (number of messages not yet processed) related to given group.";
+public static final String ALL_GROUPS_DOC = "Apply to all consumer 
groups.";
+public static final String NL = System.lineSeparator();
+public static final String DELETE_DOC = "Pass in groups to delete topic 
partition offsets and ownership information " +
+"over the entire consumer group. For instance --group g1 --group g2";
+public static final String TIMEOUT_MS_DOC = "The timeout that can be set 
for some use cases. For example, it can be used when describing the group " +
+"to specify the maximum amount of time in milliseconds to wait before 
the group stabilizes (when the group is just created, " +
+"or is going through some changes).";
+public static final String COMMAND_CONFIG_DOC = "Property file containing 
configs to be passed to Admin Client and Consumer.";
+public static final String RESET_OFFSETS_DOC = "Reset offsets of consumer 
group. Supports one consumer group at the time, and instances should be 
inactive" + NL +
+"Has 2 execution options: --dry-run (the default) to plan which 
offsets to reset, and --execute to update the offsets. " +
+"Additionally, the --export option is used to export the results to a 
CSV format." + NL +
+"You must choose one of the following reset specifications: 
--to-datetime, --by-duration, --to-earliest, " +
+"--to-latest, --shift-by, --from-file, --to-current, --to-offset." + 
NL +
+"To define the scope use --all-topics or --topic. One scope must be 
specified unless you use '--from-file'.";
+public static final String DRY_RUN_DOC = "Only show results without 
executing changes on Consumer Groups. Supported operations: reset-offsets.";
+public static final String EXECUTE_DOC = "Execute operation. Supported 
operations: reset-offsets.";
+public static final String EXPORT_DOC = "Export operation execution to a 
CSV file. Supported operations: reset-offsets.";
+public static final String RESET_TO_OFFSET_DOC = "Reset offsets to a 
specific offset.";
+public static final String RESET_FROM_FILE_DOC = "Reset offsets to values 
defined in CSV file.";
+public static final String RESET_TO_DATETIME_DOC = "Reset offsets to 
offset from datetime. Format: '-MM-DDTHH:mm:SS.sss'";
+public static final String RESET_BY_DURATION_DOC = "Reset offsets to 
offset by duration from current timestamp. Format: 'PnDTnHnMnS'";
+

Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


nizhikov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456518422


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/PartitionAssignmentState.java:
##
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumergroup;
+
+import org.apache.kafka.common.Node;
+
+import java.util.Optional;
+
+class PartitionAssignmentState {
+public final String group;
+public final Optional coordinator;
+public final Optional topic;
+public final Optional partition;
+public final Optional offset;
+public final Optional lag;
+public final Optional consumerId;
+public final Optional host;
+public final Optional clientId;
+public final Optional logEndOffset;
+
+public PartitionAssignmentState(String group, Optional coordinator, 
Optional topic,
+Optional partition, 
Optional offset, Optional lag,
+Optional consumerId, 
Optional host, Optional clientId,
+Optional logEndOffset) {
+this.group = group;
+this.coordinator = coordinator;
+this.topic = topic;
+this.partition = partition;
+this.offset = offset;
+this.lag = lag;
+this.consumerId = consumerId;
+this.host = host;
+this.clientId = clientId;
+this.logEndOffset = logEndOffset;
+}
+}

Review Comment:
   Fixed.



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


jolshan commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1896365557

   Did we want to delete the old files in this PR or a follow up?


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


jolshan commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456242441


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*

Review Comment:
   Is the tools/consumergroup a new folder? I wonder if there is a name that is 
more consistent with the other folders. 



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-17 Thread via GitHub


mimaison commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1456011084


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/PartitionAssignmentState.java:
##
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumergroup;
+
+import org.apache.kafka.common.Node;
+
+import java.util.Optional;
+
+class PartitionAssignmentState {
+public final String group;
+public final Optional coordinator;
+public final Optional topic;
+public final Optional partition;
+public final Optional offset;
+public final Optional lag;
+public final Optional consumerId;
+public final Optional host;
+public final Optional clientId;
+public final Optional logEndOffset;
+
+public PartitionAssignmentState(String group, Optional coordinator, 
Optional topic,
+Optional partition, 
Optional offset, Optional lag,
+Optional consumerId, 
Optional host, Optional clientId,
+Optional logEndOffset) {
+this.group = group;
+this.coordinator = coordinator;
+this.topic = topic;
+this.partition = partition;
+this.offset = offset;
+this.lag = lag;
+this.consumerId = consumerId;
+this.host = host;
+this.clientId = clientId;
+this.logEndOffset = logEndOffset;
+}
+}

Review Comment:
   Nit: Can we add a newline?



##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumergroup;
+
+import joptsimple.OptionSpec;
+import org.apache.kafka.common.utils.Utils;
+import org.apache.kafka.server.util.CommandDefaultOptions;
+import org.apache.kafka.server.util.CommandLineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class ConsumerGroupCommandOptions extends CommandDefaultOptions {
+public static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerGroupCommandOptions.class);
+
+public static final String BOOTSTRAP_SERVER_DOC = "REQUIRED: The server(s) 
to connect to.";
+public static final String GROUP_DOC = "The consumer group we wish to act 
on.";
+public static final String TOPIC_DOC = "The topic whose consumer group 
information should be deleted or topic whose should be included in the reset 
offset process. " +
+"In `reset-offsets` case, partitions can be specified using this 
format: `topic1:0,1,2`, where 0,1,2 are the partition to be included in the 
process. " +
+"Reset-offsets also supports multiple topic inputs.";
+public static final String ALL_TOPICS_DOC = "Consider all topics assigned 
to a group in the `reset-offsets` process.";
+public static final String LIST_DOC = "List all consumer groups.";
+public static final String DESCRIBE_DOC = "Describe consumer group and 
list offset lag (number of messages not yet processed) related to given group.";
+public static final String ALL_GROUPS_DOC = "Apply to all consumer 
groups.";
+public static final String NL = System.lineSeparator();
+public static final String DELETE_DOC = "Pass in groups to delete topic 

Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2024-01-08 Thread via GitHub


nizhikov commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1881507357

   @mimaison can you, please, take a look.


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2023-12-07 Thread via GitHub


nizhikov commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1845250099

   Hello, @mimaison @jolshan 
   
   Looks like very straightforward PR for me.
   Can you, please, review it, also?
   
   So we can start moving `ConsumerGroupCommand` to tools.
   
   Full patch is #14471 


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2023-12-06 Thread via GitHub


tledkov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1418448844


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumergroup;
+
+import joptsimple.OptionSpec;
+import org.apache.kafka.common.utils.Utils;
+import org.apache.kafka.server.util.CommandDefaultOptions;
+import org.apache.kafka.server.util.CommandLineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class ConsumerGroupCommandOptions extends CommandDefaultOptions {
+public static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerGroupCommandOptions.class);
+
+public static final String BOOTSTRAP_SERVER_DOC = "REQUIRED: The server(s) 
to connect to.";
+public static final String GROUP_DOC = "The consumer group we wish to act 
on.";
+public static final String TOPIC_DOC = "The topic whose consumer group 
information should be deleted or topic whose should be included in the reset 
offset process. " +
+"In `reset-offsets` case, partitions can be specified using this 
format: `topic1:0,1,2`, where 0,1,2 are the partition to be included in the 
process. " +
+"Reset-offsets also supports multiple topic inputs.";
+public static final String ALL_TOPICS_DOC = "Consider all topics assigned 
to a group in the `reset-offsets` process.";
+public static final String LIST_DOC = "List all consumer groups.";
+public static final String DESCRIBE_DOC = "Describe consumer group and 
list offset lag (number of messages not yet processed) related to given group.";
+public static final String ALL_GROUPS_DOC = "Apply to all consumer 
groups.";
+public static final String NL = System.getProperty("line.separator");
+public static final String DELETE_DOC = "Pass in groups to delete topic 
partition offsets and ownership information " +
+"over the entire consumer group. For instance --group g1 --group g2";
+public static final String TIMEOUT_MS_DOC = "The timeout that can be set 
for some use cases. For example, it can be used when describing the group " +
+"to specify the maximum amount of time in milliseconds to wait before 
the group stabilizes (when the group is just created, " +
+"or is going through some changes).";
+public static final String COMMAND_CONFIG_DOC = "Property file containing 
configs to be passed to Admin Client and Consumer.";
+public static final String RESET_OFFSETS_DOC = "Reset offsets of consumer 
group. Supports one consumer group at the time, and instances should be 
inactive" + NL +
+"Has 2 execution options: --dry-run (the default) to plan which 
offsets to reset, and --execute to update the offsets. " +
+"Additionally, the --export option is used to export the results to a 
CSV format." + NL +
+"You must choose one of the following reset specifications: 
--to-datetime, --by-duration, --to-earliest, " +
+"--to-latest, --shift-by, --from-file, --to-current, --to-offset." + 
NL +
+"To define the scope use --all-topics or --topic. One scope must be 
specified unless you use '--from-file'.";
+public static final String DRY_RUN_DOC = "Only show results without 
executing changes on Consumer Groups. Supported operations: reset-offsets.";
+public static final String EXECUTE_DOC = "Execute operation. Supported 
operations: reset-offsets.";
+public static final String EXPORT_DOC = "Export operation execution to a 
CSV file. Supported operations: reset-offsets.";
+public static final String RESET_TO_OFFSET_DOC = "Reset offsets to a 
specific offset.";
+public static final String RESET_FROM_FILE_DOC = "Reset offsets to values 
defined in CSV file.";
+public static final String RESET_TO_DATETIME_DOC = "Reset offsets to 
offset from datetime. Format: '-MM-DDTHH:mm:SS.sss'";
+public static final String RESET_BY_DURATION_DOC = "Reset offsets to 
offset by duration from current timestamp. Format: 

Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2023-12-06 Thread via GitHub


tledkov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1418426538


##
tools/src/main/java/org/apache/kafka/tools/consumergroup/ConsumerGroupCommandOptions.java:
##
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.tools.consumergroup;
+
+import joptsimple.OptionSpec;
+import org.apache.kafka.common.utils.Utils;
+import org.apache.kafka.server.util.CommandDefaultOptions;
+import org.apache.kafka.server.util.CommandLineUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class ConsumerGroupCommandOptions extends CommandDefaultOptions {
+public static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerGroupCommandOptions.class);
+
+public static final String BOOTSTRAP_SERVER_DOC = "REQUIRED: The server(s) 
to connect to.";
+public static final String GROUP_DOC = "The consumer group we wish to act 
on.";
+public static final String TOPIC_DOC = "The topic whose consumer group 
information should be deleted or topic whose should be included in the reset 
offset process. " +
+"In `reset-offsets` case, partitions can be specified using this 
format: `topic1:0,1,2`, where 0,1,2 are the partition to be included in the 
process. " +
+"Reset-offsets also supports multiple topic inputs.";
+public static final String ALL_TOPICS_DOC = "Consider all topics assigned 
to a group in the `reset-offsets` process.";
+public static final String LIST_DOC = "List all consumer groups.";
+public static final String DESCRIBE_DOC = "Describe consumer group and 
list offset lag (number of messages not yet processed) related to given group.";
+public static final String ALL_GROUPS_DOC = "Apply to all consumer 
groups.";
+public static final String NL = System.getProperty("line.separator");

Review Comment:
   ```suggestion
   public static final String NL = System.lineSeparator();
   ```



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2023-12-06 Thread via GitHub


tledkov commented on code in PR #14856:
URL: https://github.com/apache/kafka/pull/14856#discussion_r1417541595


##
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##
@@ -593,6 +593,16 @@ public static  String join(T[] strs, String separator) {
 return join(Arrays.asList(strs), separator);
 }
 
+/**
+ * Create a string representation of a collection joined by ", ".
+ * @param collection The list of items
+ * @return The string representation.
+ */
+public static  String join(Collection collection) {
+Objects.requireNonNull(collection);
+return mkString(collection.stream(), "", "", ", ");

Review Comment:
   ```suggestion
   return join(collection, ", ");
   ```
   



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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2023-12-05 Thread via GitHub


nizhikov commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1840840108

   @mimaison Will you be able to take a look?
   
   This is first PR to transfer `ConsumerGroupCommand` to java.


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



Re: [PR] KAFKA-14589 ConsumerGroupCommand options and case classes rewritten [kafka]

2023-11-28 Thread via GitHub


nizhikov commented on PR #14856:
URL: https://github.com/apache/kafka/pull/14856#issuecomment-1830131590

   Hello @mimaison , @jolshan 
   
   This PR is first step to transfer `ConsumerGroupCommand` from scala to java.
   Can you, please, take a look.


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