eolivelli commented on code in PR #17736:
URL: https://github.com/apache/pulsar/pull/17736#discussion_r977248421
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -2463,12 +2473,19 @@ void internalTrimLedgers(boolean isTruncate,
CompletableFuture<?> promise) {
log.debug("[{}] Start TrimConsumedLedgers. ledgers={}
totalSize={}", name, ledgers.keySet(),
TOTAL_SIZE_UPDATER.get(this));
}
- if (STATE_UPDATER.get(this) == State.Closed) {
+ State currentState = STATE_UPDATER.get(this);
+ if (currentState == State.Closed) {
log.debug("[{}] Ignoring trimming request since the managed
ledger was already closed", name);
trimmerMutex.unlock();
promise.completeExceptionally(new
ManagedLedgerAlreadyClosedException("Can't trim closed ledger"));
return;
}
+ if (currentState == State.Fenced) {
+ log.debug("[{}] Ignoring trimming request since the managed
ledger was already fenced", name);
+ trimmerMutex.unlock();
Review Comment:
I am not sure.
I prefer to keep the ML in a clean status.
I did the same it works for a "closed" ML.
it is very like to being "Closed" in this point
--
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]