You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by mi...@apache.org on 2014/01/09 22:03:16 UTC

svn commit: r1556949 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/c/tests/TestClient.cc

Author: michim
Date: Thu Jan  9 21:03:16 2014
New Revision: 1556949

URL: http://svn.apache.org/r1556949
Log:
ZOOKEEPER-1057. zookeeper c-client, connection to offline server fails to successfully fallback to second zk host (Germán Blanco via michim)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/c/tests/TestClient.cc

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1556949&r1=1556948&r2=1556949&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Thu Jan  9 21:03:16 2014
@@ -215,6 +215,9 @@ BUGFIXES:
   ZOOKEEPER-1414. QuorumPeerMainTest.testQuorum, testBadPackets are failing
   intermittently (Rakesh R via michim)
 
+  ZOOKEEPER-1057. zookeeper c-client, connection to offline server fails to
+  successfully fallback to second zk host (Germán Blanco via michim)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1564. Allow JUnit test build with IBM Java

Modified: zookeeper/branches/branch-3.4/src/c/tests/TestClient.cc
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/tests/TestClient.cc?rev=1556949&r1=1556948&r2=1556949&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/tests/TestClient.cc (original)
+++ zookeeper/branches/branch-3.4/src/c/tests/TestClient.cc Thu Jan  9 21:03:16 2014
@@ -186,6 +186,7 @@ class Zookeeper_simpleSystem : public CP
     CPPUNIT_TEST_SUITE(Zookeeper_simpleSystem);
     CPPUNIT_TEST(testAsyncWatcherAutoReset);
     CPPUNIT_TEST(testDeserializeString);
+    CPPUNIT_TEST(testFirstServerDown);
 #ifdef THREADED
     CPPUNIT_TEST(testNullData);
 #ifdef ZOO_IPV6_ENABLED
@@ -287,6 +288,17 @@ public:
         struct String_vector str_vec = {0, NULL};
         zrc = zoo_wget_children(zzh, "/mytest", default_zoo_watcher, NULL, &str_vec);
     }
+
+    /** ZOOKEEPER-1057 This checks that the client connects to the second server when the first is not reachable **/
+    void testFirstServerDown() {
+        watchctx_t ctx;
+
+        zoo_deterministic_conn_order(true);
+
+        zhandle_t* zk = createClient("127.0.0.1:22182,127.0.0.1:22181", &ctx);
+        CPPUNIT_ASSERT(zk != 0);
+        CPPUNIT_ASSERT(ctx.waitForConnected(zk));
+    }
     
     /** this checks for a deadlock in calling zookeeper_close and calls from a default watcher that might get triggered just when zookeeper_close() is in progress **/
     void testHangingClient() {