apache / helix

Mirror of Apache Helix
Apache License 2.0
466 stars 227 forks source link

[Not For Review] [apache/helix] -- PreferenceList Ordering Changes during Maintenance Mode #2761

Closed himanshukandwal closed 8 months ago

himanshukandwal commented 8 months ago

Issues

Description

Lets say we have 3 hosts, and here's the Current state:

{
   A: LEADER,
   B: FOLLOWER
   C: FOLLOWER
 }

Now when we create a preference-list using new ArrayList(currentState.keySet), the order in array-list depends on the hash order the keys (A, B, C). With sorting using PreferenceListNodeComparator, we put Leader at the front and ordering among Followers can be anything and could either be [A, B, C] or [A, C, B ]

Tests

There 4 tests here:

Test Case 1,2,3,4: Shows how ordering changes from existing one. current: [A, B, C] -> updated: [A, C, B]

(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)

(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)

(Link the GitHub wiki you added)

Commits

Code Quality