-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constraints to de-prioritize nodes from becoming shard allocation targets #489
Conversation
…gets Signed-off-by: Ashwin Pankaj <appankaj@amazon.com>
✅ Gradle Wrapper Validation success 647f72a |
✅ DCO Check Passed 647f72a |
start gradle precommit |
✅ DCO Check Passed 647f72a |
✅ Gradle Wrapper Validation success 647f72a |
start gradle precommit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did the first pass, pending tests review
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
...c/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java
Show resolved
Hide resolved
@@ -204,14 +234,15 @@ public float getShardBalance() { | |||
* </ul> | |||
* <code>weight(node, index) = weight<sub>index</sub>(node, index) + weight<sub>node</sub>(node, index)</code> | |||
*/ | |||
private static class WeightFunction { | |||
public static class WeightFunction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep the class private along with its constructor or any method which has been changed to public
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was needed for tests - so we can have more scoped UTs that test the weight fn alone. Existing balancer tests always tested the full reroute path. We can explore if package private helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not reviewed the tests yet. It will be tricky to explain the new weight function now, especially with more constraints.
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
...c/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java
Show resolved
Hide resolved
...c/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for merging this, @ashwinpankaj ! Good to see this make it upstream.
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
...c/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java
Show resolved
Hide resolved
@@ -204,14 +234,15 @@ public float getShardBalance() { | |||
* </ul> | |||
* <code>weight(node, index) = weight<sub>index</sub>(node, index) + weight<sub>node</sub>(node, index)</code> | |||
*/ | |||
private static class WeightFunction { | |||
public static class WeightFunction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was needed for tests - so we can have more scoped UTs that test the weight fn alone. Existing balancer tests always tested the full reroute path. We can explore if package private helps.
server/src/main/java/org/opensearch/cluster/routing/allocation/AllocationConstraints.java
Show resolved
Hide resolved
} | ||
|
||
/** | ||
* {@link ConstraintMode} values define possible modes in which allocation constraints can be enabled on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the ConstraintMode
parameter, and always use it for unassigned shards only. That is, enabled
would apply this to allocate unassigned
operation, and disabled
will turn this off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@ashwinpankaj can we close this, since we have #680 ? |
closed in favour of #680 |
* fix: change int type to long Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com> * update CHANGELOG.md Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com> * fix: change totalDataSetSizeInBytes to Long too Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com> * fix: skip removing opensearch-observability index in AfterTest cleanup Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com> --------- Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>
Signed-off-by: Ashwin Pankaj appankaj@amazon.com
Description
An allocation constraint mechanism, that de-prioritizes nodes from getting picked for allocation if they breach certain constraints
Issues Resolved
#487
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.