hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r703602 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
Date Fri, 10 Oct 2008 23:15:55 GMT
Author: breed
Date: Fri Oct 10 16:15:55 2008
New Revision: 703602

URL: http://svn.apache.org/viewvc?rev=703602&view=rev
Log:
ZOOKEEPER-178 FLE Test

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=703602&r1=703601&r2=703602&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Oct 10 16:15:55 2008
@@ -134,3 +134,5 @@
  ZOOKEEPER-127.  Use of non-standard election ports in config breaks services
  (Mark Harwood and Flavio Junqueira via breed)
 
+ ZOOKEEPER-172. FLE Test (Flavio Junqueira via breed)
+

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=703602&r1=703601&r2=703602&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
(original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
Fri Oct 10 16:15:55 2008
@@ -587,6 +587,19 @@
                 }
                 break;
             case LEADING:
+                /*
+                 * There is at most one leader for each epoch, so if a peer claims to
+                 * be the leader for an epoch, then that peer must be the leader (no
+                 * arbitrary failures assumed). Now, if there is no quorum supporting 
+                 * this leader, then processes will naturally move to a new epoch.
+                 */
+                if(n.epoch == logicalclock){
+                    self.setPeerState((n.leader == self.getId()) ? 
+                            ServerState.LEADING: ServerState.FOLLOWING);
+                   
+                    leaveInstance();
+                    return new Vote(n.leader, n.zxid);
+                }
             case FOLLOWING:
                 LOG.info("Notification: " + n.leader + ", " + n.zxid + ", " + n.epoch + ",
" + self.getId() + ", " + self.getPeerState() + ", " + n.state + ", " + n.sid);
        



Mime
View raw message