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] Close pending acks cleanup gap in BacklogQuotaManager by nodece · Pull Request #25624 · apache/pulsar

Conversation

@nodece

@nodece nodece commented Apr 30, 2026

Copy link
Copy Markdown
Member

Fix #25613

Motivation

PR #25592 added Dispatcher#markDeletePositionMoveForward() to clean up pending acks and redelivery state when cursors advance via subscription-level APIs (skip, expiry, clear-backlog).

However, BacklogQuotaManager bypasses these APIs and directly updates ManagedCursor, so the hook is not triggered in two eviction paths:

  • Size eviction: ManagedCursor.skipEntries
  • Time eviction (non-precise): ManagedCursor.markDelete

This leads to stale state in Key_Shared subscriptions:

  • pendingAcks not cleaned up
  • unackedMessages drift

Modifications

  • BacklogQuotaManager
    • Add helper to trigger Dispatcher#markDeletePositionMoveForward
    • Invoke after cursor advancement in:
      • size eviction
      • time eviction (non-precise)
    • Extract eviction math into shared methods:
      • computeEvictionTarget
      • computeEntriesToEvict

Sorry, something went wrong.

Uh oh!

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

All reactions
@nodece
[fix][broker] Close pending acks cleanup gap in BacklogQuotaManager
29f25ba
@nodece
nodece requested a review from lhotari April 30, 2026 04:52
@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 approved these changes Apr 30, 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

Sorry, something went wrong.

Uh oh!

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

nodece reacted with rocket emoji
All reactions
  • 🚀 1 reaction
@nodece
nodece merged commit d861e15 into apache:master Apr 30, 2026
81 of 83 checks passed

Uh oh!

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

@nodece
nodece deleted the backlog-quota-manager-pending-acks-cleanup branch April 30, 2026 07:19
This was referenced Apr 30, 2026
[Bug] Key_Shared (PIP-379): pending-acks cleanup on mark-delete advance can break ordering #25627
Open
[fix][test] Fix flaky BacklogQuotaManagerTest.createNamespaces (HTTP 409 cascade) #25680
Merged
lhotari added a commit to lhotari/pulsar that referenced this pull request May 5, 2026
@lhotari
[fix][test] Fix flaky BacklogQuotaManagerTest.createNamespaces (HTTP …
6f792e5
…409 cascade)

Two `BacklogQuotaManagerTest` cases consistently fail together: an
`@AfterMethod` `clearNamespaces` times out at 10s while force-deleting
`prop/ns-quota`, leaving the namespace in metadata; the next test's
`@BeforeMethod` `createNamespaces` then hits HTTP 409 ("Namespace already
exists") and the cascade continues for every subsequent test.

Root cause: PR apache#25624 added two pending-acks tests that leave Key_Shared
consumers with unacked messages on `prop/ns-quota` and an active
backlog-quota check loop running every 2s. Force-deleting that state can
exceed the 10s default `Awaitility` budget used by the shared
`MockedPulsarServiceBaseTest.deleteNamespaceWithRetry`. The afterMethod
times out, leftover metadata remains, and the next beforeMethod hits 409.

Fix:
1. `MockedPulsarServiceBaseTest.deleteNamespaceWithRetry` now uses
   `atMost(20, SECONDS)` instead of relying on the Awaitility 10s
   default. 2× headroom is enough for the heaviest cleanups in this
   class while staying conservative for the many tests that share this
   helper.
2. `BacklogQuotaManagerTest.createNamespaces` is split into a helper
   that catches `ConflictException` and recovers by force-deleting the
   leftover and recreating, so a slow prior cleanup cannot cascade as a
   409 — defense in depth on top of (1).

Verified locally with `@Test(invocationCount = 10)` on the two new
pending-acks tests: 20/20 passes, all `clearNamespaces` cycles within
the new 20s budget.
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request May 6, 2026
@nodece @poorbarcode
[fix][broker] Close pending acks cleanup gap in BacklogQuotaManager (a…
2730dd2
…pache#25624)
Technoboy- added a commit that referenced this pull request May 12, 2026
@Technoboy-
[fix][broker] Close pending acks cleanup gap in BacklogQuotaManager (#…
2537ffc
…25624)
@Technoboy- Technoboy- assigned nodece May 12, 2026
@Technoboy- Technoboy- added the cherry-picked/branch-4.2 label May 12, 2026
lhotari pushed a commit that referenced this pull request May 13, 2026
@nodece @lhotari
[fix][broker] Close pending acks cleanup gap in BacklogQuotaManager (#…
e3419ce
…25624)

(cherry-pick from commit d861e15)
@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] Close pending acks cleanup gap in BacklogQuotaManager (a…
a86ae4b
…pache#25624)

(cherry-pick from commit d861e15)
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 9, 2026
@nodece @priyanshu-ctds
[fix][broker] Close pending acks cleanup gap in BacklogQuotaManager (a…
12d9f39
…pache#25624)

(cherry-pick from commit d861e15)

(cherry picked from commit e3419ce)
@lhotari lhotari mentioned this pull request Nov 6, 2026
[fix][broker] Release pending acks when a replicated subscription update moves mark-delete #27415
Merged
11 tasks
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.

Address remaining gap in pending acks cleanup for BacklogQuotaManager

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.