Fix the deadlock while using zookeeper thread to create ledger
### Motivation
Fixes: the deadlock when using ZK thread to create a ledger.
### Modification
Use the executor of the managed ledger to create the ledger to avoid the deadlock.
@@ -1638,7 +1638,10 @@ public class ManagedLedgerImpl implements ManagedLedger, CreateCallback {
STATE_UPDATER.set(this, State.CreatingLedger);
this.lastLedgerCreationInitiationTimestamp = System.currentTimeMillis();
mbean.startDataLedgerCreateOp();
- asyncCreateLedger(bookKeeper, config, digestType, this, Collections.emptyMap());
+ // Use the executor here is to avoid use the Zookeeper thread to create the ledger which will lead
+ // to deadlock at the zookeeper client, details to see https://github.com/apache/pulsar/issues/13736
+ this.executor.execute(() ->
+ asyncCreateLedger(bookKeeper, config, digestType, this, Collections.emptyMap()));
}
}
