C0urante opened a new pull request #11508:
URL: https://github.com/apache/kafka/pull/11508


   Some types of exceptions that the producer reports are encountered 
synchronously during a call to `KafkaProducer::send`, but reported 
asynchronously via the resulting `Future` instead of being thrown directly from 
the call to `send`. One common example of this is when the size of a record 
exceeds the client-side `max.message.bytes` configuration property; when that 
happens, a failed future is returned immediately from `KafkaProducer::send`.
   
   This is all fine, but the current behavior does not take into account the 
guarantees surrounding the transactional producer's `commitTransaction` method, 
which are that:
   > ...if any of the `send(ProducerRecord)` calls which were part of the 
transaction hit irrecoverable errors, this method will throw the last received 
exception immediately and the transaction will not be committed. So all 
`send(ProducerRecord)` calls in a transaction must succeed in order for this 
method to succeed.
   
   The changes in this PR cause producers to fail on `commitTransaction` if any 
prior calls to `send` resulted in one of these aynchronously-reported, 
synchronously-encountered exceptions.
   
   An alternative approach could be to throw these exceptions directly to the 
caller in `send`, but that would alter producer behavior for all users instead 
of just ones using transactional producers; that tradeoff seems less desirable 
just to fix an issue that only affects transactional producers.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


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