hachikuji commented on a change in pull request #10157: URL: https://github.com/apache/kafka/pull/10157#discussion_r579707786
########## File path: core/src/main/scala/kafka/server/AlterIsrManager.scala ########## @@ -165,9 +165,19 @@ class DefaultAlterIsrManager( new ControllerRequestCompletionHandler { override def onComplete(response: ClientResponse): Unit = { debug(s"Received AlterIsr response $response") - val body = response.responseBody().asInstanceOf[AlterIsrResponse] val error = try { - handleAlterIsrResponse(body, message.brokerEpoch, inflightAlterIsrItems) + if (response.authenticationException != null) { + // For now we treat authentication errors as retriable. We use the + // `NETWORK_EXCEPTION` error code for lack of a good alternative. + // Note that `BrokerToControllerChannelManager` will still log the + // authentication errors so that users have a chance to fix the problem. + Errors.NETWORK_EXCEPTION + } else if (response.versionMismatch != null) { Review comment: It's a good suggestion. I think what we want is for `ClientResponse` to expose something like `Either[AbstractResponse, Exception]`. This would prevent bugs like this in the future since it forces the code to unwrap the response. I'm willing to give it a shot here, but I suspect it will cause a much bigger diff. My intent here was to try and keep the PR small so that we could get it into 2.8. Let me know what you think. ---------------------------------------------------------------- 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