csudharsanan commented on code in PR #2699:
URL: https://github.com/apache/helix/pull/2699#discussion_r1456492308
##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/AssignableNode.java:
##########
@@ -253,18 +276,46 @@ public float
getGeneralProjectedHighestUtilization(Map<String, Integer> newUsage
* @return The highest utilization number of the node among all the capacity
category.
*/
public float getTopStateProjectedHighestUtilization(Map<String, Integer>
newUsage) {
- return getProjectedHighestUtilization(newUsage,
_remainingTopStateCapacity);
+ return getProjectedHighestUtilization(newUsage,
_remainingTopStateCapacity, null);
+ }
+
+ /**
+ * Return the most concerning capacity utilization number for evenly
partition assignment.
+ * The method dynamically calculates the projected highest utilization
number among all the
+ * capacity categories assuming the new capacity usage is added to the node.
+ *
+ * If the preferredScoringKey is specified then utilization number is
computed based op the
+ * specified capacity category (key) only.
+ *
+ * For example, if the current node usage is {CPU: 0.9, MEM: 0.4, DISK:
0.6}, preferredScoringKey: CPU
+ * Then this call shall return 0.9.
+ *
+ * This function returns projected highest utilization for only top state
partitions.
+ *
+ * @param newUsage the proposed new additional capacity usage.
+ * @param preferredScoringKey if provided, the capacity utilization will be
calculated based on
+ * the supplied key only, else across all
capacity categories.
+ * @return The highest utilization number of the node among all the capacity
category.
+ */
+ public float getTopStateProjectedHighestUtilization(Map<String, Integer>
newUsage, String preferredScoringKey) {
+ return getProjectedHighestUtilization(newUsage,
_remainingTopStateCapacity, preferredScoringKey);
}
private float getProjectedHighestUtilization(Map<String, Integer> newUsage,
- Map<String, Integer> remainingCapacity) {
+ Map<String, Integer> remainingCapacity, String preferredScoringKey) {
+ Set<String> capacityKeySet = _maxAllowedCapacity.keySet();
+ if (preferredScoringKey != null &&
capacityKeySet.contains(preferredScoringKey)) {
+ capacityKeySet = ImmutableSet.of(preferredScoringKey);
Review Comment:
let me know if my understanding of the question is not right. I believe by
dimensions you mean the capacity keys.
preferredScoringKey will override others if present. but it has to be set up
at cluster configs explicitly. if not set, we will need all the dimensions for
computation.
--
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]