ahuang98 commented on code in PR #21053:
URL: https://github.com/apache/kafka/pull/21053#discussion_r2729783271
##########
core/src/main/scala/kafka/server/ControllerConfigurationValidator.scala:
##########
@@ -44,7 +47,33 @@ import scala.collection.mutable
* in the same RPC, BROKER_LOGGER is not really a dynamic configuration in the
same sense
* as the others. It is not persisted to the metadata log.
*/
-class ControllerConfigurationValidator(kafkaConfig: KafkaConfig) extends
ConfigurationValidator {
+class ControllerConfigurationValidator(kafkaConfig: KafkaConfig)
+ extends ConfigurationValidator with DynamicConfigValidator {
+ private val validConfigsByType: Map[ConfigResource.Type, util.Set[String]] =
{
+ val topicConfigs = LogConfig.nonInternalConfigNames.asScala.toSet
+ val brokerConfigs = DynamicConfig.Broker.names.asScala.toSet
+ val clientMetricsConfigs =
ClientMetricsConfigs.configDef().names.asScala.toSet
+ val groupConfigs = GroupConfig.configDef().names.asScala.toSet
+ // Quota configs can be used with different resource types, so we include
them for all types
+ val allQuotaConfigs =
QuotaConfig.scramMechanismsPlusUserAndClientQuotaConfigs().names.asScala ++
+
QuotaConfig.userAndClientQuotaConfigs().names.asScala ++
+ QuotaConfig.ipConfigs.names.asScala
+
+ Map(
+ ConfigResource.Type.TOPIC -> (topicConfigs ++ allQuotaConfigs).asJava,
+ ConfigResource.Type.BROKER -> (brokerConfigs ++ allQuotaConfigs).asJava,
+ ConfigResource.Type.CLIENT_METRICS -> (clientMetricsConfigs ++
allQuotaConfigs).asJava,
+ ConfigResource.Type.GROUP -> (groupConfigs ++ allQuotaConfigs).asJava
+ )
+ }
+
+ override def isValidConfig(resourceType: ConfigResource.Type, configName:
String): Boolean = {
Review Comment:
you're lacking tests for this new method!
--
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]