You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2017/11/03 18:48:38 UTC

hbase git commit: HBASE-19102 TestZooKeeperMainServer fails with KeeperException

Repository: hbase
Updated Branches:
  refs/heads/master 4857cbd76 -> 4985e2730


HBASE-19102 TestZooKeeperMainServer fails with KeeperException

Signed-off-by: Michael Stack <st...@apache.org>


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

Branch: refs/heads/master
Commit: 4985e273079b1dfe95db0befd49266ad46754b63
Parents: 4857cbd
Author: Michael Stack <st...@apache.org>
Authored: Thu Oct 26 21:05:04 2017 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Fri Nov 3 11:48:25 2017 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/zookeeper/ZooKeeperMainServer.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4985e273/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
index cf76cbb..20a2d6d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
@@ -20,7 +20,9 @@
 package org.apache.hadoop.hbase.zookeeper;
 
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 
+import org.apache.curator.shaded.com.google.common.base.Stopwatch;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
@@ -48,6 +50,15 @@ public class ZooKeeperMainServer {
     public HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(String[] args)
     throws IOException, InterruptedException {
       super(args);
+      // Make sure we are connected before we proceed. Can take a while on some systems. If we
+      // run the command without being connected, we get ConnectionLoss KeeperErrorConnection...
+      Stopwatch stopWatch = Stopwatch.createStarted();
+      while (!this.zk.getState().isConnected()) {
+        Thread.sleep(1);
+        if (stopWatch.elapsed(TimeUnit.SECONDS) > 10) {
+          throw new InterruptedException("Failed connect " + this.zk);
+        }
+      }
     }
 
     /**
@@ -100,6 +111,8 @@ public class ZooKeeperMainServer {
       }
     }
     // If command-line arguments, run our hack so they are executed.
+    // ZOOKEEPER-1897 was committed to zookeeper-3.4.6 but elsewhere in this class we say
+    // 3.4.6 breaks command-processing; TODO.
     if (hasCommandLineArguments(args)) {
       HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm =
         new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs);