You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Guo Jiwei (Jira)" <ji...@apache.org> on 2020/08/02 01:53:00 UTC

[jira] [Created] (ZOOKEEPER-3904) Remove duplicate check

Guo Jiwei created ZOOKEEPER-3904:
------------------------------------

             Summary: Remove duplicate check
                 Key: ZOOKEEPER-3904
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3904
             Project: ZooKeeper
          Issue Type: Improvement
            Reporter: Guo Jiwei


ContainerManager#getCandidates:
```
if ((node != null) && node.getChildren().isEmpty()) {
                /*
                    cversion > 0: keep newly created containers from being deleted
                    before any children have been added. If you were to create the
                    container just before a container cleaning period the container
                    would be immediately be deleted.
                 */
                if (node.stat.getCversion() > 0) {
                    candidates.add(containerPath);
```
It has already checked the below logic, so no need to do it one more time.
```
if ((node != null) && (node.stat.getCversion() > 0) && (node.getChildren().isEmpty())) {
                candidates.add(containerPath);
            }
```





--
This message was sent by Atlassian Jira
(v8.3.4#803005)