Skip to content

ZOOKEEPER-4915: Default znode.container.maxNeverUsedIntervalMs to 5 minutes #2248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
Original file line number Diff line number Diff line change
@@ -2146,8 +2146,9 @@ Both subsystems need to have sufficient amount of threads to achieve peak read t
maximum interval in milliseconds that a container that has never had
any children is retained. Should be long enough for your client to
create the container, do any needed work and then create children.
Default is "0" which is used to indicate that containers
that have never had any children are never deleted.
Default is "300000"(a.k.a. 5 minutes) since 3.10.0, for earlier versions,
it is "0" which is used to indicate that containers that have never had
any children are never deleted.

<a name="sc_debug_observability_config"></a>

Original file line number Diff line number Diff line change
@@ -50,6 +50,20 @@ public class ContainerManager {
private final Timer timer;
private final AtomicReference<TimerTask> task = new AtomicReference<>(null);

/**
* @param zkDb the ZK database
* @param requestProcessor request processor - used to inject delete
* container requests
*/
public ContainerManager(ZKDatabase zkDb, RequestProcessor requestProcessor) {
this(
zkDb, requestProcessor,
Integer.getInteger("znode.container.checkIntervalMs", (int) TimeUnit.MINUTES.toMillis(1)),
Integer.getInteger("znode.container.maxPerMinute", 10000),
Long.getLong("znode.container.maxNeverUsedIntervalMs", TimeUnit.MINUTES.toMillis(5))
);
}

/**
* @param zkDb the ZK database
* @param requestProcessor request processor - used to inject delete
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@

import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.management.JMException;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.zookeeper.audit.ZKAuditProvider;
@@ -168,13 +167,7 @@ public void runFromConfig(ServerConfig config) throws IOException, AdminServerEx
secureCnxnFactory.startup(zkServer, needStartZKServer);
}

containerManager = new ContainerManager(
zkServer.getZKDatabase(),
zkServer.firstProcessor,
Integer.getInteger("znode.container.checkIntervalMs", (int) TimeUnit.MINUTES.toMillis(1)),
Integer.getInteger("znode.container.maxPerMinute", 10000),
Long.getLong("znode.container.maxNeverUsedIntervalMs", 0)
);
containerManager = new ContainerManager(zkServer.getZKDatabase(), zkServer.firstProcessor);
containerManager.start();
ZKAuditProvider.addZKStartStopAuditLog();

Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@
package org.apache.zookeeper.server.quorum;

import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import javax.management.JMException;
import org.apache.zookeeper.KeeperException.SessionExpiredException;
@@ -78,13 +77,7 @@ protected void setupRequestProcessors() {
}

private synchronized void setupContainerManager() {
containerManager = new ContainerManager(
getZKDatabase(),
prepRequestProcessor,
Integer.getInteger("znode.container.checkIntervalMs", (int) TimeUnit.MINUTES.toMillis(1)),
Integer.getInteger("znode.container.maxPerMinute", 10000),
Long.getLong("znode.container.maxNeverUsedIntervalMs", 0)
);
containerManager = new ContainerManager(getZKDatabase(), prepRequestProcessor);
}

@Override