-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Control Cluster Shards Balancing #42739
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,17 +147,29 @@ public Decision canRebalance(RoutingAllocation allocation) { | |
| return allocation.decision(Decision.YES, NAME, "allocation is explicitly ignoring any disabling of rebalancing"); | ||
| } | ||
|
|
||
| if (enableRebalance == Rebalance.NONE) { | ||
| for (IndexMetaData indexMetaData : allocation.metaData()) { | ||
| if (INDEX_ROUTING_REBALANCE_ENABLE_SETTING.exists(indexMetaData.getSettings()) | ||
| && INDEX_ROUTING_REBALANCE_ENABLE_SETTING.get(indexMetaData.getSettings()) != Rebalance.NONE) { | ||
| return allocation.decision(Decision.YES, NAME, "rebalancing is permitted on one or more indices"); | ||
| Rebalance enable = this.enableRebalance; | ||
| switch (enable) { | ||
| case ALL: | ||
| return allocation.decision(Decision.YES, NAME, "all rebalance are allowed"); | ||
| case NONE: | ||
| return allocation.decision(Decision.NO, NAME, "none rebalance are not allowed"); | ||
| case PRIMARIES: | ||
| if (allocation.routingNodes().hasInactivePrimaries()) { | ||
| return allocation.decision(Decision.NO, NAME, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why does this globally disable rebalancing when there are some inactive primaries of an unrelated index? |
||
| "the cluster has inactive primary shards and cluster setting [%s] is set to [%s]", | ||
| CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING, enable); | ||
| } | ||
| } | ||
| return allocation.decision(Decision.NO, NAME, "no rebalancing is allowed due to %s", setting(enableRebalance, false)); | ||
| return allocation.decision(Decision.YES, NAME, "all primary shards is active and rebalance are allowed"); | ||
| case REPLICAS: | ||
| if (allocation.routingNodes().hasInactiveShards()) { | ||
| return allocation.decision(Decision.NO, NAME, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why does this globally disable rebalancing when there are inactive shards of some unrelated index? |
||
| "the cluster has inactive shards and cluster setting [%s] is set to [%s]", | ||
| CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING, enable); | ||
| } | ||
| return allocation.decision(Decision.YES, NAME, "all shards is active and rebalance are allowed"); | ||
| default: | ||
| throw new IllegalStateException("Unknown rebalance option"); | ||
| } | ||
|
|
||
| return allocation.decision(Decision.YES, NAME, "rebalancing is not globally disabled"); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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.
As said earlier, this changes the behavior of ES not to take the index-level property into account anymore when the cluster-level property is set.