ableegoldman commented on a change in pull request #9280:
URL: https://github.com/apache/kafka/pull/9280#discussion_r487336115



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java
##########
@@ -418,10 +419,14 @@ private boolean maybeSendAndPollTransactionalRequest() {
 
         if (transactionManager.hasAbortableError() || 
transactionManager.isAborting()) {
             if (accumulator.hasIncomplete()) {
+                // Attempt to get the last error that caused this abort.
                 RuntimeException exception = transactionManager.lastError();
+                // If there was no error, but we are still aborting,
+                // then this is most likely a case where there was no fatal 
error.
                 if (exception == null) {
-                    exception = new KafkaException("Failing batch since 
transaction was aborted");
+                    exception = new TransactionAbortedException();
                 }
+                // Since the transaction is aborted / being aborted, abort all 
the undrained batches.

Review comment:
       This comment might be unnecessary, the code is pretty self-explanatory 
in this case 🙂 




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