zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shra...@apache.org
Subject svn commit: r1617893 - in /zookeeper/branches/branch-3.5: ./ src/java/systest/org/apache/zookeeper/test/system/
Date Thu, 14 Aug 2014 07:33:58 GMT
Author: shralex
Date: Thu Aug 14 07:33:58 2014
New Revision: 1617893

URL: http://svn.apache.org/r1617893
Log:
ZOOKEEPER-2008. Missing leader election port in system test. (Kfir Lev-Ari via Alex Shraer).

Modified:
    zookeeper/branches/branch-3.5/CHANGES.txt
    zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java
    zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/GenerateLoad.java
    zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java

Modified: zookeeper/branches/branch-3.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.5/CHANGES.txt?rev=1617893&r1=1617892&r2=1617893&view=diff
==============================================================================
--- zookeeper/branches/branch-3.5/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.5/CHANGES.txt Thu Aug 14 07:33:58 2014
@@ -43,6 +43,7 @@ NEW FEATURES:
   (Skye Wanderman-Milne, Bill Havanki via phunt)
 
 BUGFIXES:
+  ZOOKEEPER-2008. Missing leader election port in system test. (Kfir Lev-Ari via Alex Shraer).
 
   ZOOKEEPER-1992. Backward compatibility of the static configuration file (Hongchao Deng
via Alex Shraer).
 

Modified: zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java?rev=1617893&r1=1617892&r2=1617893&view=diff
==============================================================================
--- zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java
(original)
+++ zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java
Thu Aug 14 07:33:58 2014
@@ -126,8 +126,9 @@ public class BaseSysTest extends TestCas
                     sbClient.append(',');
                     sbServer.append(',');
                 }
-                sbClient.append(r[0]);
-                sbServer.append(r[1]);
+                sbClient.append(r[0]); // r[0] == "host:clientPort"
+                sbServer.append(r[1]); // r[1] == "host:leaderPort:leaderElectionPort"
+                sbServer.append(";"+(r[0].split(":"))[1]); // Appending ";clientPort"
             }
             serverHostPort = sbClient.toString();
             quorumHostPort = sbServer.toString();

Modified: zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/GenerateLoad.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/GenerateLoad.java?rev=1617893&r1=1617892&r2=1617893&view=diff
==============================================================================
--- zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/GenerateLoad.java
(original)
+++ zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/GenerateLoad.java
Thu Aug 14 07:33:58 2014
@@ -603,8 +603,9 @@ public class GenerateLoad {
                         quorumHostPort.append(',');
                         zkHostPort.append(',');
                     }
-                    zkHostPort.append(r[0]);
-                    quorumHostPort.append(r[1]);
+                    zkHostPort.append(r[0]);     // r[0] == "host:clientPort"
+                    quorumHostPort.append(r[1]); // r[1] == "host:leaderPort:leaderElectionPort"
+                    quorumHostPort.append(";"+(r[0].split(":"))[1]); // Appending ";clientPort"
                 }
                 for (int i = 0; i < serverCount; i++) {
                     QuorumPeerInstance.startInstance(im, quorumHostPort

Modified: zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java?rev=1617893&r1=1617892&r2=1617893&view=diff
==============================================================================
--- zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
(original)
+++ zookeeper/branches/branch-3.5/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
Thu Aug 14 07:33:58 2014
@@ -52,7 +52,8 @@ class QuorumPeerInstance implements Inst
     }
 
     InetSocketAddress clientAddr;
-    InetSocketAddress quorumAddr;
+    InetSocketAddress quorumLeaderAddr;
+    InetSocketAddress quorumLeaderElectionAddr;
     HashMap<Long, QuorumServer> peers;
     File snapDir, logDir;
 
@@ -108,13 +109,20 @@ class QuorumPeerInstance implements Inst
             }
             try {
                 ServerSocket ss = new ServerSocket(0, 1, InetAddress.getLocalHost());
-                quorumAddr = (InetSocketAddress) ss.getLocalSocketAddress();
+                quorumLeaderAddr = (InetSocketAddress) ss.getLocalSocketAddress();
+                ss.close();
+            } catch(IOException e) {
+                e.printStackTrace();
+            }
+            try {
+                ServerSocket ss = new ServerSocket(0, 1, InetAddress.getLocalHost());
+                quorumLeaderElectionAddr = (InetSocketAddress) ss.getLocalSocketAddress();
                 ss.close();
             } catch(IOException e) {
                 e.printStackTrace();
             }
             String report = clientAddr.getHostName() + ':' + clientAddr.getPort() +
-            ',' + quorumAddr.getHostName() + ':' + quorumAddr.getPort();
+            ',' + quorumLeaderAddr.getHostName() + ':' + quorumLeaderAddr.getPort() + ':'
+ quorumLeaderElectionAddr.getPort();
             try {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Reporting " + report);
@@ -157,8 +165,15 @@ class QuorumPeerInstance implements Inst
             String parts[] = quorumSpecs.split(",");
             peers = new HashMap<Long,QuorumServer>();
             for(int i = 0; i < parts.length; i++) {
-                String subparts[] = parts[i].split(":");
-                peers.put(Long.valueOf(i), new QuorumServer(i, new InetSocketAddress(subparts[0],
Integer.parseInt(subparts[1]))));
+                // parts[i] == "host:leaderPort:leaderElectionPort;clientPort"
+                String subparts[] = (parts[i].split(";"))[0].split(":");
+		String clientPort = (parts[i].split(";"))[1];
+                peers.put(Long.valueOf(i),
+                          new QuorumServer(
+                                i,
+                                new InetSocketAddress(subparts[0], Integer.parseInt(subparts[1])),
+                                new InetSocketAddress(subparts[0], Integer.parseInt(subparts[2])),
+                                new InetSocketAddress(subparts[0], Integer.parseInt(clientPort))));
             }
             try {
                 if (LOG.isDebugEnabled()) {



Mime
View raw message