Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D481010DA7 for ; Thu, 17 Apr 2014 20:49:53 +0000 (UTC) Received: (qmail 33569 invoked by uid 500); 17 Apr 2014 20:49:19 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 33404 invoked by uid 500); 17 Apr 2014 20:49:17 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 33312 invoked by uid 99); 17 Apr 2014 20:49:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Apr 2014 20:49:16 +0000 Date: Thu, 17 Apr 2014 20:49:16 +0000 (UTC) From: "Jerry He (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HBASE-11018) ZKUtil.getChildDataAndWatchForNewChildren() will not return null as indicated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-11018?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jerry He updated HBASE-11018: ----------------------------- Fix Version/s: 0.99.0 Status: Patch Available (was: Open) > ZKUtil.getChildDataAndWatchForNewChildren() will not return null as indicated > ----------------------------------------------------------------------------- > > Key: HBASE-11018 > URL: https://issues.apache.org/jira/browse/HBASE-11018 > Project: HBase > Issue Type: Bug > Components: Zookeeper > Affects Versions: 0.98.1, 0.96.1 > Reporter: Jerry He > Assignee: Jerry He > Priority: Minor > Fix For: 0.99.0 > > Attachments: HBASE-11018-trunk.patch > > > While working on HBase acl, I found out that ZKUtil.getChildDataAndWatchForNewChildren() will not return null as indicated. Here is the code: > {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 getChildDataAndWatchForNewChildren( > ZooKeeperWatcher zkw, String baseNode) throws KeeperException { > List nodes = > ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode); > List newNodes = new ArrayList(); > 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; > } > {code} > 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() > {code} > public void start() throws KeeperException { > watcher.registerListener(this); > if (ZKUtil.watchAndCheckExists(watcher, aclZNode)) { > List existing = > ZKUtil.getChildDataAndWatchForNewChildren(watcher, aclZNode); > if (existing != null) { > refreshNodes(existing); > } > } > } > {code} > We test the 'null' return from the call which becomes the problem. -- This message was sent by Atlassian JIRA (v6.2#6252)