Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-132

setACL doesn't work with namespaced curator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.0, 2.6.0
    • 2.7.0
    • Framework
    • None

    Description

      Experienced this on 2.3.0, doesn't seem to be resolved in 2.6.0

      Attempting to setACL with a namespaced curator fails to recognize the namespace. It seems that setACL doesn't properly pass on the Namespaced facade. The following test code is an exemplar.

      public class BreakCurator {
        public static void main(String args[]) throws Exception {
          TestingServer ts = new TestingServer();
      
          CuratorFramework curator = CuratorFrameworkFactory.builder().connectString(ts.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1000, 5)).build();
          curator.start();
          curator.getZookeeperClient().blockUntilConnectedOrTimedOut();
      
          curator.create().creatingParentsIfNeeded().forPath("/parent/child", "A string".getBytes());
          CuratorFramework curator2 = curator.usingNamespace("parent");
      
          try {
            System.out.println(new String(curator2.getData().forPath("child")));
            curator.setACL().withACL(Collections.singletonList(new ACL(ZooDefs.Perms.WRITE, ZooDefs.Ids.ANYONE_ID_UNSAFE))).forPath("/parent/child");
      // This should attempt to setACL on /parent/child, but instead fails because /child isn't present. Using "child" causes a failure because the path doesn't start with a slash
            curator2.setACL().withACL(Collections.singletonList(new ACL(ZooDefs.Perms.DELETE, ZooDefs.Ids.ANYONE_ID_UNSAFE))).forPath("/child");
            System.out.println(curator2.getACL().forPath("/child"));
          } catch (Exception e) {
            e.printStackTrace();
          }
      
          ts.close();
        }
      }
      

      Attachments

        Activity

          People

            cammckenzie Cam McKenzie
            vines John Vines
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: