Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link
Contributor

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.

case PRIMARIES:
if (allocation.routingNodes().hasInactivePrimaries()) {
return allocation.decision(Decision.NO, NAME,
Copy link
Contributor

Choose a reason for hiding this comment

The 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,
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Expand Down