poorbarcode commented on code in PR #22034:
URL: https://github.com/apache/pulsar/pull/22034#discussion_r1498561232


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -1754,10 +1754,7 @@ synchronized void ledgerClosed(final LedgerHandle lh) {
 
         maybeOffloadInBackground(NULL_OFFLOAD_PROMISE);
 
-        if (!pendingAddEntries.isEmpty()) {
-            // Need to create a new ledger to write pending entries
-            createLedgerAfterClosed();
-        }
+        createLedgerAfterClosed();

Review Comment:
   BTW, the method `ML.getFirstPosition` will throw a `NoSuchElementException` 
if the current ledger was deleted(in other words: `ML.ledgers` is empty).
   
   So the current solution(create a new ledger and delete the last non-empty 
one) is better.



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

Reply via email to