Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cumulative acknowledgement on batched acknowledgements produce unexpected behavior #4931

Closed
epsteina16 opened this issue Aug 9, 2019 · 3 comments
Labels
area/client lifecycle/stale type/bug The PR fixed a bug or issue reported a bug

Comments

@epsteina16
Copy link

Describe the bug
When the messages in a topic are batched, cumulative acknowledgments do not acknowledge messages as expected. Two behaviors arise when acknowledging a message in the middle of a batch:

  1. A cumulative acknowledgment for the current message is not sent, instead, an individual acknowledgment for the previous message in the batch is sent.
  2. If the consumer disconnects and reconnects at this point, the cursor picks up at the next batch instead of at the last acked message.

To Reproduce
Steps to reproduce the behavior:

  1. Add messages to a topic with batching enabled
  2. Create a consumer on the topic with ackGroupTime set to 0.
  3. When a message is received, expose the underlying BatchMessageIdImpl on the MessageId to know where the message is in a batch.
  4. If the message is in the middle of a batch, call a cumulative ack on it, then on return close the consumer and restart it on the same subscription.

Expected behavior
The pulsar consumer should send a cumulative acknowledgement for the correct message id. On disconnect, when a cumulative acknowledgment has been sent for a message in the middle of a batch, the consumer should start receiving messages from that point, not from the next batch.

Desktop (please complete the following information):

  • OS: linux
@epsteina16 epsteina16 added the type/bug The PR fixed a bug or issue reported a bug label Aug 9, 2019
@Lanayx
Copy link
Contributor

Lanayx commented Dec 4, 2019

I want to add a similar behaviour:
Let's say we have 10 messages in a batch sent by some producer, also we have MaxRedeliverCount is 1. Consumer acked 9 messages and 1 nacked.
Current behaviour
All 10 messages will be redelivered which will lead to double processing of 9 messages.
Expected behavior
Only 1 message should be redelivered

@sijie
Copy link
Member

sijie commented Jul 28, 2020

I think this issue can be addressed by batch-index level acknowledgment. @codelipenghui can double-check.

@tisonkun
Copy link
Member

Closed as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/client lifecycle/stale type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

No branches or pull requests

5 participants