Skip to content

Conversation

@shibd
Copy link
Member

@shibd shibd commented Sep 20, 2022

Motivation

apache/pulsar-client-cpp#90

Modifications

  • Add acknowledge message id list API.

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Matching PR in forked repository

shibd#13

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 20, 2022
@BewareMyPower BewareMyPower added component/client-c++ type/feature The PR added a new feature or issue requested a new feature ready-to-test labels Sep 21, 2022
@BewareMyPower
Copy link
Contributor

Could you rebase to master? I saw some strange errors in CI.

@shibd
Copy link
Member Author

shibd commented Sep 21, 2022

Could you rebase to master? I saw some strange errors in CI.

I rebased master, PTAL.

Comment on lines 933 to 937
this->ackGroupingTrackerPtr_->addAcknowledgeList(messageIdList);
for (const auto& messageId : messageIdList) {
this->unAckedMessageTrackerPtr_->remove(messageId);
this->batchAcknowledgementTracker_.deleteAckedMessage(messageId, proto::CommandAck::Individual);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add thread safe remove and deleteAckedMessage methods that accept MessageIdList to make these calls thread safe. You can see both UnAckedMessageTrackerEnabled::remove and BatchAcknowledgementTracker::deleteAckedMessage are thread safe so the acknowledgeAsync method for a single message won't lead to a race condition for each component (unAckedMessageTrackerPtr_ and unAckedMessageTrackerPtr_)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

for MessageIdList{
     this->unAckedMessageTrackerPtr_->remove(msgId);
}

and another thread to call: this->unAckedMessageTrackerPtr_->add(msgId);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I add new remove(MessageIdList) method on UnAckedMessageTracker, Since BatchAcknowledgementTracker not support Individual ack, so, I remove invoke this->batchAcknowledgementTracker_.deleteAckedMessage code. PTAL. Thanks.

@shibd
Copy link
Member Author

shibd commented Oct 7, 2022

Resubmit the PR in pulsar-client-cpp repository: apache/pulsar-client-cpp#23

@shibd shibd closed this Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test type/feature The PR added a new feature or issue requested a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants