KAFKA-14589 ConsumerGroupCommand options and case classes rewritten#14856
Conversation
|
@mimaison Will you be able to take a look? This is first PR to transfer |
Co-authored-by: Taras Ledkov <tledkov@apache.org>
| } | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| private static <T> Set<T> minus(Set<T> set, T...toRemove) { |
There was a problem hiding this comment.
What about moving this method to CollectionUtils?
There was a problem hiding this comment.
Yes maybe we can move this to Utils?
tledkov
left a comment
There was a problem hiding this comment.
The patch is OK with me.
Checked:
- java codestyle, java code patterns for new code;
- command line string constants.
…merGroupCommandOptions.java Co-authored-by: Taras Ledkov <tledkov@apache.org>
|
@mimaison can you, please, take a look. |
mimaison
left a comment
There was a problem hiding this comment.
Thanks for the PR. I left a few minor comments
| if (options.has(describeOpt)) { | ||
| if (!options.has(groupOpt) && !options.has(allGroupsOpt)) | ||
| CommandLineUtils.printUsageAndExit(parser, | ||
| "Option $describeOpt takes one of these options: " + Utils.join(allGroupSelectionScopeOpts)); |
There was a problem hiding this comment.
"Option $describeOpt takes -> "Option " + describeOpt + " takes`
| this.clientId = clientId; | ||
| this.logEndOffset = logEndOffset; | ||
| } | ||
| } No newline at end of file |
| } | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| private static <T> Set<T> minus(Set<T> set, T...toRemove) { |
There was a problem hiding this comment.
Yes maybe we can move this to Utils?
| @@ -0,0 +1,263 @@ | |||
| /* | |||
There was a problem hiding this comment.
Is the tools/consumergroup a new folder? I wonder if there is a name that is more consistent with the other folders.
There was a problem hiding this 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?
There was a problem hiding this 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)
There was a problem hiding this 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?
|
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
So I tend to reuse this strategy for the |
|
@mimaison CI seems OK. I addressed all your comments. Please, take a look. |
mimaison
left a comment
There was a problem hiding this comment.
Thanks for the updates. Let's avoid adding stuff into clients that are only used by tools.
| * @param <T> Element type. | ||
| */ | ||
| @SuppressWarnings("unchecked") | ||
| public static <T> Set<T> minus(Set<T> set, T...toRemove) { |
There was a problem hiding this comment.
Let's not add methods in the client module that are only used in tools. This can be moved to ToolsUtils.
| * @param collection The list of items | ||
| * @return The string representation. | ||
| */ | ||
| public static <T> String join(Collection<T> collection) { |
There was a problem hiding this 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.
| public final String group; | ||
| public final Optional<Node> coordinator; | ||
| public final Optional<String> topic; | ||
| public final Optional<Integer> partition; |
| public final Optional<Node> coordinator; | ||
| public final Optional<String> topic; | ||
| public final Optional<Integer> partition; | ||
| public final Optional<Long> offset; |
| if (!options.has(groupOpt) && !options.has(allGroupsOpt)) | ||
| CommandLineUtils.printUsageAndExit(parser, | ||
| "Option " + resetOffsetsOpt + " takes one of these options: " + join(allGroupSelectionScopeOpts, ", ")); | ||
| CommandLineUtils.checkInvalidArgs(parser, options, resetToOffsetOpt, minus(allResetOffsetScenarioOpts, resetToOffsetOpt)); |
There was a problem hiding this comment.
hmm -- do we want to line up all the minus arguments here? It adds extra spaces that may be against our style guidelines
There was a problem hiding this comment.
Extra spaces removed
|
Thanks @nizhikov just one more small comment from me. |
|
@jolshan Feel free to merge once you're happy with the changes. |
|
Thanks. I will wait for the tests to finish 👍 |
|
Thanks for review and merge! |
…pache#14856) This PR is part of apache#14471 It contains ConsumerGroupCommandOptions and case classes used by ConsumerGroupCommand rewritten in java. The goal of PR is to reduce main PR size. Co-authored-by: Taras Ledkov <tledkov@apache.org> Reviewers: Mickael Maison <mickael.maison@gmail.com>, Taras Ledkov <tledkov@apache.org>, Justine Olshan <jolshan@confluent.io>
…pache#14856) This PR is part of apache#14471 It contains ConsumerGroupCommandOptions and case classes used by ConsumerGroupCommand rewritten in java. The goal of PR is to reduce main PR size. Co-authored-by: Taras Ledkov <tledkov@apache.org> Reviewers: Mickael Maison <mickael.maison@gmail.com>, Taras Ledkov <tledkov@apache.org>, Justine Olshan <jolshan@confluent.io>
…pache#14856) This PR is part of apache#14471 It contains ConsumerGroupCommandOptions and case classes used by ConsumerGroupCommand rewritten in java. The goal of PR is to reduce main PR size. Co-authored-by: Taras Ledkov <tledkov@apache.org> Reviewers: Mickael Maison <mickael.maison@gmail.com>, Taras Ledkov <tledkov@apache.org>, Justine Olshan <jolshan@confluent.io>
…pache#14856) This PR is part of apache#14471 It contains ConsumerGroupCommandOptions and case classes used by ConsumerGroupCommand rewritten in java. The goal of PR is to reduce main PR size. Co-authored-by: Taras Ledkov <tledkov@apache.org> Reviewers: Mickael Maison <mickael.maison@gmail.com>, Taras Ledkov <tledkov@apache.org>, Justine Olshan <jolshan@confluent.io>
This PR is part of #14471
It contains
ConsumerGroupCommandOptionsand case classes used byConsumerGroupCommandrewritten in java.The goal of PR is to reduce main PR size.
Committer Checklist (excluded from commit message)