Skip to content

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

Merged
anmolnar merged 2 commits intoapache:masterfrom
kezhuw:ZOOKEEPER-4915-znode.container.maxNeverUsedIntervalMs-default-value
Dec 16, 2025
Merged

ZOOKEEPER-4915: Default znode.container.maxNeverUsedIntervalMs to 5 minutes#2248
anmolnar merged 2 commits intoapache:masterfrom
kezhuw:ZOOKEEPER-4915-znode.container.maxNeverUsedIntervalMs-default-value

Conversation

@kezhuw
Copy link
Copy Markdown
Member

@kezhuw kezhuw commented Apr 20, 2025

This will delete container nodes that never had any children after approximately 5 minutes.

Given this property, you should be prepared to get KeeperException.NoNodeException
when creating children inside of this container node

Container nodes are supposed to be deleted after all children deleted, so from client's perspective this change has no harm. And also, it leaves no unused nodes in data tree.

…inutes

This will delete container nodes that never had any children after
approximately 5 minutes.

> Given this property, you should be prepared to get `KeeperException.NoNodeException`
> when creating children inside of this container node

Container nodes are supposed to be deleted after all children deleted,
so from client's perspective this change has no harm. And also, it
leaves no unused nodes in data tree.
@kezhuw kezhuw force-pushed the ZOOKEEPER-4915-znode.container.maxNeverUsedIntervalMs-default-value branch from bd7ca89 to 3121b0d Compare June 26, 2025 00:40
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))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default 5-minute cleanup is a breaken change and is not recommended i think.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it break things ? Container nodes with no children are supposed to be deleted.

/**
* The znode will be a container node. Container
* nodes are special purpose nodes useful for recipes such as leader, lock,
* etc. When the last child of a container is deleted, the container becomes
* a candidate to be deleted by the server at some point in the future.
* Given this property, you should be prepared to get
* {@link org.apache.zookeeper.KeeperException.NoNodeException}
* when creating children inside of this container node.
*/
CONTAINER(4, false, false, true, false),

Copy link
Copy Markdown
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me.
Any unit tests to add?

@kezhuw
Copy link
Copy Markdown
Member Author

kezhuw commented Dec 15, 2025

@anmolnar Thank you for reviewing! Test added in fixup commit.

@anmolnar
Copy link
Copy Markdown
Contributor

@anmolnar Thank you for reviewing! Test added in fixup commit.

Test only validates the default configuration. Why don't you make a test which creates a container node, waits and validates it has been deleted.

@kezhuw
Copy link
Copy Markdown
Member Author

kezhuw commented Dec 16, 2025

Why don't you make a test which creates a container node, waits and validates it has been deleted.

CreateContainerTest::testMaxNeverUsedInterval has already covered this.

@anmolnar
Copy link
Copy Markdown
Contributor

Why don't you make a test which creates a container node, waits and validates it has been deleted.

CreateContainerTest::testMaxNeverUsedInterval has already covered this.

Now I see it. Previously the default value was indefinite, but you change it to 5 minutes in this patch. Okay, let's do this.

@anmolnar anmolnar merged commit f9fa0cc into apache:master Dec 16, 2025
16 checks passed
Copy link
Copy Markdown
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants