Repository navigation
[fix][ml] Propagate cursor ledger deletion failures - #26734
Merged
Merged
Conversation
Complete the returned future exceptionally when cursor ledger deletion fails. Add regression coverage for metadata deletion errors, successful deletion, and missing ledgers. Assisted-by: Codex
void-ptr974
approved these changes
Sep 28, 2026
ascentstream-bot
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Oct 1, 2026
Co-authored-by: zhanghao <[email protected]> (cherry picked from commit 0e75593)
ascentstream-bot
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Oct 2, 2026
Co-authored-by: zhanghao <[email protected]> (cherry picked from commit 0e75593)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
When deleting a managed ledger that is not open in the factory,
ManagedLedgerFactoryImpl.deleteCursor()returns a separate future that is completed only by the cursor metadata removal callbacks.If BookKeeper fails to delete the cursor ledger with an error other than a missing-ledger error, the deletion stage completes exceptionally and the following
thenRun()is skipped. The returned future remains incomplete because the failure is not propagated to it.For example, with a single cursor, a metadata deletion error reported as
ZKExceptionpreventsasyncDelete()from invoking either callback. The synchronousdelete()can consequently remain blocked on its latch.Modifications
thenRun()stage to the future returned bydeleteCursor().Verifying this change
[fix][ml] Propagate cursor ledger deletion failures zhanghaou/pulsar#8
This change adds tests in
ManagedLedgerFactoryTest:ZKExceptionerror code for cursor ledger deletion and verify that the failure reaches the caller while cursor metadata remains intact.The failure regression was run against the unpatched implementation and failed with a timeout while waiting for the deletion callback. With the fix, all 6 test invocations in
ManagedLedgerFactoryTestpass.The failure is injected through Mock BookKeeper; the test does not disconnect a live ZooKeeper service.
Local validation passed:
./gradlew :managed-ledger:test \ --tests "org.apache.bookkeeper.mledger.impl.ManagedLedgerFactoryTest" \ -PtestRetryCount=0 ./gradlew quickCheckDoes this pull request potentially affect one of the following parts: