This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 7da84c2d687 HBASE-28567 Race condition causes MetaRegionLocationCache 
to never set watcher to populate meta location (#5874)
7da84c2d687 is described below

commit 7da84c2d6873eaf88e4883221b423ff12e6711bb
Author: Vincent Poon <vincentp...@users.noreply.github.com>
AuthorDate: Mon May 6 00:16:19 2024 -0700

    HBASE-28567 Race condition causes MetaRegionLocationCache to never set 
watcher to populate meta location (#5874)
    
    Signed-off-by: Duo Zhang <zhang...@apache.org>
    Signed-off-by: Viraj Jasani <vjas...@apache.org>
    (cherry picked from commit ce113dd3f4e9bd92d799fedbf684e8b0eb9b7a4b)
---
 .../src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java   | 5 +++++
 1 file changed, 5 insertions(+)

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 3879cb7ba91..5af7de5678c 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 class ZKWatcher implements Watcher, Abortable, 
Closeable {
   public List<String> getMetaReplicaNodesAndWatchChildren() throws 
KeeperException {
     List<String> 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);
   }
 

Reply via email to