You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "poorbarcode (via GitHub)" <gi...@apache.org> on 2023/03/16 12:29:47 UTC

[GitHub] [pulsar] poorbarcode commented on a diff in pull request #19825: [fix] [ml] make the result of delete cursor is success if cursor is deleted

poorbarcode commented on code in PR #19825:
URL: https://github.com/apache/pulsar/pull/19825#discussion_r1138579140


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/MetaStoreImpl.java:
##########
@@ -301,11 +302,17 @@ public void asyncRemoveCursor(String ledgerName, String cursorName, MetaStoreCal
                     }
                     callback.operationComplete(null, null);
                 }, executor.chooseThread(ledgerName))
-                .exceptionally(ex -> {
+                .exceptionallyAsync(ex -> {
+                    Throwable actEx = FutureUtil.unwrapCompletionException(ex);
+                    if (actEx instanceof MetadataStoreException.NotFoundException){
+                        log.info("[{}] [{}] cursor delete done because it did not exist.", ledgerName, cursorName);
+                        callback.operationComplete(null, null);
+                        return null;
+                    }
                     executor.executeOrdered(ledgerName, SafeRunnable.safeRun(() -> callback
                             .operationFailed(getException(ex))));
                     return null;
-                });
+                }, executor.chooseThread(ledgerName));

Review Comment:
   Good suggestion, fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org