@@ -86,21 +86,16 @@ public EnableAllocationDecider(Settings settings, ClusterSettings clusterSetting
8686 clusterSettings .addSettingsUpdateConsumer (CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING , this ::setEnableRebalance );
8787 }
8888
89- private void setEnableRebalance (Rebalance enableRebalance ) {
89+ public void setEnableRebalance (Rebalance enableRebalance ) {
9090 this .enableRebalance = enableRebalance ;
9191 }
9292
93- private void setEnableAllocation (Allocation enableAllocation ) {
93+ public void setEnableAllocation (Allocation enableAllocation ) {
9494 this .enableAllocation = enableAllocation ;
9595 }
9696
9797 @ Override
9898 public Decision canAllocate (ShardRouting shardRouting , RoutingNode node , RoutingAllocation allocation ) {
99- return canAllocate (shardRouting , allocation );
100- }
101-
102- @ Override
103- public Decision canAllocate (ShardRouting shardRouting , RoutingAllocation allocation ) {
10499 if (allocation .ignoreDisable ()) {
105100 return allocation .decision (Decision .YES , NAME ,
106101 "explicitly ignoring any disabling of allocation due to manual allocation commands via the reroute API" );
@@ -141,29 +136,10 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
141136 }
142137 }
143138
144- @ Override
145- public Decision canRebalance (RoutingAllocation allocation ) {
146- if (allocation .ignoreDisable ()) {
147- return allocation .decision (Decision .YES , NAME , "allocation is explicitly ignoring any disabling of rebalancing" );
148- }
149-
150- if (enableRebalance == Rebalance .NONE ) {
151- for (IndexMetaData indexMetaData : allocation .metaData ()) {
152- if (INDEX_ROUTING_REBALANCE_ENABLE_SETTING .exists (indexMetaData .getSettings ())
153- && INDEX_ROUTING_REBALANCE_ENABLE_SETTING .get (indexMetaData .getSettings ()) != Rebalance .NONE ) {
154- return allocation .decision (Decision .YES , NAME , "rebalancing is permitted on one or more indices" );
155- }
156- }
157- return allocation .decision (Decision .NO , NAME , "no rebalancing is allowed due to %s" , setting (enableRebalance , false ));
158- }
159-
160- return allocation .decision (Decision .YES , NAME , "rebalancing is not globally disabled" );
161- }
162-
163139 @ Override
164140 public Decision canRebalance (ShardRouting shardRouting , RoutingAllocation allocation ) {
165141 if (allocation .ignoreDisable ()) {
166- return allocation .decision (Decision .YES , NAME , "allocation is explicitly ignoring any disabling of rebalancing " );
142+ return allocation .decision (Decision .YES , NAME , "allocation is explicitly ignoring any disabling of relocation " );
167143 }
168144
169145 Settings indexSettings = allocation .metaData ().getIndexSafe (shardRouting .index ()).getSettings ();
0 commit comments