zhaohaidao commented on code in PR #3620:
URL: https://github.com/apache/bookkeeper/pull/3620#discussion_r1020860091
##########
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
Thanks a lot for your explanation. I submitted a revision based on your
suggestions.
Please have a look if you have time.
@dlg99
--
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]