eolivelli commented on a change in pull request #12071:
URL: https://github.com/apache/pulsar/pull/12071#discussion_r718249013
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -320,9 +319,44 @@ public ManagedLedgerImpl(ManagedLedgerFactoryImpl factory,
BookKeeper bookKeeper
}
}
- synchronized void initialize(final ManagedLedgerInitializeLedgerCallback
callback, final Object ctx) {
+ synchronized void initialize(final ManagedLedgerInitializeLedgerCallback
originalCb, final Object ctx) {
log.info("Opening managed ledger {}", name);
+ ManagedLedgerInitializeLedgerCallback callback = new
ManagedLedgerInitializeLedgerCallback() {
+ @Override
+ public void initializeComplete() {
+ if (lastConfirmedEntry != null && lastConfirmedEntry.entryId
!= -1) {
+ // check that ledger used by lastConfirmedEntry actually
exists
+ try {
+
getLedgerMetadata(lastConfirmedEntry.getLedgerId()).get();
Review comment:
should we chain this CompletableFuture and call`
originalCb.initializeComplete();` on completion ?
otherwise we are introducing a blocking call in the chain, also
getLedgerMetadata will be a blocking call related to ZK client
```
getLedgerMetadata(lastConfirmedEntry.getLedgerId()).thenRun( () -> {
originalCb.initializeComplete();
}).exceptionally((err) -> {
originalCb.initializeFailed(err);
....
});
```
--
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]