You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/08/12 11:28:24 UTC
[GitHub] [kafka] showuon commented on a change in pull request #11200: KAFKA-13192: Prevent inconsistent broker.id/node.id values
showuon commented on a change in pull request #11200:
URL: https://github.com/apache/kafka/pull/11200#discussion_r687624316
##########
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:
Do you think we can put this check into below else block for KRaft-based metadata quorum case only?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org