Skip to content

Commit

Permalink
Revert "Short-circuit rebalancing when disabled (#40942)"
Browse files Browse the repository at this point in the history
This reverts commit 2ae9e27.
This reverts commit 314890b.
  • Loading branch information
DaveCTurner committed Apr 8, 2019
1 parent 2ae9e27 commit f1302a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,16 @@ public EnableAllocationDecider(Settings settings, ClusterSettings clusterSetting
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING, this::setEnableRebalance);
}

private void setEnableRebalance(Rebalance enableRebalance) {
public void setEnableRebalance(Rebalance enableRebalance) {
this.enableRebalance = enableRebalance;
}

private void setEnableAllocation(Allocation enableAllocation) {
public void setEnableAllocation(Allocation enableAllocation) {
this.enableAllocation = enableAllocation;
}

@Override
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
return canAllocate(shardRouting, allocation);
}

@Override
public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocation) {
if (allocation.ignoreDisable()) {
return allocation.decision(Decision.YES, NAME,
"explicitly ignoring any disabling of allocation due to manual allocation commands via the reroute API");
Expand Down Expand Up @@ -141,29 +136,10 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
}
}

@Override
public Decision canRebalance(RoutingAllocation allocation) {
if (allocation.ignoreDisable()) {
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");
}
}
return allocation.decision(Decision.NO, NAME, "no rebalancing is allowed due to %s", setting(enableRebalance, false));
}

return allocation.decision(Decision.YES, NAME, "rebalancing is not globally disabled");
}

@Override
public Decision canRebalance(ShardRouting shardRouting, RoutingAllocation allocation) {
if (allocation.ignoreDisable()) {
return allocation.decision(Decision.YES, NAME, "allocation is explicitly ignoring any disabling of rebalancing");
return allocation.decision(Decision.YES, NAME, "allocation is explicitly ignoring any disabling of relocation");
}

Settings indexSettings = allocation.metaData().getIndexSafe(shardRouting.index()).getSettings();
Expand Down

This file was deleted.

0 comments on commit f1302a5

Please sign in to comment.