Fix NPE in SnapshotsInProgress Constructor (#60355)

Merge oversight between cleanups that removed `null` for `shards` and this corner case
spot of no indices in a snapshot.

Closes #60330
This commit is contained in:
Armin Braun 2020-07-29 10:47:28 +02:00 committed by GitHub
parent 4307a45153
commit 1f6a3765e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1303,6 +1303,11 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest
final SnapshotInfo snapshot2 =
PlainActionFuture.get(f -> snapshotsService.executeSnapshotLegacy(new CreateSnapshotRequest(repoName, "snap-2"), f));
assertThat(snapshot2.state(), is(SnapshotState.SUCCESS));
final SnapshotInfo snapshot3 =
PlainActionFuture.get(f -> snapshotsService.executeSnapshotLegacy(
new CreateSnapshotRequest(repoName, "snap-3").indices("does-not-exist-*"), f));
assertThat(snapshot3.state(), is(SnapshotState.SUCCESS));
}
private long calculateTotalFilesSize(List<Path> files) {

View File

@ -565,7 +565,7 @@ public class SnapshotsService extends AbstractLifecycleComponent implements Clus
// No indices in this snapshot - we are done
userCreateSnapshotListener.onResponse(snapshot.snapshot());
endSnapshot(new SnapshotsInProgress.Entry(
snapshot, State.STARTED, Collections.emptyList(), repositoryData.getGenId(), null, version,
snapshot, State.STARTED, Collections.emptyList(), repositoryData.getGenId(), ImmutableOpenMap.of(), version,
null), clusterState.metadata(), repositoryData);
return;
}