codelipenghui commented on a change in pull request #6052: [PIP-54] Support 
acknowledgment at batch index level
URL: https://github.com/apache/pulsar/pull/6052#discussion_r380620936
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java
 ##########
 @@ -219,7 +226,8 @@ public ChannelPromise sendMessages(final List<Entry> 
entries, EntryBatchSizes ba
         }
 
         // reduce permit and increment unackedMsg count with total number of 
messages in batch-msgs
-        MESSAGE_PERMITS_UPDATER.addAndGet(this, -totalMessages);
+        int ackedCount = batchIndexesAcks == null ? 0 : 
batchIndexesAcks.getTotalAckedIndexCount();
+        MESSAGE_PERMITS_UPDATER.addAndGet(this, ackedCount - totalMessages);
 
 Review comment:
   The batch size can greater than available permits and already handled at the 
client size.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to