Browse Source

Less RoutingNodes allocations (#74911)

No longer create as many RoutingNodes, since they are expensive.

Closes #74325
Henning Andersen 4 years ago
parent
commit
fec87bf289

+ 2 - 4
x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageDeciderService.java

@@ -224,10 +224,9 @@ public class ReactiveStorageDeciderService implements AutoscalingDeciderService
         }
 
         public long storagePreventsAllocation() {
-            RoutingNodes routingNodes = new RoutingNodes(state, false);
             RoutingAllocation allocation = new RoutingAllocation(
                 allocationDeciders,
-                routingNodes,
+                state.getRoutingNodes(),
                 state,
                 info,
                 shardSizeInfo,
@@ -241,10 +240,9 @@ public class ReactiveStorageDeciderService implements AutoscalingDeciderService
         }
 
         public long storagePreventsRemainOrMove() {
-            RoutingNodes routingNodes = new RoutingNodes(state, false);
             RoutingAllocation allocation = new RoutingAllocation(
                 allocationDeciders,
-                routingNodes,
+                state.getRoutingNodes(),
                 state,
                 info,
                 shardSizeInfo,