You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Ted Yu (JIRA)" <ji...@apache.org> on 2014/02/02 00:06:09 UTC
[jira] [Resolved] (HBASE-10448) ZKUtil create and watch methods
don't set watch in some cases
[ https://issues.apache.org/jira/browse/HBASE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ted Yu resolved HBASE-10448.
----------------------------
Resolution: Fixed
Assignee: Jerry He
Hadoop Flags: Reviewed
Integrated to 0.98 and trunk.
Thanks for the patch, Jerry.
> 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
> Assignee: 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)