jolshan commented on code in PR #15087:
URL: https://github.com/apache/kafka/pull/15087#discussion_r1458143630


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -1188,18 +1073,7 @@ class ReplicaManager(val config: KafkaConfig,
       requestLocal: RequestLocal,
       verificationErrors: Map[TopicPartition, Errors]
     ): Unit = {
-      // Map transaction coordinator errors to known errors for the response
-      val convertedErrors = verificationErrors.map { case (tp, error) =>
-        error match {
-          case Errors.CONCURRENT_TRANSACTIONS |
-            Errors.COORDINATOR_LOAD_IN_PROGRESS |
-            Errors.COORDINATOR_NOT_AVAILABLE |
-            Errors.NOT_COORDINATOR => tp -> Errors.NOT_ENOUGH_REPLICAS
-          case _ => tp -> error
-        }
-
-      }

Review Comment:
   We have separate handling for produce requests and txn offset commit 
requests.
   
   for produce:
   
   ```
                 case Errors.INVALID_TXN_STATE => 
Some(error.exception("Partition was not added to the transaction"))
                 case Errors.CONCURRENT_TRANSACTIONS |
                      Errors.COORDINATOR_LOAD_IN_PROGRESS |
                      Errors.COORDINATOR_NOT_AVAILABLE |
                      Errors.NOT_COORDINATOR => Some(new 
NotEnoughReplicasException(
                   s"Unable to verify the partition has been added to the 
transaction. Underlying error: ${error.toString}"))
                 case _ => None
    ```
   
   
   for txn offset commit: 
   
   ```
       error match {
         case Errors.UNKNOWN_TOPIC_OR_PARTITION
              | Errors.NOT_ENOUGH_REPLICAS
              | Errors.NOT_ENOUGH_REPLICAS_AFTER_APPEND =>
           Errors.COORDINATOR_NOT_AVAILABLE
   
         case Errors.NOT_LEADER_OR_FOLLOWER
              | Errors.KAFKA_STORAGE_ERROR =>
           Errors.NOT_COORDINATOR
   
         case Errors.MESSAGE_TOO_LARGE
              | Errors.RECORD_LIST_TOO_LARGE
              | Errors.INVALID_FETCH_SIZE =>
           Errors.INVALID_COMMIT_OFFSET_SIZE
   
         // We may see INVALID_TXN_STATE or INVALID_PID_MAPPING here due to 
transaction verification.
         // They can be returned without mapping to a new error.
         case other => other
       }
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to