You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2019/06/26 09:32:40 UTC

[GitHub] [zookeeper] maoling commented on a change in pull request #1004: ZOOKEEPER-3445 ReferenceCountedACLCache.aclIndex should be volatile

maoling commented on a change in pull request #1004: ZOOKEEPER-3445 ReferenceCountedACLCache.aclIndex should be volatile
URL: https://github.com/apache/zookeeper/pull/1004#discussion_r297570094
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ReferenceCountedACLCache.java
 ##########
 @@ -51,7 +51,7 @@
     /**
      * these are the number of acls that we have in the datatree
      */
-    long aclIndex = 0;
+    volatile long aclIndex = 0;
 
 
 Review comment:
   @jhalterman 
   Look at the call chain:
   ```
   [1]FileTxnSnapLog#restore--->FileSnap#deserialize--->SerializeUtils.deserializeSnapshot---dt.deserialize--aclCache.deserialize(ia);
   [2]Learner#syncWithLeader-->ZKDatabase#deserializeSnapshot[2]--->SerializeUtils.deserializeSnapshot---dt.deserialize--aclCache.deserialize(ia);
   ```
   [1] is for restoring from the snapshot when server start/restart; [2] is for the learner to sync with leader with snap cmd;
   the aclIndex is unlikely to be read by multiple threads? Am I right?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services