junrao commented on code in PR #21065:
URL: https://github.com/apache/kafka/pull/21065#discussion_r2651603565


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java:
##########
@@ -1132,7 +1150,7 @@ void abortBatches(final RuntimeException reason) {
                 dq.remove(batch);
             }
             batch.abort(reason);
-            deallocate(batch);
+            deallocateWithoutReuse(batch);

Review Comment:
   I don't think this change is needed. To send a batch in a request, we need 
to drain it from the accumulator first. So, if a batch is in the accumulator, 
it means that there is no inflight request for this batch. The batch could have 
been sent in a request before and is added back to the accumulator for retry. 
But from the perspective of deallocate, as long as there is no inflight request 
for the batch, we can reclaim the buffer associated with the batch safely. 
Ditto for the change below.



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

Reply via email to