codelipenghui commented on code in PR #25240:
URL: https://github.com/apache/pulsar/pull/25240#discussion_r2891745234


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -1937,6 +1951,9 @@ synchronized void ledgerClosed(final LedgerHandle lh, 
Long lastAddConfirmed) {
             // The managed ledger was closed during the write operation
             clearPendingAddEntries(new 
ManagedLedgerAlreadyClosedException("Managed ledger was already closed"));
             return;

Review Comment:
   [Minor] This is a correct fix. Consider adding a log at WARN level here, 
similar to how other state transitions are logged. When all pending entries are 
cleared due to fencing, operators should have a trace in production logs to 
diagnose message loss:
   ```java
   } else if (state.isFenced()) {
       log.warn("[{}] Managed ledger is fenced during ledgerClosed, clearing {} 
pending add entries",
           name, pendingAddEntries.size());
       clearPendingAddEntries(new ManagedLedgerFencedException("Managed ledger 
is fenced"));
       return;
   }
   ```



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