poorbarcode commented on code in PR #19825:
URL: https://github.com/apache/pulsar/pull/19825#discussion_r1142216563
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/MetaStoreImpl.java:
##########
@@ -301,11 +302,16 @@ public void asyncRemoveCursor(String ledgerName, String
cursorName, MetaStoreCal
}
callback.operationComplete(null, null);
}, executor.chooseThread(ledgerName))
- .exceptionally(ex -> {
- executor.executeOrdered(ledgerName,
SafeRunnable.safeRun(() -> callback
- .operationFailed(getException(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);
Review Comment:
Hi @AnonHxy
> I found that if we complete the callback here, the line1407 maybe fail and
retry because the cursorLedger will not exist
Multiple callbacks will be executed by the same thread, so there is no race
condition for the callback execution. So no retry will occur, it just prints a
warn log. see:
https://github.com/apache/pulsar/blob/5d2d61e298e337b93fb178da191bc41d311107c2/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java#L3214-L3220
> I wonder what's the affect if callbalck fail when the race condition
happens.
As mentioned in Motivation, topic deletion may fail.
When topic deletion fails, Pulsar will repair the topic as undeleted, but
this repair does not guarantee that all conditions are good (in other words,
trying to repair a topic that fails to be deleted cannot be fully trusted), so
when the topic is trying to delete, the best outcome is that the deletion
succeeds.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]