Skip to content
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

Fix TestClusterAggregateMetrics #1842

Merged

Conversation

NealSun96
Copy link
Contributor

Issues

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

Fixes #1806

Description

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

Fix flaky TestClusterAggregateMetrics by wrapping maintenance mode around batch enabling of instances, otherwise the events may be processed separately, resulting in an intermediate best possible state that does not represent the final state.

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)

@NealSun96
Copy link
Contributor Author

This PR is ready to be merged, approved by @junkaixue
Final commit message:

Fix TestClusterAggregateMetrics

@jiajunwang
Copy link
Contributor

A better way, or IMHO the correct way, is to wait until the cluster state converged. The main reason we might get unexpected results is that the controller is still rebalancing the cluster while the assert check happens. Given that saying, the current change will reduce the error by reducing pipeline running. But it is not guaranteed since only one pipeline can still run slowly.

Could you please change the test logic to wait until the cluster converges then start validation? Note the verifier should support validate instance state in the call. So you can specify the expected disabled nodes in the same check to ensure verifier does not return prematurely.

Copy link
Contributor

@jiajunwang jiajunwang left a comment

Choose a reason for hiding this comment

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

As I commented, I think the current fix does not completely fix the problem. Please take a look and let me know if you think it makes sense : )

@NealSun96
Copy link
Contributor Author

@jiajunwang On line 178 we have Assert.assertTrue(verifier.verifyByPolling()); That checks for cluster convergence like you said.

The previous test causes the verifier to mistakenly verify an intermediate state instead of the final state; adding the maintenance mode should mitigate that, and let the verifier do its job.

@jiajunwang
Copy link
Contributor

@jiajunwang On line 178 we have Assert.assertTrue(verifier.verifyByPolling()); That checks for cluster convergence like you said.

The previous test causes the verifier to mistakenly verify an intermediate state instead of the final state; adding the maintenance mode should mitigate that, and let the verifier do its job.

I had the impression that this verifier is not enough if not validating disabled nodes during the wait. But I guess you are right that what we've done here is the best possible way for NOW. Eventually, we need to fix #526.
Let's keep the PR unchanged, it shall minimize the failure.

Copy link
Contributor

@jiajunwang jiajunwang left a comment

Choose a reason for hiding this comment

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

LGTM!

@alirezazamani alirezazamani merged commit 545d2dc into apache:master Sep 21, 2021
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.

[Failed CI Test] testAggregateMetrics(org.apache.helix.monitoring.mbeans.TestClusterAggregateMetrics)
4 participants