jiajunwang commented on a change in pull request #520: Refactoring soft
constraints to simply the algorithm and fix potential issues.
URL: https://github.com/apache/helix/pull/520#discussion_r337861514
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/constraints/ResourceTopStateAntiAffinityConstraint.java
##########
@@ -28,26 +28,17 @@
* The higher number the number of top state partitions assigned to the
instance, the lower the
* score, vice versa.
*/
-class ResourceTopStateAntiAffinityConstraint extends SoftConstraint {
- private static final float MAX_SCORE = 1f;
- private static final float MIN_SCORE = 0f;
-
- ResourceTopStateAntiAffinityConstraint() {
- super(MAX_SCORE, MIN_SCORE);
- }
-
+class ResourceTopStateAntiAffinityConstraint extends UsageSoftConstraint {
@Override
protected float getAssignmentScore(AssignableNode node, AssignableReplica
replica,
ClusterContext clusterContext) {
if (!replica.isReplicaTopState()) {
- return (getMaxScore() + getMinScore()) / 2.0f;
+ return 0;
Review comment:
It is somewhat smoothing. For non-topstate ones, it is all zero. Very smooth.
For topstate, it calculates the percentage.
These 2 conditions won't be true at the same time.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]