rondagostino commented on a change in pull request #11200:
URL: https://github.com/apache/kafka/pull/11200#discussion_r688014091



##########
File path: core/src/main/scala/kafka/server/KafkaConfig.scala
##########
@@ -1905,6 +1905,13 @@ class KafkaConfig(val props: java.util.Map[_, _], doLog: 
Boolean, dynamicConfigO
 
   @nowarn("cat=deprecation")
   private def validateValues(): Unit = {
+    val nodeIdValue = values.get(KafkaConfig.NodeIdProp).asInstanceOf[Int]
+    if (nodeIdValue >= 0) {
+      val brokerIdValue = 
values.get(KafkaConfig.BrokerIdProp).asInstanceOf[Int]
+      if (brokerIdValue != Defaults.BrokerId && brokerIdValue != nodeIdValue) {
+        throw new ConfigException(s"The values for broker.id ($brokerIdValue) 
and node.id ($nodeIdValue) must be the same if both are specified")
+      }
+    }

Review comment:
       Good question.  It's legal to set node.id for the ZooKeeper case, so I 
think this inconsistency check is applicable in all cases and should be done 
here, at the top.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to