You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/05/31 15:27:11 UTC

[GitHub] [kafka] dengziming commented on a change in pull request #10794: KAFKA-12677: parse envelope response to check if not_controller error existed

dengziming commented on a change in pull request #10794:
URL: https://github.com/apache/kafka/pull/10794#discussion_r642556841



##########
File path: core/src/main/scala/kafka/server/BrokerToControllerChannelManager.scala
##########
@@ -363,6 +386,22 @@ class BrokerToControllerRequestThread(
     }
   }
 
+  def maybeCheckNotControllerErrorInsideEnvelopeResponse(requestHeader: RequestHeader, responseBody: AbstractResponse): Boolean = {
+    if (responseBody.isInstanceOf[EnvelopeResponse] && requestHeader != null) {
+      info(s"Trying to find NOT_CONTROLLER exception inside envelope response")
+      val envelopeResponse = responseBody.asInstanceOf[EnvelopeResponse]
+      val envelopeError = envelopeResponse.error()
+
+      if (envelopeError == Errors.NONE) {
+        val response = AbstractResponse.parseResponse(envelopeResponse.responseData, requestHeader)
+        envelopeResponse.responseData().rewind()
+        return response.errorCounts().containsKey(Errors.NOT_CONTROLLER)
+      }
+    }
+
+    false;

Review comment:
       nit: unnecessary `;`

##########
File path: core/src/main/scala/kafka/server/BrokerToControllerChannelManager.scala
##########
@@ -363,6 +386,22 @@ class BrokerToControllerRequestThread(
     }
   }
 
+  def maybeCheckNotControllerErrorInsideEnvelopeResponse(requestHeader: RequestHeader, responseBody: AbstractResponse): Boolean = {

Review comment:
       How about move this to `ForwardingManager` since the envelopResponse and envelopRequest are all in `ForwardingManager`




-- 
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:
users@infra.apache.org