HBase
  1. HBase
  2. HBASE-11018

ZKUtil.getChildDataAndWatchForNewChildren() will not return null as indicated

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.96.1, 0.98.1
    • Fix Version/s: 0.99.0
    • Component/s: Zookeeper
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      While working on HBase acl, I found out that ZKUtil.getChildDataAndWatchForNewChildren() will not return null as indicated. Here is the code:

       /**
        ....
         * Returns null if the specified node does not exist.  Otherwise returns a
         * list of children of the specified node.  If the node exists but it has no
         * children, an empty list will be returned.
        ....
         */
        public static List<NodeAndData> getChildDataAndWatchForNewChildren(
            ZooKeeperWatcher zkw, String baseNode) throws KeeperException {
          List<String> nodes =
            ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode);
          List<NodeAndData> newNodes = new ArrayList<NodeAndData>();
          if (nodes != null) {
            for (String node : nodes) {
              String nodePath = ZKUtil.joinZNode(baseNode, node);
              byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath);
              newNodes.add(new NodeAndData(nodePath, data));
            }
          }
          return newNodes;
        }
      

      We return 'newNodes' which will never be null.

      This is a deprecated method. But it is still used in HBase code.
      For example: org.apache.hadoop.hbase.security.access.ZKPermissionWatcher.start()

        public void start() throws KeeperException {
          watcher.registerListener(this);
          if (ZKUtil.watchAndCheckExists(watcher, aclZNode)) {
            List<ZKUtil.NodeAndData> existing =
                ZKUtil.getChildDataAndWatchForNewChildren(watcher, aclZNode);
            if (existing != null) {
              refreshNodes(existing);
            }
          }
        }
      

      We test the 'null' return from the call which becomes the problem.

        Activity

        Hide
        Enis Soztutar added a comment -

        Closing this issue after 0.99.0 release.

        Show
        Enis Soztutar added a comment - Closing this issue after 0.99.0 release.
        Hide
        Hudson added a comment -

        SUCCESS: Integrated in HBase-TRUNK #5107 (See https://builds.apache.org/job/HBase-TRUNK/5107/)
        HBASE-11018 ZKUtil.getChildDataAndWatchForNewChildren() will not return null as indicated (Jerry He) (tedyu: rev 1589015)

        • /hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
        Show
        Hudson added a comment - SUCCESS: Integrated in HBase-TRUNK #5107 (See https://builds.apache.org/job/HBase-TRUNK/5107/ ) HBASE-11018 ZKUtil.getChildDataAndWatchForNewChildren() will not return null as indicated (Jerry He) (tedyu: rev 1589015) /hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
        Hide
        Ted Yu added a comment -

        Thanks for the patch, Jerry.

        Show
        Ted Yu added a comment - Thanks for the patch, Jerry.
        Hide
        chunhui shen added a comment -

        +1

        Show
        chunhui shen added a comment - +1
        Hide
        Ted Yu added a comment -

        +1

        Show
        Ted Yu added a comment - +1
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12640703/HBASE-11018-trunk.patch
        against trunk revision .
        ATTACHMENT ID: 12640703

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 lineLengths. The patch does not introduce lines longer than 100

        +1 site. The mvn site goal succeeds with this patch.

        +1 core tests. The patch passed unit tests in .

        Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//testReport/
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-protocol.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-thrift.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-client.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-hadoop2-compat.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-examples.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-prefix-tree.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-common.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-server.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-hadoop-compat.html
        Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12640703/HBASE-11018-trunk.patch against trunk revision . ATTACHMENT ID: 12640703 +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javadoc . The javadoc tool did not generate any warning messages. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 findbugs . The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. +1 lineLengths . The patch does not introduce lines longer than 100 +1 site . The mvn site goal succeeds with this patch. +1 core tests . The patch passed unit tests in . Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-protocol.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-thrift.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-client.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-hadoop2-compat.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-examples.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-prefix-tree.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-common.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-server.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//artifact/trunk/patchprocess/newPatchFindbugsWarningshbase-hadoop-compat.html Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/9321//console This message is automatically generated.

          People

          • Assignee:
            Jerry He
            Reporter:
            Jerry He
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development