Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/247#discussion_r115113525
  
    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java 
---
    @@ -682,27 +682,19 @@ public void setQuorumAddress(InetSocketAddress addr){
         }
     
         public InetSocketAddress getElectionAddress(){
    -        synchronized (QV_LOCK) {
    -            return myElectionAddr;
    -        }
    +        return myElectionAddr;
    --- End diff --
    
    Here is why. 
    * All set code path was protected by QV_LOCK already, which implies that 
whoever calls set* should already acquire the QV_LOCK.
    * On get code path, it is not guaranteed that caller will hold QV_LOCK 
while a reconfig op is in flight, and I think it is possible in theory we could 
get out dated election address, e.g. at [this 
place](https://github.com/apache/zookeeper/blob/master/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java#L265).
 Hopefully this is not a problem because we don't require precise information 
being sent here - if we get out dated addr (in case the current quorum peer is 
being reconfigured) and sent this to another peer, another peer will not able 
to connect but that's fine, it will retry until at certain point later it will 
get correct information. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to