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


Reply via email to