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 D933FC336 for ; Sat, 1 Feb 2014 19:58:13 +0000 (UTC) Received: (qmail 17883 invoked by uid 500); 1 Feb 2014 19:58:12 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 17761 invoked by uid 500); 1 Feb 2014 19:58:12 -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 17573 invoked by uid 99); 1 Feb 2014 19:58:10 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Feb 2014 19:58:10 +0000 Date: Sat, 1 Feb 2014 19:58:10 +0000 (UTC) From: "Ted Yu (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-10448) ZKUtil create and watch methods don't set watch in some cases 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-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13888710#comment-13888710 ] Ted Yu commented on HBASE-10448: -------------------------------- I tried to apply patch on 0.98 but there was conflict in hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java.rej Also, please trim the trailing ^M at line end. Thanks > ZKUtil create and watch methods don't set watch in some cases > ------------------------------------------------------------- > > Key: HBASE-10448 > URL: https://issues.apache.org/jira/browse/HBASE-10448 > Project: HBase > Issue Type: Bug > Components: Zookeeper > Affects Versions: 0.96.0, 0.96.1.1 > Reporter: Jerry He > Fix For: 0.98.0, 0.99.0 > > Attachments: HBASE-10448-trunk.patch > > > While using the ZKUtil methods during testing, I found that watch was not set when it should be set based on the methods and method comments: > createNodeIfNotExistsAndWatch > createEphemeralNodeAndWatch > For example, in createNodeIfNotExistsAndWatch(): > {code} > public static boolean createNodeIfNotExistsAndWatch( > ZooKeeperWatcher zkw, String znode, byte [] data) > throws KeeperException { > try { > zkw.getRecoverableZooKeeper().create(znode, data, createACL(zkw, znode), > CreateMode.PERSISTENT); > } catch (KeeperException.NodeExistsException nee) { > try { > zkw.getRecoverableZooKeeper().exists(znode, zkw); > } catch (InterruptedException e) { > zkw.interruptedException(e); > return false; > } > return false; > } catch (InterruptedException e) { > zkw.interruptedException(e); > return false; > } > return true; > } > {code} > The watch is only set via exists() call when the node already exists. > Similarly in createEphemeralNodeAndWatch(): > {code} > public static boolean createEphemeralNodeAndWatch(ZooKeeperWatcher zkw, > String znode, byte [] data) > throws KeeperException { > try { > zkw.getRecoverableZooKeeper().create(znode, data, createACL(zkw, znode), > CreateMode.EPHEMERAL); > } catch (KeeperException.NodeExistsException nee) { > if(!watchAndCheckExists(zkw, znode)) { > // It did exist but now it doesn't, try again > return createEphemeralNodeAndWatch(zkw, znode, data); > } > return false; > } catch (InterruptedException e) { > LOG.info("Interrupted", e); > Thread.currentThread().interrupt(); > } > return true; > } > {code} -- This message was sent by Atlassian JIRA (v6.1.5#6160)