Review Board 1.7.22


Consolidate membership management

Review Request #4729 - Created April 15, 2012 and updated

Alexander Shraer
Reviewers
zookeeper
zookeeper
https://issues.apache.org/jira/browse/ZOOKEEPER-1411

Currently every server has a different configuration file. With this patch, we will have all cluster membership definitions in a single file, and every sever can have a copy of this file. 
Many tests were updated to work with the new configuration format. MembershipBCTest.java tests backward compatibility.

Diff revision 2 (Latest)

1 2
1 2

  1. /src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java: Loading...
  2. /src/java/main/org/apache/zookeeper/server/quorum/Leader.java: Loading...
  3. /src/java/main/org/apache/zookeeper/server/quorum/LearnerHandler.java: Loading...
  4. /src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java: Loading...
  5. /src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java: Loading...
  6. /src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java: Loading...
  7. /src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerMain.java: Loading...
  8. /src/java/main/org/apache/zookeeper/server/quorum/QuorumZooKeeperServer.java: Loading...
  9. /src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java: Loading...
  10. /src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java: Loading...
  11. /src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumVerifier.java: Loading...
  12. /src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java: Loading...
  13. /src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java: Loading...
  14. /src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java: Loading...
  15. /src/java/test/org/apache/zookeeper/server/util/DynamicConfigBCTest.java: Loading...
  16. /src/java/test/org/apache/zookeeper/test/CnxManagerTest.java: Loading...
  17. /src/java/test/org/apache/zookeeper/test/FLETest.java: Loading...
  18. /src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java: Loading...
  19. /src/java/test/org/apache/zookeeper/test/HierarchicalQuorumTest.java: Loading...
  20. /src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java: Loading...
  21. /src/java/test/org/apache/zookeeper/test/ObserverTest.java: Loading...
  22. /src/java/test/org/apache/zookeeper/test/QuorumBase.java: Loading...
  23. /src/java/test/org/apache/zookeeper/test/QuorumUtil.java: Loading...
  24. /src/java/test/org/apache/zookeeper/test/StandaloneTest.java: Loading...
/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
Revision 1327937 New Change
[20] 582 lines
[+20] [+] private boolean termPredicate(
583
        /*
583
        /*
584
         * First make the views consistent. Sometimes peers will have
584
         * First make the views consistent. Sometimes peers will have
585
         * different zxids for a server depending on timing.
585
         * different zxids for a server depending on timing.
586
         */
586
         */
587
        for (Map.Entry<Long,Vote> entry : votes.entrySet()) {
587
        for (Map.Entry<Long,Vote> entry : votes.entrySet()) {
588
            if (vote.equals(entry.getValue())){
588
            if (self.getQuorumVerifier().getVotingMembers().containsKey(entry.getKey())

    
   
589
                    && vote.equals(entry.getValue())){
589
                set.add(entry.getKey());
590
                set.add(entry.getKey());
590
            }
591
            }
591
        }
592
        }
592

    
   
593

   
593
        return self.getQuorumVerifier().containsQuorum(set);
594
        return self.getQuorumVerifier().containsQuorum(set);
594
    }
595
    }
595

    
   

   
596
    /**
596
    /**
597
     * In the case there is a leader elected, and a quorum supporting
597
     * In the case there is a leader elected, and a quorum supporting
598
     * this leader, we have to check if the leader has voted and acked
598
     * this leader, we have to check if the leader has voted and acked
599
     * that it is leading. We need this check to avoid that peers keep
599
     * that it is leading. We need this check to avoid that peers keep
600
     * electing over and over a peer that has crashed and it is no
600
     * electing over and over a peer that has crashed and it is no
[+20] [20] 62 lines
[+20] [+] private ServerState learningState(){
663
     * Returns the initial vote value of server identifier.
663
     * Returns the initial vote value of server identifier.
664
     *
664
     *
665
     * @return long
665
     * @return long
666
     */
666
     */
667
    private long getInitId(){
667
    private long getInitId(){
668
        if(self.getLearnerType() == LearnerType.PARTICIPANT)
668
        if(self.getQuorumVerifier().getVotingMembers().containsKey(self.getId()))       
669
            return self.getId();
669
            return self.getId();
670
        else return Long.MIN_VALUE;
670
        else return Long.MIN_VALUE;
671
    }
671
    }
672

    
   
672

   
673
    /**
673
    /**
[+20] [20] 228 lines
/src/java/main/org/apache/zookeeper/server/quorum/Leader.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/LearnerHandler.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerMain.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/QuorumZooKeeperServer.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java
Revision 1327937 New Change
 
/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumVerifier.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/server/util/DynamicConfigBCTest.java
New File
 
/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/test/FLETest.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/test/HierarchicalQuorumTest.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/test/ObserverTest.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/test/QuorumBase.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/test/QuorumUtil.java
Revision 1327937 New Change
 
/src/java/test/org/apache/zookeeper/test/StandaloneTest.java
Revision 1327937 New Change
 
  1. /src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java: Loading...
  2. /src/java/main/org/apache/zookeeper/server/quorum/Leader.java: Loading...
  3. /src/java/main/org/apache/zookeeper/server/quorum/LearnerHandler.java: Loading...
  4. /src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java: Loading...
  5. /src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java: Loading...
  6. /src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java: Loading...
  7. /src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerMain.java: Loading...
  8. /src/java/main/org/apache/zookeeper/server/quorum/QuorumZooKeeperServer.java: Loading...
  9. /src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java: Loading...
  10. /src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java: Loading...
  11. /src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumVerifier.java: Loading...
  12. /src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java: Loading...
  13. /src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java: Loading...
  14. /src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java: Loading...
  15. /src/java/test/org/apache/zookeeper/server/util/DynamicConfigBCTest.java: Loading...
  16. /src/java/test/org/apache/zookeeper/test/CnxManagerTest.java: Loading...
  17. /src/java/test/org/apache/zookeeper/test/FLETest.java: Loading...
  18. /src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java: Loading...
  19. /src/java/test/org/apache/zookeeper/test/HierarchicalQuorumTest.java: Loading...
  20. /src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java: Loading...
  21. /src/java/test/org/apache/zookeeper/test/ObserverTest.java: Loading...
  22. /src/java/test/org/apache/zookeeper/test/QuorumBase.java: Loading...
  23. /src/java/test/org/apache/zookeeper/test/QuorumUtil.java: Loading...
  24. /src/java/test/org/apache/zookeeper/test/StandaloneTest.java: Loading...