showuon commented on a change in pull request #10794: URL: https://github.com/apache/kafka/pull/10794#discussion_r642743186
########## 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: Nice catch! Thanks. -- 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