dao-jun commented on code in PR #25955:
URL: https://github.com/apache/pulsar/pull/25955#discussion_r3383374581
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -3682,23 +3692,27 @@ public void asyncOffloadPrefix(Position pos,
OffloadCallback callback, Object ct
}
long current = ledgers.lastKey();
+ boolean includeLastLedger = STATE_UPDATER.get(this) ==
State.Terminated
Review Comment:
Recommended fix: Gate includeLastLedger on the final ledger actually being
closed (metadata refreshed). The simplest reliable signal is whether the last
ledger's LedgerInfo has been populated:
LedgerInfo lastLedgerInfo = ledgers.get(current);
boolean lastLedgerClosed = lastLedgerInfo != null &&
lastLedgerInfo.getEntries() > 0;
boolean includeLastLedger = STATE_UPDATER.get(this) == State.Terminated
&& requestOffloadTo.compareTo(lastConfirmedEntry) >= 0
&& lastLedgerClosed;
--
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]