GeezerVison is showing github.com — [fix][broker] Move pending acks cleanup to selected mark-delete callbacks by nodece · Pull Request #25592 · apache/pulsar
Conversation
nodece
commented
Apr 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Motivation
Pending-ack cleanup was previously executed in the readMoreEntries dispatch path. This introduced unnecessary overhead in a hot path and also risked concurrent access to the same pending-ack entries from both dispatch and ack threads.
Cleanup is only required when messages are removed through mark-delete advancing operations such as expiry, skip, or clear-backlog. Ack-triggered mark-delete operations are much more frequent and should avoid carrying additional cleanup work.
Modifications
-
Introduced atomic remaining-unacked tracking for both non-batch and batch messages.
PendingAcksMap now stores and updates the actual remainingUnacked count instead of relying on batch size–based accounting.
- Added atomic helper methods such as
updateRemainingUnacked and removePendingAckAndGet to simplify and centralize unacked-message accounting.
- Removed legacy logic that recalculated unacked counts from cursor state or batch size.
-
Refactored pending-ack cleanup to leverage the existing markDeletePositionMoveForward hook.
-
Removed pending-ack cleanup from the readMoreEntries dispatch path.
-
Cleanup of pending acks and redelivery state is now triggered only after mark-delete advancement operations such as:
- message expiry
- skip entries
- clear backlog
-
Ack-triggered paths do not invoke markDeletePositionMoveForward; they continue using afterAckMessages to avoid additional overhead on the high-frequency ack path.
-
Updated pending-ack iteration and removal paths to consistently use the maintained remainingUnacked count directly, improving correctness and concurrency handling for partial batch acknowledgments.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nodece
added a commit
to ascentstream/pulsar
that referenced
this pull request
May 27, 2026
This was referenced Oct 17, 2026
This was referenced Nov 6, 2026
nodece
added a commit
to ascentstream/pulsar
that referenced
this pull request
Nov 16, 2026
Reviewers
lhotari
lhotari approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|