Hadriel Kaplan created ZOOKEEPER-2648:
-----------------------------------------

             Summary: Container node never gets deleted if it never had children
                 Key: ZOOKEEPER-2648
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2648
             Project: ZooKeeper
          Issue Type: Bug
          Components: server
    Affects Versions: 3.5.0
            Reporter: Hadriel Kaplan


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.







--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to