-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-17374: add bootstrap.controller to kafka-reassign-partitions.sh #16964
Conversation
this PR should wait for PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m1a2st thanks for this patch. please add IT
@@ -83,6 +84,13 @@ public ReassignPartitionsCommandOptions(String[] args) { | |||
.withRequiredArg() | |||
.describedAs("brokerlist") | |||
.ofType(String.class); | |||
|
|||
bootstrapControllerOpt = parser.accepts("bootstrap-controller", "The controller to use for reassignment. " + | |||
"By default, the tool will get the controller from the broker.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tool will get the controller from the broke
this description is not correct. The controller is "quorum controller" rather than "broker controller"
@@ -29,7 +29,7 @@ | |||
|
|||
@Timeout(60) | |||
public class ReassignPartitionsCommandArgsTest { | |||
public static final String MISSING_BOOTSTRAP_SERVER_MSG = "Please specify --bootstrap-server"; | |||
public static final String MISSING_BOOTSTRAP_SERVER_MSG = "Please specify either --bootstrap-server"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change the error message in validate method, thus these error message should be changed
if (opts.options.has(opts.bootstrapServerOpt) && opts.options.has(opts.bootstrapControllerOpt))
CommandLineUtils.printUsageAndExit(opts.parser, "Please don't specify both --bootstrap-server and --bootstrap-controller");
else if (!opts.options.has(opts.bootstrapServerOpt) && !opts.options.has(opts.bootstrapControllerOpt))
CommandLineUtils.printUsageAndExit(opts.parser, "Please specify either --bootstrap-server or --bootstrap-controller");
else
bootstrapOpt = opts.options.has(opts.bootstrapServerOpt) ? opts.bootstrapServerOpt : opts.bootstrapControllerOpt;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m1a2st thanks for your patch. a couple of comments are waiting for you. PTAL
private static void validateBootstrapControllerNotSupportedAction(ReassignPartitionsCommandOptions opts) { | ||
if (opts.options.has(opts.bootstrapControllerOpt)) { | ||
if (opts.options.has(opts.verifyOpt) || opts.options.has(opts.executeOpt) || opts.options.has(opts.generateOpt)) { | ||
throw new UnsupportedOperationException("The --bootstrap-controller option is not supported with these action."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add the unsupported actions to the comment?
@@ -83,6 +84,13 @@ public ReassignPartitionsCommandOptions(String[] args) { | |||
.withRequiredArg() | |||
.describedAs("brokerlist") | |||
.ofType(String.class); | |||
|
|||
bootstrapControllerOpt = parser.accepts("bootstrap-controller", "The controller to use for reassignment. " + | |||
"By default, the tool will get the quorum controller.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the supported actions to the docs
@@ -129,7 +129,12 @@ public static void main(String[] args) { | |||
Properties props = opts.options.has(opts.commandConfigOpt) | |||
? Utils.loadProps(opts.options.valueOf(opts.commandConfigOpt)) | |||
: new Properties(); | |||
props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, opts.options.valueOf(opts.bootstrapServerOpt)); | |||
validateBootstrapControllerNotSupportedAction(opts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move this to validateAndParseArgs
?
@m1a2st could you please sync code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m1a2st Could you please test it on your local to make sure
…pache#16964) Reviewers: Chia-Ping Tsai <[email protected]>
Jira: issues.apache.org/jira/browse/KAFKA-17374
According to the KIP-919
kafka-reassign-partitions.sh
should support the--bootstrap-controller
argument.Committer Checklist (excluded from commit message)