sijie commented on a change in pull request #5942: Avoid using same OpAddEntry 
between different ledger handles
URL: https://github.com/apache/pulsar/pull/5942#discussion_r363148641
 
 

 ##########
 File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java
 ##########
 @@ -110,6 +125,13 @@ public void failed(ManagedLedgerException e) {
 
     @Override
     public void addComplete(int rc, final LedgerHandle lh, long entryId, 
Object ctx) {
+
+        if (!STATE_UPDATER.compareAndSet(OpAddEntry.this, State.INITIATED, 
State.COMPLETED)) {
+            log.warn("[{}] The add op is terminal legacy callback for entry 
{}-{} adding.", ml.getName(), lh.getId(), entryId);
+            OpAddEntry.this.recycle();
 
 Review comment:
   since we are creating a new entry when retrying the ops on the new ledger, 
do we need to introduce the `state` field and recycle here?
   
   Since this op is only used by the old ledger handler, it will not be reused 
across ledgers. It should already be recycled correctly.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to