diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java index 8cf24d7e13c..4f584e105d2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java @@ -59,8 +59,18 @@ public class ZKVisibilityLabelWatcher extends ZooKeeperListener { public void start() throws KeeperException { watcher.registerListener(this); - ZKUtil.watchAndCheckExists(watcher, labelZnode); - ZKUtil.watchAndCheckExists(watcher, userAuthsZnode); + if (ZKUtil.watchAndCheckExists(watcher, labelZnode)) { + byte[] data = ZKUtil.getDataAndWatch(watcher, labelZnode); + if (data != null) { + refreshVisibilityLabelsCache(data); + } + } + if (ZKUtil.watchAndCheckExists(watcher, userAuthsZnode)) { + byte[] data = ZKUtil.getDataAndWatch(watcher, userAuthsZnode); + if (data != null) { + refreshUserAuthsCache(data); + } + } } private void refreshVisibilityLabelsCache(byte[] data) {