Skip to content

[WIP] KAFKA-19112 Unifying LIST-Type Configuration Validation and Default Values #20334

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

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

Conversation

m1a2st
Copy link
Collaborator

@m1a2st m1a2st commented Aug 10, 2025

We add the three main changes in this PR

  • Disallowing null values for most LIST-type configurations makes sense,
    since users cannot explicitly set a configuration to null in a
    properties file. Therefore, only configurations with a default value of
    null should be allowed to accept null.
  • Disallowing duplicate values is reasonable, as there are currently no
    known configurations in Kafka that require specifying the same value
    multiple times. Allowing duplicates is both rare in practice and
    potentially confusing to users.
  • Disallowing empty list, even though many configurations currently
    accept them. In practice, setting an empty list for several of these
    configurations can lead to server startup failures or unexpected
    behavior. Therefore, enforcing non-empty lists helps prevent
    misconfiguration and improves system robustness.
    These changes may introduce some backward incompatibility, but this
    trade-off is justified by the significant improvements in safety,
    consistency, and overall user experience.

Additionally, we introduce two minor adjustments:

  • Reclassify some STRING-type configurations as LIST-type, particularly
    those using comma-separated values to represent multiple entries. This
    change reflects the actual semantics used in Kafka.
  • Update the default values for some configurations to better align with
    other configs.
    These changes will not introduce any compatibility issues.

@m1a2st
Copy link
Collaborator Author

m1a2st commented Aug 11, 2025

The HeaderFrom fields configuration should allow duplicate values. Therefore, its default value should be NO_DEFAULT_VALUE, and its validator should be new NonEmptyListValidator().

Please refer this testcase:

@m1a2st
Copy link
Collaborator Author

m1a2st commented Aug 11, 2025

The bootstrap.servers configuration requires further discussion. If we set its default value to NO_DEFAULT_VALUE and use the validator ConfigDef.ValidList.anyNonDuplicateValues(false, false), initialization will fail because the default value does not pass the validator. One possible solution is to update the default value to List.of("localhost:9092").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant