-
Notifications
You must be signed in to change notification settings - Fork 14.8k
KAFKA-19875 Duplicated topic config prevents broker start #20844
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
base: trunk
Are you sure you want to change the base?
KAFKA-19875 Duplicated topic config prevents broker start #20844
Conversation
ConfigDef.ValidList.anyNonDuplicateValuesConfigDef.ValidList.anyNonDuplicateValues and clearify the update.html section
ConfigDef.ValidList.anyNonDuplicateValues and clearify the update.html sectionConfigDef.ValidList.anyNonDuplicateValues and clearify the update.html KIP-1161 section
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 cover the case have one element is empty string in List like ("a", "", "a") and ("a", "", "c"). It’s possible, for example: bootstrap.servers=localhost:9091,,localhost:9092 (Two consecutive commas; this would result in List.of(localhost:9091, "", "localhost:9092")
And for completeness, should this kind of case be clarified in KIP?
ConfigDef.ValidList.anyNonDuplicateValues and clearify the update.html KIP-1161 section
junrao
left a comment
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 the PR. A couple of comments.
| return result; | ||
| } | ||
|
|
||
| protected boolean allowDuplicateValueInList() { |
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.
Hmm, this is kind of weird. An AbstractConfig can have multiple configs of List type, some of which allow duplicate and some others don't. How do we support that?
I was thinking that we could change the implementation of getList(String key). We could get the validator for that key from the configDef and remove duplicates if the validator doesn't allow duplicates.
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.
Using the allowDuplicateValueInList tag isn’t a good approach. I think we can change it to check whether key.validator is an instance of ValidList in parseValue. For the LogConfig.validate method, it should directly call the ConfigDef.parse method instead of using getList().
| <li>Null values are no longer accepted for most LIST-type configurations, except those that explicitly | ||
| allow a null default value or where a null value has a well-defined semantic meaning.</li> | ||
| <li>Duplicate entries within the same list are no longer permitted.</li> | ||
| <li>Most LIST-type configurations no longer accept duplicate entries, except in cases where duplicates |
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.
- Should we change ValidList.ensureValid() to only log a warning for duplicated values?
- The following makes the generated "Valid Values" in html quite verbose. It would be useful to improve that. For example, if empty is not allowed, we probably don't need to say it. If empty is allowed, we could add "empty".
public String toString() {
return validString + (isEmptyAllowed ? " (empty config allowed)" : " (empty not allowed)") +
(isNullAllowed ? " (null config allowed)" : " (null not allowed)");
}
Also, "Valid Values" for anyNonDuplicateValues will show up as [], which is counter intuitive.
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.
Should we change ValidList.ensureValid() to only log a warning for duplicated values?
I think we can keep the exception-throwing behavior, but we now preprocess the user’s configuration to remove duplicate entries.
The following makes the generated "Valid Values" in html quite verbose.



Add new test case for
ConfigDef.ValidList.anyNonDuplicateValues(false, false)and clearify the update.html sectionFYI: #20334 (comment)