diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java b/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java index d162884b1f752..ecee0cf858c5f 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java @@ -446,7 +446,7 @@ public long getRemainingDelay( */ public static int getNumberOfDelayedUnassigned(ClusterState state) { int count = 0; - for (ShardRouting shard : state.routingTable().shardsWithState(ShardRoutingState.UNASSIGNED)) { + for (ShardRouting shard : state.getRoutingNodes().unassigned()) { if (shard.unassignedInfo().isDelayed()) { count++; } @@ -461,9 +461,8 @@ public static int getNumberOfDelayedUnassigned(ClusterState state) { */ public static long findNextDelayedAllocation(long currentNanoTime, ClusterState state) { Metadata metadata = state.metadata(); - RoutingTable routingTable = state.routingTable(); long nextDelayNanos = Long.MAX_VALUE; - for (ShardRouting shard : routingTable.shardsWithState(ShardRoutingState.UNASSIGNED)) { + for (ShardRouting shard : state.getRoutingNodes().unassigned()) { UnassignedInfo unassignedInfo = shard.unassignedInfo(); if (unassignedInfo.isDelayed()) { Settings indexSettings = metadata.index(shard.index()).getSettings(); diff --git a/server/src/main/java/org/elasticsearch/snapshots/InternalSnapshotsInfoService.java b/server/src/main/java/org/elasticsearch/snapshots/InternalSnapshotsInfoService.java index dcbf60a172ae2..7f5945e77e93d 100644 --- a/server/src/main/java/org/elasticsearch/snapshots/InternalSnapshotsInfoService.java +++ b/server/src/main/java/org/elasticsearch/snapshots/InternalSnapshotsInfoService.java @@ -21,7 +21,6 @@ import org.elasticsearch.cluster.routing.RecoverySource; import org.elasticsearch.cluster.routing.RerouteService; import org.elasticsearch.cluster.routing.ShardRouting; -import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Priority; import org.elasticsearch.common.collect.ImmutableOpenMap; @@ -320,7 +319,7 @@ int numberOfKnownSnapshotShardSizes() { private static Set listOfSnapshotShards(final ClusterState state) { final Set snapshotShards = new HashSet<>(); - for (ShardRouting shardRouting : state.routingTable().shardsWithState(ShardRoutingState.UNASSIGNED)) { + for (ShardRouting shardRouting : state.getRoutingNodes().unassigned()) { if (shardRouting.primary() && shardRouting.recoverySource().getType() == RecoverySource.Type.SNAPSHOT) { final RecoverySource.SnapshotRecoverySource snapshotRecoverySource = (RecoverySource.SnapshotRecoverySource) shardRouting .recoverySource();