Skip to content

Conversation

@jacob-netguardians
Copy link

Issues

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

Fixes #2965

Description

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

If two nodes try to register at about the same time in the cluster, there may be a race condition while effectively adding the instances to the cluster description in zookeeper (the second one seeing an incomplete node hierarchy and later on refusing to accept tasks). Having an atomic creation of those nodes in zookeeper should prevent that.

Tests

  • The following tests are written for this issue:

No additional tests.

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.

One thing is the helix format.

Second, please add test. You can just leave an existing node there to see whether this failure is something expected behavior.

Reformatted changed file according to the "helix format"
@jacob-netguardians
Copy link
Author

Formatted the code in "helix format". It did not only touch the lines I had modified.

For the test, I am sorry, I do not know how to reproduce the situation in a controlled way in a test.
The problem appeared from time to time in my integration tests, and I already spent a few hours tracking it down to this.

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.

In general, a good practice is splitting PR into: 1) purely logic change, 2) purely reformat / refactoring without touch logic.

"SwapOutInstance {} is {} + {} and SwapInInstance {} is OFFLINE + {} for cluster {}. Swap will"
+ " not complete unless SwapInInstance instance is ONLINE.",
swapOutInstanceName, swapOutLiveInstance != null ? "ONLINE" : "OFFLINE",
+ " not complete unless SwapInInstance instance is ONLINE.", swapOutInstanceName,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest not to do entire file reformat, hard for reviewing if it is format change or logical change.

Copy link
Author

Choose a reason for hiding this comment

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

Should be better now.

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.

Race condition while registering nodes

2 participants