Skip to content

Commit 67e5ad2

Browse files
authored
Remove AllocationService.reroute(ClusterState, String, boolean) (#44629)
This commit removes the method AllocationService.reroute(ClusterState, String, boolean) in favor of AllocationService.reroute(ClusterState, String). Motivations are: there are already 3 other reroute methods in this class this method is always called with the debug parameter set to false almost all tests use the method reroute(ClusterState, String)
1 parent a9cc0e1 commit 67e5ad2

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

server/src/main/java/org/elasticsearch/cluster/routing/allocation/AllocationService.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,30 +354,19 @@ public CommandsResult reroute(final ClusterState clusterState, AllocationCommand
354354
return new CommandsResult(explanations, buildResultAndLogHealthChange(clusterState, allocation, "reroute commands"));
355355
}
356356

357-
358357
/**
359358
* Reroutes the routing table based on the live nodes.
360359
* <p>
361360
* If the same instance of ClusterState is returned, then no change has been made.
362361
*/
363362
public ClusterState reroute(ClusterState clusterState, String reason) {
364-
return reroute(clusterState, reason, false);
365-
}
366-
367-
/**
368-
* Reroutes the routing table based on the live nodes.
369-
* <p>
370-
* If the same instance of ClusterState is returned, then no change has been made.
371-
*/
372-
protected ClusterState reroute(ClusterState clusterState, String reason, boolean debug) {
373363
ClusterState fixedClusterState = adaptAutoExpandReplicas(clusterState);
374364

375365
RoutingNodes routingNodes = getMutableRoutingNodes(fixedClusterState);
376366
// shuffle the unassigned nodes, just so we won't have things like poison failed shards
377367
routingNodes.unassigned().shuffle();
378368
RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, routingNodes, fixedClusterState,
379369
clusterInfoService.getClusterInfo(), currentNanoTime());
380-
allocation.debugDecision(debug);
381370
reroute(allocation);
382371
if (fixedClusterState == clusterState && allocation.routingNodesChanged() == false) {
383372
return clusterState;

server/src/test/java/org/elasticsearch/cluster/routing/allocation/MaxRetryAllocationDeciderTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private ClusterState createInitialClusterState() {
7272
clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().add(newNode("node1")).add(newNode("node2")))
7373
.build();
7474
RoutingTable prevRoutingTable = routingTable;
75-
routingTable = strategy.reroute(clusterState, "reroute", false).routingTable();
75+
routingTable = strategy.reroute(clusterState, "reroute").routingTable();
7676
clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build();
7777

7878
assertEquals(prevRoutingTable.index("idx").shards().size(), 1);
@@ -204,7 +204,7 @@ public void testFailedAllocation() {
204204
Settings.builder().put(clusterState.metaData().index("idx").getSettings()).put("index.allocation.max_retries",
205205
retries+1).build()
206206
).build(), true).build()).build();
207-
ClusterState newState = strategy.reroute(clusterState, "settings changed", false);
207+
ClusterState newState = strategy.reroute(clusterState, "settings changed");
208208
assertThat(newState, not(equalTo(clusterState)));
209209
clusterState = newState;
210210
routingTable = newState.routingTable();

server/src/test/java/org/elasticsearch/cluster/routing/allocation/ResizeAllocationDeciderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private ClusterState createInitialClusterState(boolean startShards) {
7474
("node2", Version.CURRENT)))
7575
.build();
7676
RoutingTable prevRoutingTable = routingTable;
77-
routingTable = strategy.reroute(clusterState, "reroute", false).routingTable();
77+
routingTable = strategy.reroute(clusterState, "reroute").routingTable();
7878
clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build();
7979

8080
assertEquals(prevRoutingTable.index("source").shards().size(), 2);

0 commit comments

Comments
 (0)