-
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
Fix primary shard balance parameter #17352
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: panguixin <[email protected]>
❌ Gradle check result for ba0ea2b: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
@@ -40,6 +40,10 @@ public void setEnable(boolean enable) { | |||
this.enable = enable; | |||
} | |||
|
|||
public boolean isEnable() { |
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.
nit: isEnabled
This test fails because a node is removed after a cluster is init, resulting in rebalancing, and the original setting of |
} | ||
|
||
/** | ||
* When primary shards balance is desired, enable primary shard balancing constraints | ||
* @param preferPrimaryShardBalance boolean to prefer balancing by primary shard | ||
*/ | ||
private void setPreferPrimaryShardBalance(boolean preferPrimaryShardBalance) { | ||
void setPreferPrimaryShardBalance(boolean preferPrimaryShardBalance) { | ||
this.preferPrimaryShardBalance = preferPrimaryShardBalance; | ||
this.weightFunction.updateAllocationConstraint(INDEX_PRIMARY_SHARD_BALANCE_CONSTRAINT_ID, preferPrimaryShardBalance); |
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.
another concern, do we need to ensure that we update all the constraints in AllocationConstraints
or RebalanceConstraints
at the same time to avoid having only some of the constraints enabled during allocation or rebalance
Description
Serval changes here:
preferPrimaryShardBalance/Rebalance
be reset when updating other settings due to a newWeightFunction
object is created without inherit originalConstraint
parametersOpenSearch/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java
Lines 302 to 314 in e34422b
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
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.