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-10033: Throw UnknownTopicOrPartitionException when modifying a non-existent topic's config #8717

Closed
wants to merge 2 commits into from

Conversation

bdbyrne
Copy link
Contributor

@bdbyrne bdbyrne commented May 22, 2020

Committer Checklist (excluded from commit message)

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

@bdbyrne
Copy link
Contributor Author

bdbyrne commented May 22, 2020

@cmccabe this is ready for review.

The test location doesn't quite fit as it's in the module test dynamic config changes on the broker, but it's "near" the old error. Any ideas on where it might be better situated?

@@ -454,6 +454,9 @@ class AdminManager(val config: KafkaConfig,
private def alterTopicConfigs(resource: ConfigResource, validateOnly: Boolean,
configProps: Properties, configEntriesMap: Map[String, String]): (ConfigResource, ApiError) = {
val topic = resource.name
if (!metadataCache.contains(topic))
throw new UnknownTopicOrPartitionException(s"The topic '$topic' does not exist.")

adminZkClient.validateTopicConfig(topic, configProps)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems not all checks in validateTopicConfig are required.

  1. Topic.validate(topic) -> the topic is validated already as the topic is created
  2. if (!zkClient.topicExists(topic)) -> it is replaced by if (!metadataCache.contains(topic))
  3. LogConfig.validate(configs) -> this should be reserved

In short, should we remove adminZkClient.validateTopicConfig(topic, configProps) and then add LogConfig.validate(configs)?

Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm, the following changeTopicConfig checks the topic name and configs again. Not sure why there are such duplicate checks.

Copy link
Contributor

@omkreddy omkreddy Jun 4, 2020

Choose a reason for hiding this comment

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

yeah, there is lot scope for cleanup. we can improve in future PRs.

Copy link
Contributor

@abbccdda abbccdda 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 @bdbyrne, I'm curious why we don't consider fixing the AdminZkClient#validateTopicConfig thrown exception type, but fix its caller instead. And in fact we have two callers for that path as well, so maybe a more comprehensive fix is to fix AdminZkClient IIUC.

@bdbyrne
Copy link
Contributor Author

bdbyrne commented Jun 1, 2020

Thanks for the PR @bdbyrne, I'm curious why we don't consider fixing the AdminZkClient#validateTopicConfig thrown exception type, but fix its caller instead. And in fact we have two callers for that path as well, so maybe a more comprehensive fix is to fix AdminZkClient IIUC.

Hi @abbccdda -- there is a fix for the AdminZkClient at #8715. This PR can be seen as an alternative/supplement in the case that changing the exception has other ramifications. I'm fine with dropping this if you feel the other PR is better.

@omkreddy
Copy link
Contributor

omkreddy commented Jun 4, 2020

@bdbyrne Can you rebase the PR?

@omkreddy
Copy link
Contributor

omkreddy commented Jun 5, 2020

ok to test

@omkreddy
Copy link
Contributor

omkreddy commented Jun 5, 2020

retest this please

1 similar comment
@omkreddy
Copy link
Contributor

omkreddy commented Jun 5, 2020

retest this please

@bdbyrne
Copy link
Contributor Author

bdbyrne commented Jun 5, 2020

retest this please

1 similar comment
@omkreddy
Copy link
Contributor

omkreddy commented Jun 6, 2020

retest this please

@omkreddy
Copy link
Contributor

omkreddy commented Jun 6, 2020

ok to test

Copy link
Contributor

@omkreddy omkreddy left a comment

Choose a reason for hiding this comment

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

@bdbyrne Thanks for the PR. LGTM.

@omkreddy omkreddy closed this in dd7c036 Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants