k-raina opened a new pull request, #19656:
URL: https://github.com/apache/kafka/pull/19656

   ## Problem
   When an `txnProducer.abortTransaction()`operation encounters a 
`TRANSACTION_ABORTABLE` error, it currently tries to transition to 
`ABORTABLE_ERROR` state. This can create an infinite retry loop since:
   1. The abort operation fails with `TRANSACTION_ABORTABLE`
   2. We transition to `ABORTABLE_ERROR` state
   3. The application recieves instance of TransactionAbortableException and it 
retries the abort
   4. The cycle repeats
   
   ## Solution
   For `txnProducer.abortTransaction()`API,  convert `TRANSACTION_ABORTABLE` 
errors to fatal errors (`KafkaException`) during abort operations to ensure 
clean transaction termination. This prevents retry loops by:
   1. Treating abort failures as fatal errors at application layer
   2. Ensuring the transaction can be cleanly terminated
   3. Providing clear error messages to the application
   
   ## Changes
   - Modified `EndTxnHandler.handleResponse()` to convert 
`TRANSACTION_ABORTABLE` errors to `KafkaException` during abort operations
   - Set TransactionManager state to FATAL
   - Updated test `testAbortableErrorIsConvertedToFatalErrorDuringAbort` to 
verify this behavior
   
   ## Testing
   - Added test case verifying that abort operations convert 
`TRANSACTION_ABORTABLE` errors to `KafkaException`
       - Verified that Commit API with TRANSACTION_ABORTABLE error should set 
TM to Abortable state
       - Verified that Abort API with TRANSACTION_ABORTABLE error should 
convert to Fatal error i.e. KafkaException
   
   ## Impact
   At application layer, this change improves transaction reliability by 
preventing infinite retry loops during abort operations.


-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to