zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] jhalterman commented on a change in pull request #1004: ZOOKEEPER-3445 ReferenceCountedACLCache.aclIndex should be volatile
Date Wed, 26 Jun 2019 15:46:05 GMT
jhalterman commented on a change in pull request #1004: ZOOKEEPER-3445 ReferenceCountedACLCache.aclIndex
should be volatile
URL: https://github.com/apache/zookeeper/pull/1004#discussion_r297737922
 
 

 ##########
 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:
   From what I can tell, the `FileTxnSnapLog#restore` call that happens on startup occurs
in the main thread. Later, `Learner#syncWithLeader` occurs in the `QuorumPeer`'s thread.
   
   There appear to be other possible threads that touch `ReferenceCountedACLCache` as well.
Ex:
   
   ```
   FollowerRequestProcessor.run->FileRequestProcessor.processRequest->ZookeeperServer.processTxn->ZkDatabase.processTxn->DataTree.processTxn->DataTree.createNode->ReferenceCountedACLCache.convertActls->
ReferenceCountedACLCache.incrementIndex```
   
   and
   
   ```
   WorkerService.run->CommitProcessor.doWork->FileRequestProcessor.processRequest->ZookeeperServer.processTxn->ZkDatabase.processTxn->DataTree.processTxn->DataTree.createNode->ReferenceCountedACLCache.convertActls->
ReferenceCountedACLCache.incrementIndex```
   
   But overall I'd ask, if `aclIndex` doesn't need to be threadsafe, then why is the rest
of `ReferenceCountedACLCache` written to be threadsafe?

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

Mime
View raw message