k-raina commented on code in PR #19522:
URL: https://github.com/apache/kafka/pull/19522#discussion_r2069651376
##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java:
##########
@@ -1073,6 +1074,11 @@ private void transitionTo(State target, RuntimeException
error) {
} else if (target == State.FATAL_ERROR || target ==
State.ABORTABLE_ERROR) {
if (error == null)
throw new IllegalArgumentException("Cannot transition to " +
target + " with a null exception");
+
+ if (error instanceof RetriableException) {
+ error = new TransactionAbortableException("Transaction Request
was aborted after exhausting retries.", error);
+ }
+
Review Comment:
@jolshan
IIUC, Following is codepath which handles Retriable exceptions as Abortable
1. SenderThread calls `TM.handleFailedBatch()` after retries are exhausted
[[Code
Link](https://github.com/k-raina/kafka/blob/90e7b53799ce0e5cd9a79cec03e5db6ef5643391/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java#L667-L688)]
2. `TM.handleFailedBatch()` calls `TM.maybeTransitionToErrorState()` which
checks for exception types and calls `TM.transitionToAbortableError()` for non
fatal type exceptions
3. Finally `TM.transitionToAbortableError` calls
`TM.transitionTo(State.ABORTABLE_ERROR, ..)` which sets state as Abortable
--
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]