junrao commented on code in PR #21065:
URL: https://github.com/apache/kafka/pull/21065#discussion_r2673763604
##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java:
##########
@@ -1132,7 +1156,7 @@ void abortBatches(final RuntimeException reason) {
dq.remove(batch);
}
batch.abort(reason);
- deallocate(batch);
+ completeBatchAndDeallocate(batch);
Review Comment:
> Given that Producer.send throws an AuthorizationException when the
TxnManager is in a fatal state, and the standard recommendation is to close the
producer immediately for such unrecoverable errors, the practical risk should
be minimal
It's true that Producer.send throws an AuthorizationException when the
TxnManager is in a fatal state. However, the record will first be added to the
batch buffer in RecordAccumulator and then aborted by Sender. Adding to the
RecordAccumulator can cause the buffer reuse issue.
> I think the only concern I had is whether a message could be sent to a
partition and read by a consumer
I think that the record with the wrong data could be sent to a partition.
Since the TxnManager is in a fatal state, the wrong record will probably be
aborted on the server side eventually? If the consumer is in transactional
mode, it won't see the wrong record. However, if the consumer is in
non-transactional mode, it will see it.
--
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]