Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -320,7 +319,7 @@ int numberOfKnownSnapshotShardSizes() {

private static Set<SnapshotShard> listOfSnapshotShards(final ClusterState state) {
final Set<SnapshotShard> 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();
Expand Down