ableegoldman opened a new pull request #8900:
URL: https://github.com/apache/kafka/pull/8900


   If there's any pending data and we haven't flushed the producer when we 
abort a transaction, a KafkaException is returned for the previous `send`. This 
is a bit misleading, since the situation is not an unrecoverable error and so 
the Kafka Exception is really non-fatal. For now, we should just catch and 
swallow this in the RecordCollector (see also: 
[KAFKA-10169](https://issues.apache.org/jira/browse/KAFKA-10186))
   
   The reason we ended up aborting an un-flushed transaction was due to the 
combination of
   a. always aborting the ongoing transaction when any task is closed/revoked
   b. only committing (and flushing) if at least one of the revoked tasks needs 
to be committed
   
   Given the above, we can end up with an ongoing transaction that isn't 
committed since none of the revoked tasks have any data in the transaction. We 
then abort the transaction anyway, when those tasks are closed. So in addition 
to the above (swallowing this exception), we should avoid unnecessarily 
aborting data for tasks that haven't been revoked.
   
   We can handle this by splitting the RecordCollector's `close` into a dirty 
and clean flavor: if dirty, we need to abort the transaction since it may be 
dirty due to the commit attempt failing. But if clean, we can skip aborting the 
transaction since we know that either we just committed and thus there is no 
ongoing transaction to abort, or else the transaction in flight contains no 
data from the tasks being closed


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