qqu0127 opened a new issue, #2299: URL: https://github.com/apache/helix/issues/2299
### Describe the bug In https://github.com/apache/helix/blob/master/helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/AssignableReplica.java#L127, it overrides equals, but not hashCode. This is violating the `Object.hashCode()` contract and breaking lots of assumption, especially with hash-based collection. What makes it even more awkward is the code building on top of this anti-pattern, https://github.com/apache/helix/blob/0274d5a5f9df0429cdea90bcc91d032494b91f03/helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/ClusterModelProvider.java#L450, it could contain "duplicated" elements (two standby replicas of a partition). It really should be a list to begin with. ### Expected behavior We should fix the hashCode and change to use List instead of Set to store values with duplication. ### Additional context Add any other context about the problem here. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
