From 6858d30b13fcd135dd57cec94d0d4349ad56388d Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Mon, 16 Apr 2012 21:55:57 +0000 Subject: [PATCH] HBASE-5780 Fix race in HBase regionserver startup vs ZK SASL authentication (Shaneal) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1326814 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java b/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java index c88064edc5a..4f7fe6eea1e 100644 --- a/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java +++ b/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java @@ -75,6 +75,12 @@ public abstract class ZooKeeperNodeTracker extends ZooKeeperListener { * or {@link #getData(boolean)} to get the data of the node if it is available. */ public synchronized void start() { + try { + ZKUtil.waitForZKConnectionIfAuthenticating(watcher); + } catch (InterruptedException e) { + throw new IllegalStateException("ZookeeperNodeTracker on " + this.node + + " interuppted while waiting for SASL Authentication", e); + } this.watcher.registerListener(this); try { if(ZKUtil.watchAndCheckExists(watcher, node)) {