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

Container node never gets deleted if it never had children

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Bug
    • 3.5.0
    • None
    • server
    • None

    Description

      If a client creates a Container node, but does not also create a child within that Container, the Container will never be deleted. This may seem like a bug in the client for not subsequently creating a child, but we can't assume the client remains connected, or that the client didn't just change its mind (due to some recipe being canceled, for example).

      The bug is in ContainerManager.getCandidates(), which only considers a node a candidate if its Cversion > 0. The comments indicate this was done intentionally, to avoid a race condition whereby the Container was created right before a cleaning period, and would get cleaned up before the child could be created - so to avoid that the check is performed to verify the Cversion > 0.

      Instead, I propose that if the Cversion is 0 but the Ctime is more than a checkIntervalMs old, then it be deleted. In other words, if the Container node has been around for a whole cleaning round already and no child has been created since, then go ahead and clean it up.

      I can provide a patch if others agree with such a change.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Hadriel Hadriel Kaplan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: