nodece commented on code in PR #24498:
URL: https://github.com/apache/pulsar/pull/24498#discussion_r2238582892


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -172,11 +172,19 @@ public void initiate() {
             ledger.asyncAddEntry(duplicateBuffer, this, addOpCount);
         } else {
             State state = STATE_UPDATER.get(OpAddEntry.this);
+            if (state == State.INITIATED || state == State.COMPLETED || state 
== State.CLOSED) {
+                log.warn("[{}] OpAddEntry is already initiated or completed or 
closed, state={}", ml.getName(), state);
+                return;
+            }
+
             log.warn("[{}] initiate with unexpected state {}, expect OPEN 
state.", ml.getName(), state);
-            if (state != State.INITIATED && state != State.COMPLETED && state 
!= State.CLOSED) {
-                ml.pendingAddEntries.remove(OpAddEntry.this);
-                this.failed(new ManagedLedgerException("Unexpected state " + 
state));
+            ManagedLedgerException ex = ml.interceptorException;
+            if (ex == null) {

Review Comment:
   You can directly set the ManagedLedgerException.



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