From d61e45d18621b227bebc343d64b1e281d35d3641 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Wed, 30 Jan 2019 12:40:32 +0100 Subject: [PATCH] Fix Failing Assertion in SnapshotsInProgress (#37922) * Fix assertion by workaround for `5.6` * Reenable test that tripped this assertion * Closes #31054 --- .../java/org/elasticsearch/cluster/SnapshotsInProgress.java | 5 ++++- .../snapshots/SharedClusterSnapshotRestoreIT.java | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java b/core/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java index 6e085fe7ebecc..ccda9f98ba468 100644 --- a/core/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java +++ b/core/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java @@ -240,8 +240,11 @@ public ShardSnapshotStatus(String nodeId, State state) { public ShardSnapshotStatus(String nodeId, State state, String reason) { this.nodeId = nodeId; this.state = state; - this.reason = reason; // If the state is failed we have to have a reason for this failure + if (state.failed() && reason == null) { + reason = "failed"; + } + this.reason = reason; assert state.failed() == false || reason != null; } diff --git a/core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java b/core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java index 2d4d9fae0754e..29667659cbe65 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java +++ b/core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java @@ -2706,7 +2706,6 @@ public void testCannotCreateSnapshotsWithSameName() throws Exception { assertThat(createSnapshotResponse.getSnapshotInfo().snapshotId().getName(), equalTo(snapshotName)); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/31054") public void testGetSnapshotsRequest() throws Exception { final String repositoryName = "test-repo"; final String indexName = "test-idx";