dlg99 commented on code in PR #3620:
URL: https://github.com/apache/bookkeeper/pull/3620#discussion_r1016930482


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingAddOp.java:
##########
@@ -266,6 +266,10 @@ public void run() {
         // We are about to send. Check if we need to make an ensemble change
         // because of delayed write errors
         lh.maybeHandleDelayedWriteBookieFailure();
+        // This op maybe recycled during bookie failures
+        if (maybeRecycled()) {

Review Comment:
   >> Another side of the problem is that pending add opp can be recycled and 
immediately reused by another add.
   
   > I don't understand this very well, can you explain in more detail?
   
   ```java
           lh.maybeHandleDelayedWriteBookieFailure();
           
           // Add Op is recycled at this point, maybeRecycled() has a chance to 
check lh == null
           // but the recycler can give that op to another thread/request (via 
RECYCLER.get() call)
           // so it can be re-initialized with different lh and other data
           // so maybeRecycled returns false and the rest of the method is 
executed against different op
           // to avoid such problems and avoid locks we use ordered executors / 
guarantee order of calls
           
           if (maybeRecycled()) {
   ```
   
   @zhaohaidao I hope this helps



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