diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java index 3879cb7ba911..5af7de5678c0 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java @@ -460,6 +460,11 @@ public List getMetaReplicaNodes() throws KeeperException { public List getMetaReplicaNodesAndWatchChildren() throws KeeperException { List childrenOfBaseNode = ZKUtil.listChildrenAndWatchForNewChildren(this, znodePaths.baseZNode); + // Need to throw here instead of returning an empty list if the base znode hasn't been created + // Caller should retry in that case, versus thinking the base znode has a watcher set + if (childrenOfBaseNode == null) { + keeperException(new KeeperException.NoNodeException(znodePaths.baseZNode)); + } return filterMetaReplicaNodes(childrenOfBaseNode); }