Skip to content

[fix][broker] Fix compaction cursor reset may lose mark-delete properties#25862

Merged
lhotari merged 2 commits into
apache:masterfrom
oneby-wang:reset_curosr_mark_delete_properties
May 25, 2026
Merged

[fix][broker] Fix compaction cursor reset may lose mark-delete properties#25862
lhotari merged 2 commits into
apache:masterfrom
oneby-wang:reset_curosr_mark_delete_properties

Conversation

@oneby-wang

Copy link
Copy Markdown
Contributor

Motivation

This is a follow-up to #25165, #25796, and #25803 for the same class of mark-delete properties race condition, covering ManagedCursorImpl.internalResetCursor() for the compaction cursor.

ManagedCursorImpl.internalResetCursor() may lose compaction cursor mark-delete properties in a race condition.

When compaction cursor reset persists a mark-delete position while another asyncMarkDelete() call with properties is in progress, passing the cursor current properties can capture stale properties and later overwrite the compaction mark-delete properties, such as CompactedTopicLedger.

Modifications

  1. Add testCompactionCursorResetNeverLoseMarkDeleteProperties() test to reproduce the issue.
  2. Pass null to internalAsyncMarkDelete() for compaction cursor reset, so the cursor uses the latest properties when the mark-delete is applied.
  3. Run test to verify the code change.

Verifying this change

  • ./gradlew :managed-ledger:test --tests org.apache.bookkeeper.mledger.impl.ManagedCursorTest.testCompactionCursorResetNeverLoseMarkDeleteProperties

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

@oneby-wang

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@lhotari lhotari merged commit 9b15504 into apache:master May 25, 2026
81 of 83 checks passed
lhotari pushed a commit that referenced this pull request Jun 1, 2026
lhotari pushed a commit that referenced this pull request Jun 1, 2026
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 9, 2026
…ties (apache#25862)

(cherry picked from commit 9b15504)
(cherry picked from commit a7cb7e8)
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.

2 participants