hachikuji commented on a change in pull request #9311:
URL: https://github.com/apache/kafka/pull/9311#discussion_r501170471



##########
File path: core/src/main/scala/kafka/server/KafkaApis.scala
##########
@@ -2083,8 +2083,8 @@ class KafkaApis(val requestChannel: RequestChannel,
       def sendResponseCallback(error: Errors): Unit = {
         def createResponse(requestThrottleMs: Int): AbstractResponse = {
           val finalError =
-            if (endTxnRequest.version < 2 && error == Errors.PRODUCER_FENCED) {
-              // For older clients, they could not understand the new 
PRODUCER_FENCED error code,
+            if (maybeReturnOldClientError(error, endTxnRequest.version)) {

Review comment:
       nit: I am not sure this helper is worthwhile because it only works if 
the versions are aligned consistently. That is true as of now, but likely 
untrue in the future. Explicit version checks for each api would be safer.

##########
File path: core/src/main/scala/kafka/server/KafkaApis.scala
##########
@@ -2336,6 +2335,11 @@ class KafkaApis(val requestChannel: RequestChannel,
     }
   }
 
+  def maybeReturnOldClientError(error: Errors, requestVersion: Short): Boolean 
= {
+    requestVersion < 2 && (error == Errors.PRODUCER_FENCED || error == Errors

Review comment:
       @abbccdda clarified offline that the version has already been bumped for 
2.7, so this is not needed.




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