li4wang commented on PR #2185:
URL: https://github.com/apache/zookeeper/pull/2185#issuecomment-2557852989

   Thanks @anmolnar and @kezhuw 
   
   > > I saw that sync is called only in one thread and pendingSyncs is 
concurrent safe.
   > I think we could remove synchronize from sync() too. Or remove it only 
from sync().
   
   `sync()` is synchronized on the `ZookeeperServer` object, which is accessed 
by multiple-threads.  Through inheritance and composition, the sync() operation 
is currently synchronized with following API calls. 
   
   ```
   ZookeeperServer.enqueueRequest(), 
   ZookeeperServer.submitRequestNow()
   ZookeeperServer.startup()
   ZookeeperServer.shutdown()
   Learner.syncWithLeader()
   ```
   
   `sync()` is used for strong consistency of not getting stale data in the 
read after write scenario. Not sure if it's safe to remove `synchronization` 
from it.
   


-- 
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: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to