[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14073395#comment-14073395
 ] 

Raul Gutierrez Segales commented on ZOOKEEPER-1987:
---------------------------------------------------

Small readability (possibly correctness) nit:

{noformat}
+        for (int i = 0; i < SERVER_COUNT; i++) {
+            mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, 
false);
+            // check that a dynamic configuration file wasn't created
+            Assert.assertFalse(mt[i].dynamicConfigFile.exists());
+            mt[i].start();
+            zk[i] = new ZooKeeper("127.0.0.1:" + clientPorts[i],
+                    ClientBase.CONNECTION_TIMEOUT, this);
+        }
+        // Check that the servers are up, have the right config and can 
process operations
+        // Check that the static config was split to static and dynamic files 
correctly
+        for (int i = 0; i < SERVER_COUNT; i++) {
+            Assert.assertTrue("waiting for server 0 being up", ClientBase
+                    .waitForServerUp("127.0.0.1:" + clientPorts[0],
+                            CONNECTION_TIMEOUT));
+            Assert.assertTrue(mt[i].dynamicConfigFile.exists());
+            ReconfigTest.testServerHasConfig(zk[i], allServers, null);
{noformat}

I think it makes more sense to start the ZooKeeper clients in the 2nd loop, 
after you've asserted that the server is up?

Also, server 0 is hard-coded in the assert message (should be %d, i).

Another small readability nit:

{noformat}
+            Properties cfg = new Properties();
+            FileInputStream in = new FileInputStream(mt[0].confFile);
+            try {
+                cfg.load(in);
+            } finally {
+                in.close();
+            }
{noformat}

is used twice. Mind having a small helper method to get the cfg:

{noformat}
           Properties cfg = getProperties(mt[0].confFile);
{noformat}

Same thing with regards starting clients after the servers are up (and same 
with hard coded server number in the assert error message):

{noformat}
+        for (int i = 0; i < SERVER_COUNT; i++) {
+            mt[i].start();
+            zk[i] = new ZooKeeper("127.0.0.1:" + clientPorts[i],
+                    ClientBase.CONNECTION_TIMEOUT, this);
+        }
+        for (int i = 0; i < SERVER_COUNT; i++) {
+            Assert.assertTrue("waiting for server 0 being up", ClientBase
+                    .waitForServerUp("127.0.0.1:" + clientPorts[0],
+                            CONNECTION_TIMEOUT));
+            ReconfigTest.testServerHasConfig(zk[i], allServers, null);
+        }
{noformat}


> unable to restart 3 node cluster
> --------------------------------
>
>                 Key: ZOOKEEPER-1987
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1987
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: tests
>    Affects Versions: 3.5.0
>            Reporter: Patrick Hunt
>            Assignee: Alexander Shraer
>            Priority: Blocker
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1987-ver1.patch, ZOOKEEPER-1987-ver2.patch, 
> ZOOKEEPER-1987-ver3.patch, ZOOKEEPER-1987.patch, f1.jstack, l3.jstack, 
> test3.tar.gz
>
>
> I tried a fairly simple test, start a three node cluster, bring it down, then 
> restart it. On restart the servers elect the leader and send updates, however 
> the negotiation never completes - the client ports are never bound for 
> example.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to