Skip to content

Commit fe7be7a

Browse files
committed
Use null nodeId to different aborted assigned-queued
Replace the reason string hack
1 parent b9e4925 commit fe7be7a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ public boolean isActiveOrAssignedQueued() {
881881
}
882882

883883
public boolean isAbortedAssignedQueued() {
884-
return state == ShardState.ABORTED && reason != null && reason.startsWith("assigned-queued aborted");
884+
return state == ShardState.ABORTED && nodeId == null;
885885
}
886886

887887
@Override
@@ -1296,14 +1296,14 @@ public Entry abort(String localNodeId, BiConsumer<ShardId, ShardSnapshotStatus>
12961296
assert isClone() == false
12971297
: "The state queued with generation should not be possible for a clone entry [" + this + "]";
12981298
final String reason = "assigned-queued aborted by snapshot deletion";
1299+
// Assigned QUEUED transitions to ABORTED (incomplete) and is completed by a separate cluster state update
12991300
status = new ShardSnapshotStatus(
1300-
nodeId,
1301-
// Assigned QUEUED transitions to ABORTED (incomplete) and is completed by a separate cluster state update
1301+
null, // use null nodeId to differentiate it from aborted INIT shard snapshot
13021302
ShardState.ABORTED,
13031303
status.generation(),
13041304
reason
13051305
);
1306-
// Accumulate the updates needed to complete the aborted QUEUED with generation shard snapshots
1306+
// Accumulate the updates needed to complete the aborted assigned-queued shard snapshots
13071307
abortedAssignedQueuedShardConsumer.accept(
13081308
shardEntry.getKey(),
13091309
new ShardSnapshotStatus(localNodeId, ShardState.FAILED, status.generation, reason)

0 commit comments

Comments
 (0)