@@ -86,21 +86,16 @@ public EnableAllocationDecider(Settings settings, ClusterSettings clusterSetting
86
86
clusterSettings .addSettingsUpdateConsumer (CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING , this ::setEnableRebalance );
87
87
}
88
88
89
- private void setEnableRebalance (Rebalance enableRebalance ) {
89
+ public void setEnableRebalance (Rebalance enableRebalance ) {
90
90
this .enableRebalance = enableRebalance ;
91
91
}
92
92
93
- private void setEnableAllocation (Allocation enableAllocation ) {
93
+ public void setEnableAllocation (Allocation enableAllocation ) {
94
94
this .enableAllocation = enableAllocation ;
95
95
}
96
96
97
97
@ Override
98
98
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 ) {
104
99
if (allocation .ignoreDisable ()) {
105
100
return allocation .decision (Decision .YES , NAME ,
106
101
"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
141
136
}
142
137
}
143
138
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
-
163
139
@ Override
164
140
public Decision canRebalance (ShardRouting shardRouting , RoutingAllocation allocation ) {
165
141
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 " );
167
143
}
168
144
169
145
Settings indexSettings = allocation .metaData ().getIndexSafe (shardRouting .index ()).getSettings ();
0 commit comments