Skip to content
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

Merged
merged 16 commits into from
Oct 14, 2024

Conversation

m1a2st
Copy link
Contributor

@m1a2st m1a2st commented Aug 22, 2024

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)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@m1a2st
Copy link
Contributor Author

m1a2st commented Aug 22, 2024

this PR should wait for PR

@m1a2st m1a2st marked this pull request as draft August 22, 2024 13:09
@chia7712
Copy link
Member

@m1a2st Could you please rebase code to include #16644?

@chia7712 chia7712 marked this pull request as ready for review August 31, 2024 11:05
Copy link
Member

@chia7712 chia7712 left a 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.")
Copy link
Member

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";
Copy link
Member

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?

Copy link
Contributor Author

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;

Copy link
Member

@chia7712 chia7712 left a 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.");
Copy link
Member

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.")
Copy link
Member

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);
Copy link
Member

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?

@chia7712
Copy link
Member

@m1a2st could you please sync code?

@github-actions github-actions bot added the tools label Sep 29, 2024
Copy link
Member

@chia7712 chia7712 left a 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

@chia7712 chia7712 merged commit 203f323 into apache:trunk Oct 14, 2024
9 checks passed
tedyu pushed a commit to tedyu/kafka that referenced this pull request Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants