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-16181: Use incrementalAlterConfigs when updating broker configs by kafka-configs.sh #15304

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

dengziming
Copy link
Member

More detailed description of your change
This PR implement KIP-1011, use incrementalAlterConfigs by default to alter broker configurations instead of the deprecated alterConfigs API, and fall back to deprecated alterConfigs API if the broker doesn't support incrementalAlterConfigs API.

Summary of testing strategy (including rationale)

  1. Add some test cases to verify the new approach.
  2. TODO, we can't verify the automatic process because we can't produce UnsupportedVersionException by setting inter.broker.protocol.version

Committer Checklist (excluded from commit message)

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

Copy link
Contributor

@OmniaGM OmniaGM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I left few small comments

core/src/main/scala/kafka/admin/ConfigCommand.scala Outdated Show resolved Hide resolved
@@ -405,7 +420,7 @@ object ConfigCommand extends Logging {
val alterOptions = new AlterConfigsOptions().timeoutMs(30000).validateOnly(false)
val alterLogLevelEntries = (configsToBeAdded.values.map(new AlterConfigOp(_, AlterConfigOp.OpType.SET))
++ configsToBeDeleted.map { k => new AlterConfigOp(new ConfigEntry(k, ""), AlterConfigOp.OpType.DELETE) }
).asJavaCollection
).asJavaCollection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change maybe not needed!

@@ -349,7 +349,7 @@ object ConfigCommand extends Logging {
}

@nowarn("cat=deprecation")
private[admin] def alterConfig(adminClient: Admin, opts: ConfigCommandOptions): Unit = {
private[admin] def alterConfig(adminClient: Admin, opts: ConfigCommandOptions, useIncrementalAlterConfigs: Boolean): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't we set useIncrementalAlterConfigs to true as default specially as I can see that later we set it with true any way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I added a case of updating broker configs with useIncrementalAlterConfigs=false, also add a case of updating topic configs which only support incrementalAlterConfigs.

"--entity-type", "brokers",
"--entity-default")
), true)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see any tests for useIncrementalAlterConfigs set to false. Can we test this path as well if possible?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case doesn't make sense because we can't produce UnsupportedVersionException by setting inter.broker.protocol.version, so I'm waiting for help from other reviewers, and just leave it unchanged for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dengziming One option would be to mock the admin client. This would allow you to verify the behavior. Otherwise, we could also run the tool against an old version in a system test.

@mimaison mimaison added the kip Requires or implements a KIP label Feb 2, 2024
@dengziming dengziming force-pushed the KAFKA-16181 branch 2 times, most recently from 115573d to 659cb08 Compare February 23, 2024 09:43
@dengziming
Copy link
Member Author

@dajac Hello, this PR is ready for review except the upgrade docs, PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kip Requires or implements a KIP
Projects
None yet
4 participants