curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Vines (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-128) There is no namespace-safe way to refer to the root node
Date Tue, 29 Jul 2014 13:05:38 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14077685#comment-14077685
] 

John Vines commented on CURATOR-128:
------------------------------------

It seems like a really large inconsistency that can cause unexpected errors to users if they
are using CuratorFramework's in both the root namespace and a non-root namespace because they
need different logic for building paths in each.

> There is no namespace-safe way to refer to the root node
> --------------------------------------------------------
>
>                 Key: CURATOR-128
>                 URL: https://issues.apache.org/jira/browse/CURATOR-128
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Framework
>            Reporter: Scott Blum
>
> Add the following test to TestNamespaceFacade:
> {code}
>     @Test
>     public void     testRootAccess() throws Exception
>     {
>         CuratorFramework    client = CuratorFrameworkFactory.newClient(server.getConnectString(),
new RetryOneTime(1));
>         try
>         {
>             client.start();
>             client.create().forPath("/one");
>             Assert.assertNotNull(client.getZookeeperClient().getZooKeeper().exists("/one",
false));
>             Assert.assertNotNull(client.checkExists().forPath("/"));
>             try
>             {
>                 client.checkExists().forPath("");
>                 Assert.fail("IllegalArgumentException expected");
>             }
>             catch ( IllegalArgumentException expected )
>             {
>             }
>             Assert.assertNotNull(client.usingNamespace("one").checkExists().forPath(""));
>             try
>             {
>                 client.usingNamespace("one").checkExists().forPath("/");
>                 Assert.fail("IllegalArgumentException expected");
>             }
>             catch ( IllegalArgumentException expected )
>             {
>             }
>         }
>         finally
>         {
>             CloseableUtils.closeQuietly(client);
>         }
>     }
> {code}
> This tests PASSES, which means that there's no canonical way to refer to the root node.
 If the client is not namespaced, "/" works and "" does not work.  If the client is namespaced,
"" works and "/" does not.
> In either case, I think ZKPaths.makePath mishandles certain cases.
> If you append "/foo" and "/" the result is "/foo/" which is an invalid path.
> On the other hand, if you append "" and "bar" the result is "//bar" which is also invalid.
> What's the right behavior here?  Does the root node / root of a namespace always need
to be referred to as "/" or is empty string an acceptable alias?



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message