lhotari commented on a change in pull request #11737:
URL: https://github.com/apache/pulsar/pull/11737#discussion_r693982448



##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java
##########
@@ -179,7 +179,18 @@ public void addComplete(int rc, final LedgerHandle lh, 
long entryId, Object ctx)
     public void safeRun() {
         // Remove this entry from the head of the pending queue
         OpAddEntry firstInQueue = ml.pendingAddEntries.poll();
-        checkArgument(this == firstInQueue);
+        if (firstInQueue == null) {
+            // The pending op might been polled by others such as cleanup 
pending op when create Ledger failed.
+            ReferenceCountUtil.release(data);
+            this.recycle();
+            return;
+        }
+        if (this != firstInQueue) {
+            firstInQueue.failed(new ManagedLedgerException("Unexpected add 
entry op when complete the add entry op."));
+            ReferenceCountUtil.release(data);
+            this.recycle();
+            return;
+        }

Review comment:
       I have one more question about this solution. Would it be necessary to 
call the callback for the OpAddEntry by using the "failed" method?




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