mattisonchao commented on code in PR #21542:
URL: https://github.com/apache/pulsar/pull/21542#discussion_r1390081988
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -4052,33 +4051,39 @@ protected void asyncCreateLedger(BookKeeper bookKeeper,
ManagedLedgerConfig conf
));
} catch
(EnsemblePlacementPolicyConfig.ParseEnsemblePlacementPolicyConfigException e) {
log.error("[{}] Serialize the placement configuration failed",
name, e);
- cb.createComplete(Code.UnexpectedConditionException, null,
ledgerCreated);
+ cb.createComplete(Code.UnexpectedConditionException, null,
ledgerFutureHook);
return;
}
}
createdLedgerCustomMetadata = finalMetadata;
-
try {
bookKeeper.asyncCreateLedger(config.getEnsembleSize(),
config.getWriteQuorumSize(),
- config.getAckQuorumSize(), digestType,
config.getPassword(), cb, ledgerCreated, finalMetadata);
+ config.getAckQuorumSize(), digestType,
config.getPassword(), cb, ledgerFutureHook, finalMetadata);
} catch (Throwable cause) {
log.error("[{}] Encountered unexpected error when creating ledger",
name, cause);
- cb.createComplete(Code.UnexpectedConditionException, null,
ledgerCreated);
+ ledgerFutureHook.completeExceptionally(cause);
+ cb.createComplete(Code.UnexpectedConditionException, null,
ledgerFutureHook);
Review Comment:
**Off-topic discussion:**
I am curious why method `bookKeeper.asyncCreateLedger` will throw an
exception but not call the callback. How does the caller know whether a
callback is called or not?
--
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]