Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-2163

Introduce new ZNode type: container

    XMLWordPrintableJSON

Details

    Description

      BACKGROUND
      ============
      A recurring problem for ZooKeeper users is garbage collection of parent nodes. Many recipes (e.g. locks, leaders, etc.) call for the creation of a parent node under which participants create sequential nodes. When the participant is done, it deletes its node. In practice, the ZooKeeper tree begins to fill up with orphaned parent nodes that are no longer needed. The ZooKeeper APIs don’t provide a way to clean these. Over time, ZooKeeper can become unstable due to the number of these nodes.

      CURRENT SOLUTIONS
      ===================
      Apache Curator has a workaround solution for this by providing the Reaper class which runs in the background looking for orphaned parent nodes and deleting them. This isn’t ideal and it would be better if ZooKeeper supported this directly.

      PROPOSAL
      =========
      ZOOKEEPER-723 and ZOOKEEPER-834 have been proposed to allow EPHEMERAL nodes to contain child nodes. This is not optimum as EPHEMERALs are tied to a session and the general use case of parent nodes is for PERSISTENT nodes. This proposal adds a new node type, CONTAINER. A CONTAINER node is the same as a PERSISTENT node with the additional property that when its last child is deleted, it is deleted (and CONTAINER nodes recursively up the tree are deleted if empty).

      CANONICAL USAGE
      ================

      while ( true) { // or some reasonable limit
          try {
              zk.create(path, ...);
              break;
          } catch ( KeeperException.NoNodeException e ) {
              try {
                  zk.createContainer(containerPath, ...);
              } catch ( KeeperException.NodeExistsException ignore) {
             }
          }
      }
      

      Attachments

        1. zookeeper-2163.10.patch
          66 kB
          Jordan Zimmerman
        2. zookeeper-2163.11.patch
          66 kB
          Jordan Zimmerman
        3. zookeeper-2163.12.patch
          66 kB
          Jordan Zimmerman
        4. zookeeper-2163.13.patch
          66 kB
          Jordan Zimmerman
        5. zookeeper-2163.14.patch
          67 kB
          Jordan Zimmerman
        6. zookeeper-2163.15.patch
          1 kB
          Jordan Zimmerman
        7. zookeeper-2163.3.patch
          60 kB
          Jordan Zimmerman
        8. zookeeper-2163.5.patch
          73 kB
          Jordan Zimmerman
        9. zookeeper-2163.6.patch
          68 kB
          Jordan Zimmerman
        10. zookeeper-2163.7.patch
          68 kB
          Jordan Zimmerman
        11. zookeeper-2163.8.patch
          69 kB
          Jordan Zimmerman
        12. zookeeper-2163.9.patch
          66 kB
          Jordan Zimmerman

        Issue Links

          Activity

            People

              randgalt Jordan Zimmerman
              randgalt Jordan Zimmerman
              Votes:
              6 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m