GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@nodece nodece commented Apr 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions
@nodece
[fix][broker] Move pending acks cleanup to selected mark-delete callb…
79241e2
…acks
@nodece nodece mentioned this pull request Apr 28, 2026
[improve][broker] Centralize mark-delete position change handling #25571
Closed
lhotari
lhotari reviewed Apr 28, 2026
View reviewed changes
Comment thread ...rc/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Dispatcher.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

lhotari
lhotari reviewed Apr 28, 2026
View reviewed changes
Comment thread .../java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

nodece added 4 commits April 29, 2026 12:18
@nodece
Address comment
17710af
@nodece
Remove comment out
83ad9bc
@nodece
Fix testAckWithTransactionReduceUnackCountNotInPendingAcks
9744dd0
@nodece
Move markDeletePositionMoveForward call to afterAckMessages callback
6a2ba72
@nodece
nodece requested a review from lhotari April 29, 2026 11:55
@lhotari lhotari mentioned this pull request Apr 29, 2026
Address remaining gap in pending acks cleanup for BacklogQuotaManager #25613
Closed
lhotari
lhotari approved these changes Apr 29, 2026
View reviewed changes

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

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.

LGTM, follow up issue #25613

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodece
nodece merged commit 138595f into apache:master Apr 29, 2026
82 of 84 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nodece
nodece deleted the move-pending-acks-cleanup branch April 29, 2026 15:19
@nodece nodece mentioned this pull request Apr 30, 2026
[fix][broker] Close pending acks cleanup gap in BacklogQuotaManager #25624
Merged
@lhotari lhotari added this to the 4.3.0 milestone Apr 30, 2026
@lhotari lhotari added release/4.1.4 release/4.2.2 release/4.0.11 labels Apr 30, 2026
@lhotari lhotari mentioned this pull request Apr 30, 2026
[Bug] Key_Shared (PIP-379): pending-acks cleanup on mark-delete advance can break ordering #25627
Open
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request May 6, 2026
@nodece @poorbarcode
[fix][broker] Move pending acks cleanup to selected mark-delete callb…
52a09eb
…acks (apache#25592)
Technoboy- added a commit that referenced this pull request May 12, 2026
@Technoboy-
[fix][broker] Move pending acks cleanup to selected mark-delete callb…
c08b1e9
…acks (#25592)
@Technoboy- Technoboy- added the cherry-picked/branch-4.2 label May 12, 2026
@Technoboy- Technoboy- assigned nodece May 12, 2026
lhotari pushed a commit that referenced this pull request May 13, 2026
@nodece @lhotari
[fix][broker] Move pending acks cleanup to selected mark-delete callb…
4330c2f
…acks (#25592)

(cherry-pick from commit 138595f)
@lhotari lhotari added the cherry-picked/branch-4.0 label May 13, 2026
nodece added a commit to ascentstream/pulsar that referenced this pull request May 27, 2026
@nodece
[fix][broker] Move pending acks cleanup to selected mark-delete callb…
5c2245c
…acks (apache#25592)

(cherry-pick from commit 138595f)

Signed-off-by: Zixuan Liu <[email protected]>
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 9, 2026
@nodece @priyanshu-ctds
[fix][broker] Move pending acks cleanup to selected mark-delete callb…
b100b0f
…acks (apache#25592)

(cherry-pick from commit 138595f)

(cherry picked from commit 4330c2f)
This was referenced Oct 17, 2026
[fix][broker] Fix acked count calculation when acknowledging with transaction #25049
Closed
[fix] [broker] Fix negative subscription/consumer's unack-messages #24496
Closed
[Bug] Unnecessary calling of "removing consumer.pendindAcks" when cursor being reading more entries #24746
Closed
This was referenced Nov 6, 2026
[fix][broker] Release pending acks for fully acknowledged batches #27406
Merged
[fix][broker] Release pending acks when a replicated subscription update moves mark-delete #27415
Merged
[fix][broker] Release pending acks when persisting an expiry mark-delete fails #27416
Merged
nodece added a commit to ascentstream/pulsar that referenced this pull request Nov 16, 2026
@nodece
[fix][broker] Move pending acks cleanup to selected mark-delete callb…
7ab1b4d
…acks (apache#25592)

(cherry-pick from commit 138595f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lhotari lhotari lhotari approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@nodece nodece

Labels

cherry-picked/branch-4.0 cherry-picked/branch-4.2 release/4.0.11 release/4.1.4 release/4.2.2

Projects

None yet

Milestone

5.0.0-M1

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@nodece @lhotari @Technoboy-
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.