-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker] PulsarLedgerManager to pass correct error code to BK client #16664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -893,7 +893,19 @@ private void deleteManagedLedgerData(BookKeeper bkc, String managedLedgerName, M | |
| DeleteLedgerCallback callback, Object ctx) { | ||
| Futures.waitForAll(info.ledgers.stream() | ||
| .filter(li -> !li.isOffloaded) | ||
| .map(li -> bkc.newDeleteLedgerOp().withLedgerId(li.ledgerId).execute()) | ||
| .map(li -> bkc.newDeleteLedgerOp().withLedgerId(li.ledgerId).execute() | ||
| .handle((result, ex) -> { | ||
| if (ex != null) { | ||
| int rc = BKException.getExceptionCode(ex); | ||
| if (rc == BKException.Code.NoSuchLedgerExistsOnMetadataServerException | ||
| || rc == BKException.Code.NoSuchLedgerExistsException) { | ||
| log.info("Ledger {} does not exist, ignoring", li.ledgerId); | ||
| return null; | ||
| } | ||
| throw new CompletionException(ex); | ||
| } | ||
| return result; | ||
| })) | ||
| .collect(Collectors.toList())) | ||
| .thenRun(() -> { | ||
| // Delete the metadata | ||
|
|
@@ -921,7 +933,20 @@ private CompletableFuture<Void> deleteCursor(BookKeeper bkc, String managedLedge | |
|
|
||
| // Delete the cursor ledger if present | ||
| if (cursor.cursorsLedgerId != -1) { | ||
| cursorLedgerDeleteFuture = bkc.newDeleteLedgerOp().withLedgerId(cursor.cursorsLedgerId).execute(); | ||
| cursorLedgerDeleteFuture = bkc.newDeleteLedgerOp().withLedgerId(cursor.cursorsLedgerId) | ||
| .execute() | ||
| .handle((result, ex) -> { | ||
| if (ex != null) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about looking for NotFoundException in the exception chain ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not work, in this case PulsarLedgerManager returns NotFoundException to Bookkeeper's code which remaps it into UnexpectedConditionException for the pulsar callback. |
||
| int rc = BKException.getExceptionCode(ex); | ||
| if (rc == BKException.Code.NoSuchLedgerExistsOnMetadataServerException | ||
| || rc == BKException.Code.NoSuchLedgerExistsException) { | ||
| log.info("Ledger {} does not exist, ignoring", cursor.cursorsLedgerId); | ||
| return null; | ||
| } | ||
| throw new CompletionException(ex); | ||
| } | ||
| return result; | ||
| }); | ||
| } else { | ||
| cursorLedgerDeleteFuture = CompletableFuture.completedFuture(null); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.