dielhennr commented on a change in pull request #11141:
URL: https://github.com/apache/kafka/pull/11141#discussion_r679517755



##########
File path: core/src/main/scala/kafka/server/KafkaApis.scala
##########
@@ -2740,23 +2798,78 @@ class KafkaApis(val requestChannel: RequestChannel,
       }.toBuffer
     }.toMap
 
-    val (authorizedResources, unauthorizedResources) = configs.partition { 
case (resource, _) =>
-      resource.`type` match {
-        case ConfigResource.Type.BROKER | ConfigResource.Type.BROKER_LOGGER =>
-          authHelper.authorize(request.context, ALTER_CONFIGS, CLUSTER, 
CLUSTER_NAME)
-        case ConfigResource.Type.TOPIC =>
-          authHelper.authorize(request.context, ALTER_CONFIGS, TOPIC, 
resource.name)
-        case rt => throw new InvalidRequestException(s"Unexpected resource 
type $rt")
-      }
-    }
+    if (!request.isForwarded && config.usesSelfManagedQuorum) {
+      // If using KRaft, per broker config alterations should be validated on 
the broker that the config(s) is for before forwarding them to the controller
+      val results = configs.map { case (resource, alterConfigOps) =>
+        try {
+          if (resource.`type` == ConfigResource.Type.BROKER) {
+              // In ZK case, the old config is retrieved, altered then 
validated
+              // val persistentProps = if (perBrokerConfig) 
adminKRaftClient.fetchEntityConfig(ConfigType.Broker, brokerId.get.toString)
+              // else adminKRaftClient.fetchEntityConfig(ConfigType.Broker, 
ConfigEntityName.Default)
+              // val configProps = 
this.config.dynamicConfig.fromPersistentProps(persistentProps, perBrokerConfig)

Review comment:
       I am not sure if the old config is retrieved for the validation step in 
addition to the persisting step or just for the persisting step in a ZK 
cluster. Since these steps are coupled in the ZK case, it is hard to tell. It 
would be good to know if I need to get the old config for the validation step 
so that I can do it for the KRaft case.




-- 
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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to