BewareMyPower commented on code in PR #321:
URL: https://github.com/apache/pulsar-client-cpp/pull/321#discussion_r1338367787


##########
lib/ConsumerImpl.cc:
##########
@@ -1165,6 +1164,9 @@ bool 
ConsumerImpl::isCumulativeAcknowledgementAllowed(ConsumerType consumerType)
 
 std::pair<MessageId, bool> ConsumerImpl::prepareIndividualAck(const MessageId& 
messageId) {
     auto messageIdImpl = Commands::getMessageIdImpl(messageId);
+    if (std::dynamic_pointer_cast<ChunkMessageIdImpl>(messageIdImpl)) {
+        return std::make_pair(messageId, true);

Review Comment:
   Why not fall through to the following if branch?
   
   ```c++
       auto batchedMessageIdImpl = 
std::dynamic_pointer_cast<BatchedMessageIdImpl>(messageIdImpl);
   
       auto batchSize = messageId.batchSize();
       if (!batchedMessageIdImpl || 
batchedMessageIdImpl->ackIndividual(messageId.batchIndex())) {
           consumerStatsBasePtr_->messageAcknowledged(ResultOk, 
CommandAck_AckType_Individual,
                                                      (batchSize > 0) ? 
batchSize : 1);
           unAckedMessageTrackerPtr_->remove(messageId);
           possibleSendToDeadLetterTopicMessages_.remove(messageId);
   ```
   
   We can check if it's a `ChunkmessageIdImpl` before returning so that we 
won't call `discardBatch` on a `ChunkmessageIdImpl`.



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