Author: breed
Date: Fri Sep 10 16:13:05 2010
New Revision: 995844

URL: http://svn.apache.org/viewvc?rev=995844&view=rev
Log:
ZOOKEEPER-785. Zookeeper 3.3.1 shouldn't infinite loop if someone creates a 
server.0 line

Modified:
    hadoop/zookeeper/branches/branch-3.3/CHANGES.txt
    
hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java

Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=995844&r1=995843&r2=995844&view=diff
==============================================================================
--- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Fri Sep 10 16:13:05 2010
@@ -16,6 +16,8 @@ BUGFIXES:
 
   ZOOKEEPER-792. zkpython memory leak (Lei Zhang via henryr)
 
+  ZOOKEEPER-785. Zookeeper 3.3.1 shouldn't infinite loop if someone creates a 
server.0 line (phunt and Andrei Savu via breed)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-789. Improve FLE log messages (flavio via phunt)

Modified: 
hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java?rev=995844&r1=995843&r2=995844&view=diff
==============================================================================
--- 
hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.3/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
 Fri Sep 10 16:13:05 2010
@@ -241,7 +241,14 @@ public class QuorumPeerConfig {
             throw new IllegalArgumentException(
                     "minSessionTimeout must not be larger than 
maxSessionTimeout");
         }
-        if (servers.size() > 1) {
+        if (servers.size() == 1) {
+            LOG.error("Invalid configuration, only one server specified 
(ignoring)");
+            servers.clear();
+        } else if (servers.size() > 1) {
+            if (servers.size() == 2) {
+                LOG.warn("No server failure will be tolerated. " +
+                    "You need at least 3 servers.");
+            }
             if (initLimit == 0) {
                 throw new IllegalArgumentException("initLimit is not set");
             }


Reply via email to