[ https://issues.apache.org/jira/browse/KAFKA-7795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16737496#comment-16737496 ]
ASF GitHub Bot commented on KAFKA-7795: --------------------------------------- mumrah commented on pull request #6104: KAFKA-7795 Produce a ERROR log when duplicate config keys are found URL: https://github.com/apache/kafka/pull/6104 This change simply adds some formatted error logging if duplicate keys are found when parsing a Kafka config file. Since we use Properties (which blindly accepts duplicates), the validation must happen when the Properties instance is loaded from a file. No behavior changes here, just extra logging. If I edit the broker config like: ```diff diff --git a/config/server.properties b/config/server.properties index 898d8ebc28..593651fd33 100644 --- a/config/server.properties +++ b/config/server.properties @@ -133,4 +133,8 @@ zookeeper.connection.timeout.ms=6000 # The default value for this is 3 seconds. # We override this to 0 here as it makes for a better out-of-the-box experience for development and testing. # However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup. -group.initial.rebalance.delay.ms=0 \ No newline at end of file +group.initial.rebalance.delay.ms=0 + +zookeeper.connection.timeout.ms=7000 +zookeeper.connection.timeout.ms=8000 ``` It will produce the following error output at the top of the log: ``` [2019-01-08 15:25:44,892] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$) [2019-01-08 15:25:44,918] ERROR Duplicate config entries detected! Ignoring zookeeper.connection.timeout.ms 6000 Ignoring zookeeper.connection.timeout.ms 7000 (org.apache.kafka.common.utils.Utils) [2019-01-08 15:25:45,322] INFO starting (kafka.server.KafkaServer) ``` ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Produce a warning when duplicate config keys are detected > --------------------------------------------------------- > > Key: KAFKA-7795 > URL: https://issues.apache.org/jira/browse/KAFKA-7795 > Project: Kafka > Issue Type: Improvement > Components: config > Reporter: David Arthur > Priority: Minor > > It would be nice to perform some basic validation of the broker config > so that things aren't unexpectedly overwritten. > For example, > {code:java} > unclean.leader.election.enable=false > // many other lines of config > unclean.leader.election.enable=true > {code} > By detecting duplicate keys in the config file, we can inform users that > there is a config problem. > Note that this will not prevent the broker from starting, but rather it will > produce some log warnings. -- This message was sent by Atlassian JIRA (v7.6.3#76005)