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

Enhance ZkHelixVerifier and its related subclass to take a default wait period #1328

Merged
merged 7 commits into from
Sep 13, 2020

Conversation

kaisun2000
Copy link
Contributor

@kaisun2000 kaisun2000 commented Aug 27, 2020

Issues

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

Resolve #1321

Description

  • Here are some details about my PR, including screenshots of any UI changes:
    Due to Need a better way to verify (wait) if the partition assignment converged or not. #526, currently we have random sleep() in the test before verifyByPolling().
    This cause test failure in different environment. Here we enhance ZKHelixVerifier
    family with an option in builder to add a waiting period. To keep it backward
    compatible, without enable this waiting option, the code would behave exactly the
    same as before.

Tests

  • The following tests are written for this issue:

None

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

Running

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)

@kaisun2000 kaisun2000 changed the title Implement TestBestPossibleExternalViewVerifier #1321 Implement TestBestPossibleExternalViewVerifier Aug 28, 2020
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.

Many tests (especially WAGED tests) are using StrictMatchExternalViewVerifier. We need to do the same for that too.

Overall, my suggestion is still to add waiting to the specific test case where need it. This generic cooling down logic does not look reasonable to me. The cooldown shall be with the test logic.

One alternative way is that we add a parameter to the verify method that you can specify a cooldown in the caller logic. Could you please consider this solution?

Kai Sun added 4 commits September 9, 2020 17:17
TestBestPossibleExternalViewVerifier would have a default COOL_DOWN period
before verifyByPolling. Due to apache#526, currently we have randow sleep in the
test before verifyByPolling. We intend to use TestBestPossibeVerifier
instead in our unit test.  While keep using BestPossibleExternalViewVerifier
in production code.
@kaisun2000
Copy link
Contributor Author

Many tests (especially WAGED tests) are using StrictMatchExternalViewVerifier. We need to do the same for that too.

Overall, my suggestion is still to add waiting to the specific test case where need it. This generic cooling down logic does not look reasonable to me. The cooldown shall be with the test logic.

One alternative way is that we add a parameter to the verify method that you can specify a cooldown in the caller logic. Could you please consider this solution?

I did a search of places using verifyByPolling(). There are between 150 to 200 places.

So shall we have another one called as the following?

public boolean verifyByPolling(long timeout, long period, long cooldown) {

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!

@kaisun2000
Copy link
Contributor Author

This diff is approve, please help to merge into trunk.

TestBestPossibleExternalViewVerifier would have a default COOL_DOWN period
before verifyByPolling. Due to #526, currently we have randow sleep in the
test before verifyByPolling. We intend to use TestBestPossibeVerifier
instead in our unit test. While keep using BestPossibleExternalViewVerifier
in production code.

@jiajunwang
Copy link
Contributor

jiajunwang commented Sep 12, 2020

This diff is approve, please help to merge into trunk.

TestBestPossibleExternalViewVerifier would have a default COOL_DOWN period
before verifyByPolling. Due to #526, currently we have randow sleep in the
test before verifyByPolling. We intend to use TestBestPossibeVerifier
instead in our unit test. While keep using BestPossibleExternalViewVerifier
in production code.

@kaisun2000 please update the comment, it has diverged from the code change quite a lot. Please do take care of the final comment message, once it is in, we don't have a way to modify except reverting the PR.

There are good reasons that we request the author to confirm the final message, instead of just copy-paste from the PR description. And the author should not copy-paste either.

@kaisun2000
Copy link
Contributor Author

Good point. I did not realize the previous commit message not applying anymore. Let me update it.

@kaisun2000 kaisun2000 changed the title Implement TestBestPossibleExternalViewVerifier Enhance ZkHelixVerifier and its related subclass to take a default wait period Sep 12, 2020
@kaisun2000
Copy link
Contributor Author

This diff is approved, please help to merge.

Due to #526, currently we have random sleep() in the test before verifyByPolling().
This cause test failure in different environment. Here we enhance ZKHelixVerifier
family with an option in builder to add a waiting period. To keep it backward
compatible, without enable this waiting option, the code would behave exactly the
same as before.

@huizhilu huizhilu merged commit 35ac0ff into apache:master Sep 13, 2020
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.

Refactor Test BestPossibleExternalViewVerifier
4 participants