Skip to content

Commit d61e45d

Browse files
Fix Failing Assertion in SnapshotsInProgress (#37922)
* Fix assertion by workaround for `5.6` * Reenable test that tripped this assertion * Closes #31054
1 parent c289fd3 commit d61e45d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,11 @@ public ShardSnapshotStatus(String nodeId, State state) {
240240
public ShardSnapshotStatus(String nodeId, State state, String reason) {
241241
this.nodeId = nodeId;
242242
this.state = state;
243-
this.reason = reason;
244243
// If the state is failed we have to have a reason for this failure
244+
if (state.failed() && reason == null) {
245+
reason = "failed";
246+
}
247+
this.reason = reason;
245248
assert state.failed() == false || reason != null;
246249
}
247250

core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,6 @@ public void testCannotCreateSnapshotsWithSameName() throws Exception {
27062706
assertThat(createSnapshotResponse.getSnapshotInfo().snapshotId().getName(), equalTo(snapshotName));
27072707
}
27082708

2709-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/31054")
27102709
public void testGetSnapshotsRequest() throws Exception {
27112710
final String repositoryName = "test-repo";
27122711
final String indexName = "test-idx";

0 commit comments

Comments
 (0)