zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shra...@apache.org
Subject zookeeper git commit: ZOOKEEPER-2556: peerType not removed from static config file (Rakesh Kumar Singh via shralex).
Date Thu, 03 Nov 2016 15:08:38 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/ZOOKEEPER-2556 [created] bcb07a09b


ZOOKEEPER-2556: peerType not removed from static config file (Rakesh Kumar Singh via shralex).


Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/bcb07a09
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/bcb07a09
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/bcb07a09

Branch: refs/heads/ZOOKEEPER-2556
Commit: bcb07a09b06c91243ed244f04a71b8daf629e286
Parents: f6349d1
Author: Alexander Shraer <shralex@gmail.com>
Authored: Thu Nov 3 11:07:36 2016 -0400
Committer: Alexander Shraer <shralex@gmail.com>
Committed: Thu Nov 3 11:07:36 2016 -0400

----------------------------------------------------------------------
 .../server/quorum/QuorumPeerConfig.java         |  1 +
 .../server/quorum/QuorumPeerTestBase.java       | 31 +++++++++++++-------
 .../server/quorum/ReconfigLegacyTest.java       |  6 ++--
 3 files changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/bcb07a09/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java b/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
index e772fa8..24a4ec1 100644
--- a/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
+++ b/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
@@ -480,6 +480,7 @@ public class QuorumPeerConfig {
                         || key.startsWith("group")
                         || key.startsWith("weight")
                         || key.startsWith("dynamicConfigFile")
+                        || key.startsWith("peerType")
                         || (eraseClientPortAddress
                             && (key.startsWith("clientPort")
                                 || key.startsWith("clientPortAddress")))) {

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/bcb07a09/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java
----------------------------------------------------------------------
diff --git a/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java b/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java
index 51f444b..35f29dc 100644
--- a/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java
+++ b/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java
@@ -79,7 +79,7 @@ public class QuorumPeerTestBase extends ZKTestCase implements Watcher {
         public MainThread(int myid, String quorumCfgSection, Integer secureClientPort, boolean
writeDynamicConfigFile)
                 throws  IOException {
             this(myid, UNSET_STATIC_CLIENTPORT, JettyAdminServer.DEFAULT_PORT, secureClientPort,
-                    quorumCfgSection, null, writeDynamicConfigFile, null);
+                    quorumCfgSection, null, null, writeDynamicConfigFile, null);
         }
 
         public MainThread(int myid, String quorumCfgSection, boolean writeDynamicConfigFile)
@@ -89,43 +89,48 @@ public class QuorumPeerTestBase extends ZKTestCase implements Watcher
{
 
         public MainThread(int myid, int clientPort, String quorumCfgSection)
                 throws IOException {
-            this(myid, clientPort, JettyAdminServer.DEFAULT_PORT, quorumCfgSection, null,
true);
+            this(myid, clientPort, JettyAdminServer.DEFAULT_PORT, quorumCfgSection, null,
null, true);
         }
 
         public MainThread(int myid, int clientPort, String quorumCfgSection, boolean writeDynamicConfigFile)
                 throws IOException {
-            this(myid, clientPort, JettyAdminServer.DEFAULT_PORT, quorumCfgSection, null,
writeDynamicConfigFile);
+            this(myid, clientPort, JettyAdminServer.DEFAULT_PORT, quorumCfgSection, null,
null, writeDynamicConfigFile);
+        }
+        
+        public MainThread(int myid, int clientPort, String quorumCfgSection, String peerType,
boolean writeDynamicConfigFile)
+                throws IOException {
+            this(myid, clientPort, JettyAdminServer.DEFAULT_PORT, quorumCfgSection, null,
peerType, writeDynamicConfigFile);
         }
 
         public MainThread(int myid, int clientPort, String quorumCfgSection, boolean writeDynamicConfigFile,
                           String version) throws IOException {
             this(myid, clientPort, JettyAdminServer.DEFAULT_PORT, quorumCfgSection, null,
-                    writeDynamicConfigFile, version);
+                    null, writeDynamicConfigFile, version);
         }
 
         public MainThread(int myid, int clientPort, String quorumCfgSection, String configs)
                 throws IOException {
-            this(myid, clientPort, JettyAdminServer.DEFAULT_PORT, quorumCfgSection, configs,
true);
+            this(myid, clientPort, JettyAdminServer.DEFAULT_PORT, quorumCfgSection, configs,
null, true);
         }
 
         public MainThread(int myid, int clientPort, int adminServerPort, String quorumCfgSection,
                 String configs)  throws IOException {
-            this(myid, clientPort, adminServerPort, quorumCfgSection, configs, true);
+            this(myid, clientPort, adminServerPort, quorumCfgSection, configs, null, true);
         }
 
         public MainThread(int myid, int clientPort, int adminServerPort, String quorumCfgSection,
-                String configs, boolean writeDynamicConfigFile)
+                String configs, String peerType, boolean writeDynamicConfigFile)
                 throws IOException {
-            this(myid, clientPort, adminServerPort, quorumCfgSection, configs, writeDynamicConfigFile,
null);
+            this(myid, clientPort, adminServerPort, quorumCfgSection, configs, peerType,
writeDynamicConfigFile, null);
         }
 
         public MainThread(int myid, int clientPort, int adminServerPort, String quorumCfgSection,
-                          String configs, boolean writeDynamicConfigFile, String version)
throws IOException {
-            this(myid, clientPort, adminServerPort, null, quorumCfgSection, configs, writeDynamicConfigFile,
version);
+                          String configs, String peerType, boolean writeDynamicConfigFile,
String version) throws IOException {
+            this(myid, clientPort, adminServerPort, null, quorumCfgSection, configs, peerType,
writeDynamicConfigFile, version);
         }
 
         public MainThread(int myid, int clientPort, int adminServerPort, Integer secureClientPort,
-                          String quorumCfgSection, String configs, boolean writeDynamicConfigFile,
String version)
+                          String quorumCfgSection, String configs, String peerType, boolean
writeDynamicConfigFile, String version)
                 throws IOException {
             tmpDir = ClientBase.createTmpDir();
             LOG.info("id = " + myid + " tmpDir = " + tmpDir + " clientPort = "
@@ -162,6 +167,10 @@ public class QuorumPeerTestBase extends ZKTestCase implements Watcher
{
             if (secureClientPort != null) {
                 fwriter.write("secureClientPort=" + secureClientPort + "\n");
             }
+            
+            if (peerType != null) {
+                fwriter.write("peerType=" + peerType + "\n");
+            }
 
             if (writeDynamicConfigFile) {
                 String dynamicConfigFilename = createDynamicFile(quorumCfgSection, version);

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/bcb07a09/src/java/test/org/apache/zookeeper/server/quorum/ReconfigLegacyTest.java
----------------------------------------------------------------------
diff --git a/src/java/test/org/apache/zookeeper/server/quorum/ReconfigLegacyTest.java b/src/java/test/org/apache/zookeeper/server/quorum/ReconfigLegacyTest.java
index ee9f2e2..37bd8e4 100644
--- a/src/java/test/org/apache/zookeeper/server/quorum/ReconfigLegacyTest.java
+++ b/src/java/test/org/apache/zookeeper/server/quorum/ReconfigLegacyTest.java
@@ -75,7 +75,7 @@ public class ReconfigLegacyTest extends QuorumPeerTestBase {
         // Start the servers with a static config file, without a dynamic
         // config file.
         for (int i = 0; i < SERVER_COUNT; i++) {
-            mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, false);
+            mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, "participant",
false);
             // check that a dynamic configuration file doesn't exist
             Assert.assertEquals( mt[i].getDynamicFiles().length, 0 );
             mt[i].start();
@@ -93,10 +93,12 @@ public class ReconfigLegacyTest extends QuorumPeerTestBase {
             ReconfigTest.testServerHasConfig(zk[i], allServers, null);
             // check that static config file doesn't include membership info
             // and has a pointer to the dynamic configuration file
+            // check that static config file doesn't include peerType info
             Properties cfg = readPropertiesFromFile(mt[i].confFile);
             for (int j = 0; j < SERVER_COUNT; j++) {
-                Assert.assertFalse(cfg.containsKey("server." + j));
+                Assert.assertFalse(cfg.containsKey("server." + j));                
             }
+            Assert.assertFalse(cfg.containsKey("peerType"));
             Assert.assertTrue(cfg.containsKey("dynamicConfigFile"));
             Assert.assertFalse(cfg.containsKey("clientPort"));
 


Mime
View raw message