You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2022/11/30 20:18:56 UTC

[GitHub] [helix] qqu0127 opened a new issue, #2299: AssignableReplica breaking hashCode and equals contracts

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: reviews-unsubscribe@helix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


Re: [I] AssignableReplica breaking hashCode and equals contracts [helix]

Posted by "junkaixue (via GitHub)" <gi...@apache.org>.
junkaixue closed issue #2299: AssignableReplica breaking hashCode and equals contracts
URL: https://github.com/apache/helix/issues/2299


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org