From 78e77a0a95dfb4cceb218865b4ee5fc4cbaceae8 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Tue, 7 Apr 2020 15:53:29 +0200 Subject: [PATCH 1/2] Remove Unused Snapshot Status Values This is a left-over from before #41940 when we used the same status enum for the shards and the snapshots overall. The two removed values were never used on the shard level so we can simply remove them here. --- .../org/elasticsearch/cluster/SnapshotsInProgress.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java b/server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java index 6f955b6abbf84..d8e2151fc4a12 100644 --- a/server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java +++ b/server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java @@ -427,9 +427,7 @@ public enum State { STARTED((byte) 1, false), SUCCESS((byte) 2, true), FAILED((byte) 3, true), - ABORTED((byte) 4, false), - MISSING((byte) 5, true), - WAITING((byte) 6, false); + ABORTED((byte) 4, false); private final byte value; @@ -460,10 +458,6 @@ public static State fromValue(byte value) { return FAILED; case 4: return ABORTED; - case 5: - return MISSING; - case 6: - return WAITING; default: throw new IllegalArgumentException("No snapshot state for value [" + value + "]"); } From 537697104b292d643e40aa7521c379caefa0e5e6 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Tue, 7 Apr 2020 16:42:52 +0200 Subject: [PATCH 2/2] fix test --- .../test/java/org/elasticsearch/cluster/ClusterStateDiffIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/test/java/org/elasticsearch/cluster/ClusterStateDiffIT.java b/server/src/test/java/org/elasticsearch/cluster/ClusterStateDiffIT.java index 7d98507ec0891..fc3c1119471ce 100644 --- a/server/src/test/java/org/elasticsearch/cluster/ClusterStateDiffIT.java +++ b/server/src/test/java/org/elasticsearch/cluster/ClusterStateDiffIT.java @@ -716,7 +716,7 @@ public ClusterState.Custom randomCreate(String name) { new Snapshot(randomName("repo"), new SnapshotId(randomName("snap"), UUIDs.randomBase64UUID())), randomBoolean(), randomBoolean(), - SnapshotsInProgress.State.fromValue((byte) randomIntBetween(0, 6)), + randomFrom(SnapshotsInProgress.State.values()), Collections.emptyList(), Math.abs(randomLong()), (long) randomIntBetween(0, 1000),