Skip to content

[fix][client] Fix unAckedMessageTracker cleanup on multi-topics batch ack#26001

Open
Dream95 wants to merge 1 commit into
apache:masterfrom
Dream95:fix_multi-topics-consumer-batch-ack-tracker
Open

[fix][client] Fix unAckedMessageTracker cleanup on multi-topics batch ack#26001
Dream95 wants to merge 1 commit into
apache:masterfrom
Dream95:fix_multi-topics-consumer-batch-ack-tracker

Conversation

@Dream95

@Dream95 Dream95 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Motivation

This fixes a bug in MultiTopicsConsumerImpl.doAcknowledge(List<MessageId>, ...).
When batch acknowledging messages across multiple topics, the success callback used
messageIdList.forEach(unAckedMessageTracker::remove) instead of
messageIds.forEach(unAckedMessageTracker::remove). As a result, after one underlying
consumer ack succeeded, all messages in the batch were removed from
unAckedMessageTracker, including messages that had not yet been acked by other consumers.

Modifications

  • In MultiTopicsConsumerImpl.doAcknowledge(List<MessageId>, ...), remove only the per-consumer
    messageIds from unAckedMessageTracker after a successful ack.
  • Add testBatchAcknowledgeRemovesOnlyAckedMessageIdsFromTracker to verify that completing one
    consumer's batch ack leaves the other consumer's message in the tracker.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

./gradlew :pulsar-client-original:test --tests org.apache.pulsar.client.impl.MultiTopicsConsumerImplTest.testBatchAcknowledgeRemovesOnlyAckedMessageIdsFromTracker

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

… ack

Signed-off-by: Dream95 <zhou_8621@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant