HorizonNet commented on a change in pull request #345: HBASE-22638 : Zookeeper 
Utility enhancements
URL: https://github.com/apache/hbase/pull/345#discussion_r300343274
 
 

 ##########
 File path: 
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
 ##########
 @@ -1860,32 +1873,35 @@ private static void getReplicationZnodesDump(ZKWatcher 
zkw, StringBuilder sb)
     // do a ls -r on this znode
     sb.append("\n").append(replicationZnode).append(": ");
     List<String> children = ZKUtil.listChildrenNoWatch(zkw, replicationZnode);
-    Collections.sort(children);
-    for (String child : children) {
-      String znode = ZNodePaths.joinZNode(replicationZnode, child);
-      if (znode.equals(zkw.getZNodePaths().peersZNode)) {
-        appendPeersZnodes(zkw, znode, sb);
-      } else if (znode.equals(zkw.getZNodePaths().queuesZNode)) {
-        appendRSZnodes(zkw, znode, sb);
-      } else if (znode.equals(zkw.getZNodePaths().hfileRefsZNode)) {
-        appendHFileRefsZnodes(zkw, znode, sb);
+    if (children != null) {
+      Collections.sort(children);
+      for (String child : children) {
+        String zNode = ZNodePaths.joinZNode(replicationZnode, child);
+        if (zNode.equals(zkw.getZNodePaths().peersZNode)) {
+          appendPeersZnodes(zkw, zNode, sb);
+        } else if (zNode.equals(zkw.getZNodePaths().queuesZNode)) {
+          appendRSZnodes(zkw, zNode, sb);
+        } else if (zNode.equals(zkw.getZNodePaths().hfileRefsZNode)) {
+          appendHFileRefsZnodes(zkw, zNode, sb);
+        }
       }
     }
   }
 
   private static void appendHFileRefsZnodes(ZKWatcher zkw, String 
hfileRefsZnode,
                                             StringBuilder sb) throws 
KeeperException {
     sb.append("\n").append(hfileRefsZnode).append(": ");
-    for (String peerIdZnode : ZKUtil.listChildrenNoWatch(zkw, hfileRefsZnode)) 
{
-      String znodeToProcess = ZNodePaths.joinZNode(hfileRefsZnode, 
peerIdZnode);
-      sb.append("\n").append(znodeToProcess).append(": ");
-      List<String> peerHFileRefsZnodes = ZKUtil.listChildrenNoWatch(zkw, 
znodeToProcess);
-      int size = peerHFileRefsZnodes.size();
-      for (int i = 0; i < size; i++) {
-        sb.append(peerHFileRefsZnodes.get(i));
-        if (i != size - 1) {
-          sb.append(", ");
-        }
+    final List<String> hFileRefChildrenNoWatchList =
+            ZKUtil.listChildrenNoWatch(zkw, hfileRefsZnode);
+    if (hFileRefChildrenNoWatchList == null) {
 
 Review comment:
   Saw the comment and agree, but we should try to be consistent. If we do it 
with the return statement we should do it in all other places. Because the PR 
uses `xxx != null` in all other places it should be the same here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to