jiajunwang opened a new pull request #986: URL: https://github.com/apache/helix/pull/986
### Issues - [X] My PR addresses the following Helix issues and references them in the PR description: #985 ### Description - [X] Here are some details about my PR, including screenshots of any UI changes: The old state assignment logic assign the states to selected nodes according to the priority of the current replica state that is on the instance. Moreover, the sorting algorithm is designed to prioritize both current topstate and current secondary states equally. The result is that we will have premature mastership handoff to a current seconardy state host before the real desired master host is ready. For example, 1. The current states are: [N1:M, N2:S, N3,S] 2. The desired states are: [N4:M, N2:S, N1:S] 3. Due to the sorting logic based on current states, we will have a transient preference list ordered like: [N2, N1, N4]. In which case, the controller will assign master to N2 before N4 has a slave state replica. 4. When N4 finishes the Offline to Slave transition, the same sorting logic will sort the preference list to be: [N4, N2, N1]. Then we have another mastership handoff. To be clear, we don't want step 3. But only the state transition in step 4. In this PR, we refactor the sorting logic so that it will only move the master whenever the candidate has a "ready" state replica, in which case, only one mastership handoff happens. ### Tests - [X] The following tests are written for this issue: Add the test scenario to TestAbstractRebalancer. - [X] The following is the result of the "mvn test" command on the appropriate module: [INFO] Results: [INFO] [ERROR] Failures: [ERROR] TestJobQueueCleanUp.testJobQueueAutoCleanUp ยป ThreadTimeout Method org.testng.... [ERROR] TestWorkflowTimeout.testWorkflowTimeoutWhenWorkflowCompleted:116 expected:<true> but was:<false> [INFO] [ERROR] Tests run: 1145, Failures: 2, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:21 h [INFO] Finished at: 2020-04-30T23:30:07-07:00 [INFO] ------------------------------------------------------------------------ Rerun: [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 30.931 s - in TestSuite [INFO] [INFO] Results: [INFO] [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 37.212 s [INFO] Finished at: 2020-04-30T23:32:13-07:00 [INFO] ------------------------------------------------------------------------ ### Commits - [X] 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](http://chris.beams.io/posts/git-commit/)": 1. Subject is separated from body by a blank line 1. Subject is limited to 50 characters (not including Jira issue reference) 1. Subject does not end with a period 1. Subject uses the imperative mood ("add", not "adding") 1. Body wraps at 72 characters 1. Body explains "what" and "why", not "how" ### Documentation (Optional) - [ ] In case of new functionality, my PR adds documentation in the following wiki page: (Link the GitHub wiki you added) ### Code Quality - [X] My diff has been formatted using helix-style.xml (helix-style-intellij.xml if IntelliJ IDE is used) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
