FrankYang0529 commented on code in PR #21273:
URL: https://github.com/apache/kafka/pull/21273#discussion_r2734776678


##########
core/src/main/scala/kafka/server/DynamicBrokerConfig.scala:
##########
@@ -698,8 +698,20 @@ class DynamicLogConfig(logManager: LogManager) extends 
BrokerReconfigurable with
       }
     }
 
+    def validateCordonedLogDirs(): Unit = {
+      val logDirs = newConfig.logDirs()
+      val cordonedLogDirs = newConfig.cordonedLogDirs()
+      cordonedLogDirs.asScala.foreach(dir =>
+        if (!logDirs.contains(dir)) {
+          throw new ConfigException(ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG, 
cordonedLogDirs, s"Invalid entry in 
${ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG}: $dir" +

Review Comment:
   ```suggestion
             throw new 
ConfigException(ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG, cordonedLogDirs, 
s"Invalid entry in ${ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG}: $dir " +
   ```



##########
core/src/main/scala/kafka/server/KafkaConfig.scala:
##########
@@ -499,6 +499,17 @@ class KafkaConfig private(doLog: Boolean, val props: 
util.Map[_, _])
     advertisedListeners.filterNot(l => 
controllerListenerNames.contains(l.listener))
   }
 
+  def validateCordonedLogDirs(): Unit = {
+    val cordonedLogDirs = getList(ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG)
+    if (cordonedLogDirs.contains(ServerLogConfigs.CORDONED_LOG_DIRS_ALL)) {
+      require(cordonedLogDirs.size == 1, s"When 
${ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG} is set to 
${ServerLogConfigs.CORDONED_LOG_DIRS_ALL}, it must not contain other values")
+    } else {
+      for (cordonedLogDir <- cordonedLogDirs.asScala) {
+        require(logDirs().contains(cordonedLogDir), s"All entries in 
${ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG} must be included in 
${ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG}. Missing entry : $cordonedLogDir")

Review Comment:
   ```suggestion
           require(logDirs().contains(cordonedLogDir), s"All entries in 
${ServerLogConfigs.CORDONED_LOG_DIRS_CONFIG} must be included in 
${ServerLogConfigs.LOG_DIRS_CONFIG} or ${ServerLogConfigs.LOG_DIR_CONFIG}. 
Missing entry : $cordonedLogDir")
   ```



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