Skip to content

Commit 9f88b6e

Browse files
committed
Use RoutingNodes#unassigned() instead
1 parent 0dc345f commit 9f88b6e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ public long getRemainingDelay(
446446
*/
447447
public static int getNumberOfDelayedUnassigned(ClusterState state) {
448448
int count = 0;
449-
for (ShardRouting shard : state.getRoutingNodes().shardsWithState(ShardRoutingState.UNASSIGNED)) {
449+
for (ShardRouting shard : state.getRoutingNodes().unassigned()) {
450450
if (shard.unassignedInfo().isDelayed()) {
451451
count++;
452452
}
@@ -462,7 +462,7 @@ public static int getNumberOfDelayedUnassigned(ClusterState state) {
462462
public static long findNextDelayedAllocation(long currentNanoTime, ClusterState state) {
463463
Metadata metadata = state.metadata();
464464
long nextDelayNanos = Long.MAX_VALUE;
465-
for (ShardRouting shard : state.getRoutingNodes().shardsWithState(ShardRoutingState.UNASSIGNED)) {
465+
for (ShardRouting shard : state.getRoutingNodes().unassigned()) {
466466
UnassignedInfo unassignedInfo = shard.unassignedInfo();
467467
if (unassignedInfo.isDelayed()) {
468468
Settings indexSettings = metadata.index(shard.index()).getSettings();

server/src/main/java/org/elasticsearch/snapshots/InternalSnapshotsInfoService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ int numberOfKnownSnapshotShardSizes() {
320320

321321
private static Set<SnapshotShard> listOfSnapshotShards(final ClusterState state) {
322322
final Set<SnapshotShard> snapshotShards = new HashSet<>();
323-
for (ShardRouting shardRouting : state.getRoutingNodes().shardsWithState(ShardRoutingState.UNASSIGNED)) {
323+
for (ShardRouting shardRouting : state.getRoutingNodes().unassigned()) {
324324
if (shardRouting.primary() && shardRouting.recoverySource().getType() == RecoverySource.Type.SNAPSHOT) {
325325
final RecoverySource.SnapshotRecoverySource snapshotRecoverySource = (RecoverySource.SnapshotRecoverySource) shardRouting
326326
.recoverySource();

0 commit comments

Comments
 (0)