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


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:
##########
@@ -749,12 +759,16 @@ private void completeBatch(ProducerBatch batch, 
ProduceResponse.PartitionRespons
 
         if (batch.complete(response.baseOffset, response.logAppendTime)) {
             maybeRemoveAndDeallocateBatch(batch);
+        } else {
+            // Always safe to call dellocate because the batch keeps track of 
whether or not it was deallocated yet
+            this.accumulator.deallocateAlreadyRemovedIncomplete(batch);
         }
     }
 
     private void failBatch(ProducerBatch batch,
                            ProduceResponse.PartitionResponse response,
-                           boolean adjustSequenceNumbers) {
+                           boolean adjustSequenceNumbers,
+                           boolean deallocateBatch) {

Review Comment:
   The following call passes in deallocateBatch as false.
   
   `failExpiredBatches(expiredInflightBatches, now, false);`



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