virajjasani commented on a change in pull request #345: HBASE-22638 : Zookeeper Utility enhancements URL: https://github.com/apache/hbase/pull/345#discussion_r300344249
########## 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: Thanks and totally agree @HorizonNet . Updated the PR. Please continue. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services