[
https://issues.apache.org/jira/browse/CURATOR-357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17721295#comment-17721295
]
Kezhu Wang commented on CURATOR-357:
------------------------------------
After go through CURATOR-280, I think we should not implement such a feature.
My concerns are here:
* Consistent with ZooKeeper.
* I somewhat consider "chroot" may come from a different team. That team should
prepare "chroot" and its auths.
* It is easy to circumvent using {{client.create.forPath("/")}}. In above
concept, client itself become "that team".
Given above points, and the fact that this issue have been existed for so long
without a update from other committers, I am going to closed it as "won't fix".
> creatingParentsIfNeeded do not create "/"
> -----------------------------------------
>
> Key: CURATOR-357
> URL: https://issues.apache.org/jira/browse/CURATOR-357
> Project: Apache Curator
> Issue Type: Bug
> Components: Framework
> Reporter: Vitalii Tymchyshyn
> Priority: Major
>
> In Zookeeper there is no guaranty that "/" would exist. In a case when chroot
> feature is used, "/" path may not exists.
> Currently Curator incorrectly assumes that "/" always exists. It leads to
> NoNodeException when there is no "/" available.
> E.g. see CURATOR-280 for example.
> A solution would be to create "/" in ZKPaths#mkdirs.
> Primary concern is that it would slow down general case when entity name do
> not have path separator. Currently it does not require any additional calls,
> now "/" check would be needed.
> A solution can be to change logic to create parents only if NoNode received
> for node creation call. This would also speed up all the cases where entity
> name has separator, including when namespaces are used.
> Test:
> {code}
> public class TestChroot {
> private TestingServer server = new TestingServer();
> public TestChroot() throws Exception {
> }
> @Test
> public void testCurator() throws Exception {
> CuratorFramework client =
> CuratorFrameworkFactory.newClient(server.getConnectString() +
> "/chrootCurator", new RetryOneTime(1000));
> client.start();
> client.create().creatingParentsIfNeeded().forPath("/test", new
> byte[]{1});
> Assert.assertEquals(1, client.getData().forPath("/test")[0]);
> }
> @Test
> public void testZookeeper() throws Exception {
> CuratorFramework client =
> CuratorFrameworkFactory.newClient(server.getConnectString() + "/chrootZoo",
> new RetryOneTime(1000));
> client.start();
> ZooKeeper zooKeeper = client.getZookeeperClient().getZooKeeper();
> zooKeeper.create("/", new byte[]{}, ZooDefs.Ids.OPEN_ACL_UNSAFE,
> CreateMode.PERSISTENT);
> zooKeeper.create("/test", new byte[]{1}, ZooDefs.Ids.OPEN_ACL_UNSAFE,
> CreateMode.PERSISTENT);
> Assert.assertEquals(1, client.getData().forPath("/test")[0]);
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)