lhotari commented on pull request #3110:
URL: https://github.com/apache/bookkeeper/pull/3110#issuecomment-1067626623


   > > Thanks @congbobo184 for making this PR.
   > > I'm just wondering that `close` should get called once as a result of 
the guard by `org.apache.bookkeeper.client.PendingReadOp`'s `AtomicBoolean 
complete` field:
   > > 
https://github.com/apache/bookkeeper/blob/10825c93bccd9e170df75ab9f2cf85cb6043f649/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java#L619-L622
   > > 
   > > Why isn't that sufficient?
   > 
   > @lhotari It changed the request's `complete` flag from `false` to `true`. 
And when the previous request's response came back, whose request has already 
been closed, it will be filtered by this complete flag and prevent tampering 
other entry's data.
   
   @hangc0276 That doesn't answer my question.
   
   I meant a different thing.
   
   It seems that LedgerEntryRequest.close can only get called via this line
   
   
https://github.com/apache/bookkeeper/blob/017307bc67431a7616861ad09927c4e3327633d1/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java#L644
   
   or this line
   
   
https://github.com/apache/bookkeeper/blob/7087fda4e91e9fe8974f9d36e01e275a08bf38f1/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/impl/LedgerEntriesImpl.java#L59
   
   both of those calls should only originate from the call chains starting from 
PendingReadOp#submitCallback:
   
   
https://github.com/apache/bookkeeper/blob/017307bc67431a7616861ad09927c4e3327633d1/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java#L611-L650
   
   Why isn't the `if (!complete.compareAndSet(false, true)) {` sufficient in 
PendingReadOp#submitCallback?
   


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