Skip to content

[fix][broker] Fix ManagedLedgerImpl.advanceCursorsIfNecessary() method may lose non-durable cursor properties in race condition#25796

Merged
nodece merged 6 commits into
apache:masterfrom
oneby-wang:advance_cursors_mark_delete_properties
May 18, 2026
Merged

[fix][broker] Fix ManagedLedgerImpl.advanceCursorsIfNecessary() method may lose non-durable cursor properties in race condition#25796
nodece merged 6 commits into
apache:masterfrom
oneby-wang:advance_cursors_mark_delete_properties

Conversation

@oneby-wang
Copy link
Copy Markdown
Contributor

Motivation

This is a follow-up to #25165 for the same class of race condition, covering ManagedLedgerImpl.advanceCursorsIfNecessary() and non-durable cursor properties.

ManagedLedgerImpl.advanceCursorsIfNecessary() method may lose non-durable cursor mark-delete properties in a race condition.

When advanceCursorsIfNecessary() advances a non-durable cursor while another markDelete() call with properties is in progress, passing the cursor current properties can capture stale properties and later overwrite the user-provided mark-delete properties.

Modifications

  1. Add testAdvanceCursorsIfNecessaryNeverLoseProperties() test to reproduce the issue.
  2. Pass null to asyncMarkDelete() method properties param in advanceCursorsIfNecessary() method, so the cursor uses the latest properties when the mark-delete is applied.
  3. Run test to verify the code change.

Verifying this change

  • Make sure that the change passes the CI checks.

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

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: oneby-wang#32

Copy link
Copy Markdown
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for fixing @oneby-wang

@nodece nodece merged commit dd94626 into apache:master May 18, 2026
43 checks passed
Technoboy- pushed a commit that referenced this pull request May 20, 2026
…d may lose non-durable cursor properties in race condition (#25796)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants