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


##########
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:
   There are two overloaded `failBatch` methods. the one with the redundant 
argument is the second definition 
   
   ```java
   private void failBatch(
           ProducerBatch batch,
           RuntimeException topLevelException,
           boolean adjustSequenceNumbers,
           boolean deallocateBatch
       )
   ```
   
   ```java
       private void failBatch(ProducerBatch batch,
                              ProduceResponse.PartitionResponse response,
                              boolean adjustSequenceNumbers,
                              boolean deallocateBatch)
   ```



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