cmccabe commented on a change in pull request #9012:
URL: https://github.com/apache/kafka/pull/9012#discussion_r453883350



##########
File path: core/src/main/scala/kafka/server/KafkaApis.scala
##########
@@ -2425,34 +2427,68 @@ class KafkaApis(val requestChannel: RequestChannel,
 
   def handleAlterConfigsRequest(request: RequestChannel.Request): Unit = {
     val alterConfigsRequest = request.body[AlterConfigsRequest]
-    val (authorizedResources, unauthorizedResources) = 
alterConfigsRequest.configs.asScala.toMap.partition { case (resource, _) =>
+    val requestResources = alterConfigsRequest.configs.asScala.toMap
+
+    def sendResponseCallback(results: Map[ConfigResource, ApiError]): Unit = {
+      def responseCallback(requestThrottleMs: Int): AlterConfigsResponse = {
+        val data = new AlterConfigsResponseData()
+          .setThrottleTimeMs(requestThrottleMs)
+        results.foreach { case (resource, error) =>
+          data.responses().add(new AlterConfigsResourceResponse()
+            .setErrorCode(error.error.code)
+            .setErrorMessage(error.message)
+            .setResourceName(resource.name)
+            .setResourceType(resource.`type`.id))
+        }
+        new AlterConfigsResponse(data)
+      }
+      sendResponseMaybeThrottle(request, responseCallback)
+    }
+
+    if (!controller.isActive) {
+      // This is the original forwarded request which needs the handling.

Review comment:
       This seems like a confusing comment.  How about "forward the request to 
the controller for handling"?
   
   Also, we usually try to avoid `return` in KafkaApis unless it's really 
necessary.  I guess it's a Scala style thing.




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

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


Reply via email to