From bd9b50f36aaf200028108e05e1f7cd15b4c955d2 Mon Sep 17 00:00:00 2001 From: Qiang Zhao Date: Fri, 10 Nov 2023 19:14:39 +0800 Subject: [PATCH] [fix][ml] Fix unfinished callback when deleting managed ledger (#21530) --- .../bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java index a2bc84728cc0f..0879bbe1cb15c 100644 --- a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java +++ b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java @@ -848,7 +848,10 @@ public void asyncDelete(String name, DeleteLedgerCallback callback, Object ctx) // If it's open, delete in the normal way ml.asyncDelete(callback, ctx); }).exceptionally(ex -> { - // If it's failing to get open, just delete from metadata + // If it fails to get open, it will be cleaned by managed ledger opening error handling. + // then retry will go to `future=null` branch. + final Throwable rc = FutureUtil.unwrapCompletionException(ex); + callback.deleteLedgerFailed(getManagedLedgerException(rc), ctx); return null; }); }