ijuma commented on code in PR #18414:
URL: https://github.com/apache/kafka/pull/18414#discussion_r1912503825


##########
core/src/main/scala/kafka/server/KafkaConfig.scala:
##########
@@ -637,21 +637,12 @@ class KafkaConfig private(doLog: Boolean, val props: 
util.Map[_, _])
     if (nodeId != brokerId) {
       throw new ConfigException(s"You must set 
`${KRaftConfigs.NODE_ID_CONFIG}` to the same value as 
`${ServerConfigs.BROKER_ID_CONFIG}`.")
     }
-    if (requiresZookeeper) {
-      if (zkConnect == null) {
-        throw new ConfigException(s"Missing required configuration 
`${ZkConfigs.ZK_CONNECT_CONFIG}` which has no default value.")
-      }
-      if (brokerIdGenerationEnable) {
-        require(brokerId >= -1 && brokerId <= maxReservedBrokerId, "broker.id 
must be greater than or equal to -1 and not greater than 
reserved.broker.max.id")
-      } else {
-        require(brokerId >= 0, "broker.id must be greater than or equal to 0")
-      }
-    } else {
-      // KRaft-based metadata quorum
-      if (nodeId < 0) {
-        throw new ConfigException(s"Missing configuration 
`${KRaftConfigs.NODE_ID_CONFIG}` which is required " +
-          s"when `process.roles` is defined (i.e. when running in KRaft 
mode).")
-      }
+    if (processRoles.isEmpty) {

Review Comment:
   You can define a config with no default value and it would automatically 
fail if it's not set. This kind of special logic is only needed for more 
complex cases.



-- 
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