Skip to content

Conversation

@m1a2st
Copy link
Collaborator

@m1a2st m1a2st commented Nov 7, 2025

Add new test case for ConfigDef.ValidList.anyNonDuplicateValues(false, false) and clearify the update.html section

FYI: #20334 (comment)

@github-actions github-actions bot added triage PRs from the community tests Test fixes (including flaky tests) clients small Small PRs labels Nov 7, 2025
@m1a2st m1a2st changed the title MINOR Add test case for ConfigDef.ValidList.anyNonDuplicateValues MINOR Add test case for ConfigDef.ValidList.anyNonDuplicateValues and clearify the update.html section Nov 8, 2025
@m1a2st m1a2st changed the title MINOR Add test case for ConfigDef.ValidList.anyNonDuplicateValues and clearify the update.html section MINOR Add test case for ConfigDef.ValidList.anyNonDuplicateValues and clearify the update.html KIP-1161 section Nov 8, 2025
Copy link
Collaborator

@Yunyung Yunyung Nov 9, 2025

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?

@github-actions github-actions bot removed the triage PRs from the community label Nov 10, 2025
@github-actions github-actions bot added core Kafka Broker storage Pull requests that target the storage module labels Nov 10, 2025
@m1a2st m1a2st changed the title MINOR Add test case for ConfigDef.ValidList.anyNonDuplicateValues and clearify the update.html KIP-1161 section KAFKA-19875 Duplicated topic config prevents broker start Nov 13, 2025
Copy link
Contributor

@junrao junrao 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 the PR. A couple of comments.

return result;
}

protected boolean allowDuplicateValueInList() {
Copy link
Contributor

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.

Copy link
Collaborator Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Should we change ValidList.ensureValid() to only log a warning for duplicated values?
  2. 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.

Copy link
Collaborator Author

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.

I have updated the document
asdfsfd
sdaf
dlfsakfds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients connect core Kafka Broker tests Test fixes (including flaky tests) tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants