maoling commented on a change in pull request #1138: ZOOKEEPER-3546 - Allow
optional deletion of never used Container Nodes
URL: https://github.com/apache/zookeeper/pull/1138#discussion_r344580946
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/ContainerManager.java
##########
@@ -139,12 +160,26 @@ protected long getMinIntervalMs() {
Set<String> candidates = new HashSet<String>();
for (String containerPath : zkDb.getDataTree().getContainers()) {
DataNode node = zkDb.getDataTree().getNode(containerPath);
- /*
- 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 != 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);
+ } else {
+ /*
+ Users may not want unused containers to live
indefinitely. Allow a system
+ property to be set that sets the max time for a
cversion-0 container
+ to stay before being deleted
+ */
+ if (getElapsed(node) > maxNeverUsedIntervalMs) {
+ candidates.add(containerPath);
+ }
Review comment:
> This is a backward compatible change as the default value for this is
Long.MAX_VALUE - i.e. never.
9223372036854775807/1000/60/60/24/365=292471209 years
200 million years are not equal to never in the context of love storys :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services