Skip to content

Conversation

@LZD-PratyushBhatt
Copy link

@LZD-PratyushBhatt LZD-PratyushBhatt commented May 8, 2025

Issues

  • My PR addresses the following Helix issues and references them in the PR description:

(#200 - Link your issue number here: You can write "Fixes #XXX". Please use the proper keyword so that the issue gets closed automatically. See https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue
Any of the following keywords can be used: close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved)
This PR fixes #3036 TTL Znode doesn't expire in Test envs

Description

  • Here are some details about my PR, including screenshots of any UI changes:

(Write a concise description including what, why, how)
The issue is related to ZooKeeper's TTL (Time-To-Live) node functionality and specifically how it behaves in the embedded ZooKeeper environment used in tests.

In a normal ZooKeeper deployment, a background ContainerManager thread runs periodically to clean up expired TTL nodes. However, in the embedded ZooKeeper used for testing, this background thread doesn't appear to be functioning properly. The ContainerManager is designed to run on a configurable schedule (default is 60 seconds), but in the test environment, this cleanup process doesn't happen.

The way we solve it is by creating a custom ContainerManager and using a fakeElapsedTimer.

Tests

  • The following tests are written for this issue:
    No new tests, but old tests modified.

(List the names of added unit/integration tests)

  • The following is the result of the "mvn test" command on the appropriate module:

(If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)

Changes that Break Backward Compatibility (Optional)

  • My PR contains changes that break backward compatibility or previous assumptions for certain methods or API. They include:

(Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)

Documentation (Optional)

  • In case of new functionality, my PR adds documentation in the following wiki page:

(Link the GitHub wiki you added)

Commits

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Code Quality

  • My diff has been formatted using helix-style.xml
    (helix-style-intellij.xml if IntelliJ IDE is used)

Copy link
Contributor

@junkaixue junkaixue left a comment

Choose a reason for hiding this comment

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

This is a good start of the work! Make sure not breaking the test. But happy to see the tests to be stablized later.

@LZD-PratyushBhatt
Copy link
Author

This is a good start of the work! Make sure not breaking the test. But happy to see the tests to be stablized later.

Hi @junkaixue , fixed the test issues, triggered CI through my fork, it seems to be passing now: https://github.com/LZD-PratyushBhatt/helix/actions/runs/15034195323/job/42252802394?pr=1

Comment on lines +158 to +160
public ZooKeeperServer getZooKeeperServer() {
return _zk;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using Helix style to format it? It looked wired. For the place you touched, we should fix it. Maybe it was not handled before.

Copy link
Author

Choose a reason for hiding this comment

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

Hi @junkaixue , What do we mean by "helix style" here? I had earlier formatted the method in same way just as the getZkClient method above this.

/**
* Creates a ContainerManager with custom elapsed time functionality for a ZkServer
*/
private static ContainerManager createContainerManager(ZkServer zkServer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function has been repeated. Better make it as Util or in base class.

Copy link
Author

Choose a reason for hiding this comment

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

One is in helix-core module and other is in zookeeper-api. And in zookeeper-api I dont see any packaging of test classes being done. So if we make this common then we will need to modify pom.xml in some places.

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.

TTL Znode doesn't expire in Test envs

3 participants