shibd commented on code in PR #17739:
URL: https://github.com/apache/pulsar/pull/17739#discussion_r977163674


##########
pulsar-client-cpp/lib/ConsumerImpl.cc:
##########
@@ -925,9 +926,21 @@ void ConsumerImpl::acknowledgeAsync(const MessageId& 
msgId, ResultCallback callb
     doAcknowledgeIndividual(msgId, cb);
 }
 
+void ConsumerImpl::acknowledgeAsync(const MessageIdList& messageIdList, 
ResultCallback callback) {
+    ResultCallback cb = std::bind(&ConsumerImpl::statsAckCallback, 
shared_from_this(), std::placeholders::_1,
+                                  callback, 
proto::CommandAck_AckType_Individual, messageIdList.size());
+    // Currently not supported batch message id individual index ack.
+    this->ackGroupingTrackerPtr_->addAcknowledgeList(messageIdList);
+    for (const auto& messageId : messageIdList) {
+        this->unAckedMessageTrackerPtr_->remove(messageId);
+        this->batchAcknowledgementTracker_.deleteAckedMessage(messageId, 
proto::CommandAck::Individual);
+    }

Review Comment:
   Yes, It is better to provide an accept `MessageIdList` method. I will 
provide it. 
   
   But I want to know what is the race condition for the actual scenario. For 
`UnAckedMessageTracker`, Will there be the following scenario?
   
   have a `MessageIdList`: {1, 2, 3, 4}
   
   on acknowledge thread:
   
   ``` c++
   for MessageIdList{
        this->unAckedMessageTrackerPtr_->remove(msgId);
   }
   ```
   
   and another thread to call: `this->unAckedMessageTrackerPtr_->add(msgId);`  
   
   



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