Fix Snapshot not Starting in Partial Snapshot Corner Case (#59428) (#59584)

We were not handling the case where during a partial snapshot all
shards would enter a failed state right off the bat.

Closes #59384
This commit is contained in:
Armin Braun 2020-07-15 07:59:22 +02:00 committed by GitHub
parent ecf97e9415
commit 96f52a028f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -1262,6 +1262,19 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest
assertThat(snapshotResponse.get().getSnapshotInfo().state(), is(SnapshotState.FAILED));
}
public void testPartialSnapshotAllShardsMissing() throws Exception {
internalCluster().startMasterOnlyNode();
final String dataNode = internalCluster().startDataOnlyNode();
final String repoName = "test-repo";
createRepository(repoName, "fs");
createIndex("some-index");
stopNode(dataNode);
ensureStableCluster(1);
final CreateSnapshotResponse createSnapshotResponse = client().admin().cluster().prepareCreateSnapshot(repoName, "test-snap")
.setPartial(true).setWaitForCompletion(true).get();
assertThat(createSnapshotResponse.getSnapshotInfo().state(), is(SnapshotState.PARTIAL));
}
private long calculateTotalFilesSize(List<Path> files) {
return files.stream().mapToLong(f -> {
try {