liangyepianzhou commented on PR #22034: URL: https://github.com/apache/pulsar/pull/22034#issuecomment-1952363895
>I wonder if we should close the old one and create a new one if the last ledger is empty. This case should not happen. For timed tasks, call `rollCurrentLedgerIfFull`. It will check the ledger is not empty. ```java if (currentLedgerEntries > 0 && currentLedgerIsFull() && STATE_UPDATER.compareAndSet(this, State.LedgerOpened, State.ClosingLedger)) { ... } ``` For the add-entry process, the ledger will be closed after the entry is added completely. -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org