poorbarcode opened a new pull request, #21542: URL: https://github.com/apache/pulsar/pull/21542
### Motivation When an ML tries to create a new ledger, it will create a delay task to check if the ledger create request is timeout<sup>[1]</sup>. However, we should cancel this delay task after the request to create new ledgers is finished. Otherwise, these tasks will cost unnecessary CPU resources<sup>[2]</sup>. **[1]**: https://github.com/apache/pulsar/blob/master/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L4070-L4082 ```java bookKeeper.asyncCreateLedger(config.getEnsembleSize(), config.getWriteQuorumSize(), config.getAckQuorumSize(), digestType, config.getPassword(), cb, ledgerCreated, finalMetadata); scheduledExecutor.schedule(() -> { if (!ledgerCreated.get()) { cb.createComplete(BKException.Code.TimeoutException, null, ledgerCreated); } }, config.getMetadataOperationsTimeoutSeconds(), TimeUnit.SECONDS); ``` **[2]**: Thousands delay tasks in memory <img width="1450" alt="for_pr_1" src="https://github.com/apache/pulsar/assets/25195800/bd287044-6b02-4128-b9ac-2f0548b0a7cd"> <img width="1447" alt="for_pr_2" src="https://github.com/apache/pulsar/assets/25195800/812c7071-ccce-4869-ba30-934d65997cc2"> ### Modifications <!-- Describe the modifications you've done. --> ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc` <!-- Your PR contains doc changes. --> - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later --> - [x] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `doc-complete` <!-- Docs have been already added --> ### Matching PR in forked repository PR in forked repository: x -- 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]
