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][ml] Fix active cursor position tracking after untracking by Denovo1998 · Pull Request #26629 · apache/pulsar

Conversation

@Denovo1998

@Denovo1998 Denovo1998 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Motivation

When ActiveManagedCursorContainerImpl flushes an updateCursor(cursor, null) or add(cursor, null) operation, it removes the cursor from position tracking but retains its old position. Subsequent queries can return stale ranks, and restoring a position can leave the cursor detached or incorrectly linked. Repeated null updates can also attempt to unlink an already-untracked node and corrupt the remaining list.

This fixes a pre-existing container correctness issue identified while reviewing #26511. Normal broker deactivation uses removeCursor(), so these tests do not establish a failure in that production path.

Modifications

  • Clear the stored position when incremental processing removes a node from position tracking.
  • Clear the position and both list links when a rebuild excludes an untracked cursor, allowing subsequent incremental insertion.
  • Only schedule removal for nodes with a tracked position, making null updates safe for already-untracked and never-tracked nodes.
  • Add regression tests covering incremental and rebuild paths, repeated untracking, and restoration through both add() and real cursor seek callbacks.

Verifying this change

  • Make sure that the change passes the CI checks.

The new tests start real ZooKeeper and BookKeeper services and create managed ledgers and cursors through ManagedLedgerFactoryImpl, without mocking cursors or containers. Null untracking is invoked through the container API; seek-based restoration exercises ManagedCursorImpl → ManagedLedgerImpl → the active cursor container.

All 14 new cases fail on the unpatched implementation with incorrect rank or slowest-position results. After the fix, all 73 cases across the three container test classes pass. quickCheck also passes locally.

./gradlew :managed-ledger:test \
  --tests ActiveManagedCursorContainerUntrackingTest \
  --tests ActiveManagedCursorContainerTest \
  --tests ActiveManagedCursorContainerRetentionTest \
  -PtestRetryCount=0 -PtestFailFast=false

./gradlew quickCheck

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@Denovo1998
[fix][ml] Fix active cursor position tracking after untracking
07586c3
lhotari
lhotari reviewed Sep 17, 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.

Thanks for catching this and fixing the cursor untracking state and covering both flush paths and restoration. The fix looks sound; I have one suggestion to keep the container regression tests lightweight.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...test/java/org/apache/bookkeeper/mledger/impl/ActiveManagedCursorContainerUntrackingTest.java Resolved

Uh oh!

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

@Denovo1998
consolidate active cursor untracking tests in ManagedLedgerBkTest
fa36be2
@Denovo1998
Denovo1998 requested a review from lhotari September 17, 2026 14:38
@Denovo1998
Merge apache/pulsar master into fix-active-cursor-untracking
8564e4b
lhotari
lhotari approved these changes Sep 17, 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. The 14 lightweight container cases and the separate seek regression pass locally. Please also refresh the PR’s verification description and test command to reflect this split; it still says all new tests start real services.

Sorry, something went wrong.

Uh oh!

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

All reactions
@lhotari lhotari added this to the 5.0.0 milestone Sep 17, 2026
@lhotari lhotari added release/4.2.5 release/4.0.14 labels Sep 17, 2026
@lhotari
lhotari merged commit 467159e into apache:master Sep 17, 2026
43 checks passed

Uh oh!

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

@Denovo1998
Denovo1998 deleted the fix-active-cursor-untracking branch September 18, 2026 00:04
dao-jun pushed a commit to ascentstream/pulsar that referenced this pull request Sep 20, 2026
@Denovo1998 @dao-jun
[fix][ml] Fix active cursor position tracking after untracking (apach…
90f73fe
…e#26629)

(cherry picked from commit 467159e)
dao-jun pushed a commit to ascentstream/pulsar that referenced this pull request Sep 20, 2026
@Denovo1998 @dao-jun
[fix][ml] Fix active cursor position tracking after untracking (apach…
3f6093b
…e#26629)

(cherry picked from commit 467159e)
dao-jun pushed a commit to ascentstream/pulsar that referenced this pull request Sep 20, 2026
@Denovo1998 @dao-jun
[fix][ml] Fix active cursor position tracking after untracking (apach…
5f96571
…e#26629)

(cherry picked from commit 467159e)
lhotari pushed a commit that referenced this pull request Sep 23, 2026
@Denovo1998 @lhotari
[fix][ml] Fix active cursor position tracking after untracking (#26629)
b15171f
(cherry picked from commit 467159e)
@lhotari lhotari added cherry-picked/branch-4.2 and removed release/4.0.14 labels Sep 23, 2026
@dao-jun dao-jun mentioned this pull request Oct 4, 2026
[feat][ml] Port batch read and managed-ledger cache improvements (PIP-430) on BK 4.17.4.1 ascentstream/pulsar#105
Closed
Radiancebobo pushed a commit to Radiancebobo/pulsar that referenced this pull request Oct 8, 2026
@Denovo1998 hechengbo
[fix][ml] Fix active cursor position tracking after untracking (apach…
6e38520
…e#26629)
@nodece nodece mentioned this pull request Oct 13, 2026
[feat][ml] Port batch read and managed-ledger cache improvements (PIP-430) on BK 4.17.4.1 (ml-only subset) ascentstream/pulsar#106
Closed
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Oct 13, 2026
@Denovo1998 @nodece
[fix][ml] Fix active cursor position tracking after untracking (apach…
c2f7b56
…e#26629)

(cherry picked from commit 467159e)
(cherry picked from commit 5f96571)
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

No one assigned

Labels

cherry-picked/branch-4.2 release/4.2.5

Projects

None yet

Milestone

5.0.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

2 participants

@Denovo1998 @lhotari
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.