tomyouyou opened a new pull request #11162:
URL: https://github.com/apache/pulsar/pull/11162


   'createLedgerAfterClosed()' may be starting to create a new ledger 
repeatedly, for 'ledgerClosed' would has starting a creating  ledger job when 
'pendingAddEntries' is not empty.
   
   The related modulue is  
'org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl' and the funtions are as 
follows:
   
   public void rollCurrentLedgerIfFull() {
       ...
       ledgerClosed(lh);
       createLedgerAfterClosed();
       ...
   }
   
   synchronized void ledgerClosed(final LedgerHandle lh) {
       if (!pendingAddEntries.isEmpty()) {
               // Need to create a new ledger to write pending entries
               log.info("[{}] Creating a new ledger", name);
               STATE_UPDATER.set(this, State.CreatingLedger);
               this.lastLedgerCreationInitiationTimestamp = 
System.currentTimeMillis();
               mbean.startDataLedgerCreateOp();
               asyncCreateLedger(bookKeeper, config, digestType, this, 
Collections.emptyMap());
           }
   }
   
   synchronized void createLedgerAfterClosed() {
           STATE_UPDATER.set(this, State.CreatingLedger);
           this.lastLedgerCreationInitiationTimestamp = 
System.currentTimeMillis();
           mbean.startDataLedgerCreateOp();
           asyncCreateLedger(bookKeeper, config, digestType, this, 
Collections.emptyMap());
       }
   
   


-- 
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]


Reply via email to