nodece commented on code in PR #25240:
URL: https://github.com/apache/pulsar/pull/25240#discussion_r3231508039
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -4416,13 +4441,21 @@ private void checkManagedLedgerIsOpen() throws
ManagedLedgerException {
@VisibleForTesting
public synchronized void setFenced() {
- log.info("Moving to Fenced state");
- STATE_UPDATER.set(this, State.Fenced);
+ log.info().attr("ledgerName", name).log("Moving to Fenced state");
+ if (STATE_UPDATER.get(this) != State.Fenced) {
+ STATE_UPDATER.set(this, State.Fenced);
+ clearPendingAddEntries(new
ManagedLedgerFencedException("ManagedLedger "
+ + name + " is fenced"));
+ }
}
synchronized void setFencedForDeletion() {
- log.info("Moving to FencedForDeletion state");
- STATE_UPDATER.set(this, State.FencedForDeletion);
+ log.info().attr("ledgerName", name).log("Moving to FencedForDeletion
state");
+ if (STATE_UPDATER.get(this) != State.FencedForDeletion) {
+ STATE_UPDATER.set(this, State.FencedForDeletion);
Review Comment:
```suggestion
State prev = STATE_UPDATER.getAndSet(this, State.FencedForDeletion);
if (prev != State.FencedForDeletion) {
```
--
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]