hangc0276 commented on PR #4171:
URL: https://github.com/apache/bookkeeper/pull/4171#issuecomment-1887421583

   @lhotari 
   >make changingEnsemble field volatile
   
   The `changingEnsemble` is already protected by synchronized, why do we need 
volatile?
   
   > change line 204 in PendingAddOp to 
lh.executeOrdered(lh::sendAddSuccessCallbacks); to prevent the deadlock
   
   +1 for @eolivelli 's suggestion. You can add a “safeSendAddSuccessCallbacks” 
that calls sendAddSuccessCallbacks in the OrderedExecutor
   
   > make sendAddSuccessCallbacks method synchronized.
   
   After we make `sendAddSuccessCallbacks` is called by the same thread, we 
don't need synchronize.
   
   
   > add logic to drainPendingAddsAndAdjustLength method to update 
pendingAddsSequenceHead accordingly. The drainPendingAddsAndAdjustLength method 
is where pendingAddsSequenceHead could currently get out of sync.
   
   IMO, the `drainPendingAddsAndAdjustLength` method also need to be executed 
by OrderedExecutor.
   
   @graysonzeng We'd better add a unit test to verify and protect the logic.
   


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