You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2024/05/06 07:37:56 UTC

(hbase) branch branch-2.6 updated: HBASE-28567 Race condition causes MetaRegionLocationCache to never set watcher to populate meta location (#5874)

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

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


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

commit f2fb0bf21a374685970d6dfbc015eb55fe9ef9ff
Author: Vincent Poon <vi...@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 <zh...@apache.org>
    Signed-off-by: Viraj Jasani <vj...@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);
   }