diff --git a/server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java b/server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java index ca834f369777d..a618e051736f5 100644 --- a/server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java +++ b/server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java @@ -559,7 +559,7 @@ private Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, St List dataStreams, List featureStates, long startTime, long repositoryStateId, ImmutableOpenMap shards, String failure, Map userMetadata, Version version, @Nullable SnapshotId source, - ImmutableOpenMap shardStatusByRepoShardId) { + @Nullable ImmutableOpenMap shardStatusByRepoShardId) { this.state = state; this.snapshot = snapshot; this.includeGlobalState = includeGlobalState; @@ -659,7 +659,7 @@ private static Entry readFrom(StreamInput in) throws IOException { } return new SnapshotsInProgress.Entry( snapshot, includeGlobalState, partial, state, indices, dataStreams, featureStates, startTime, repositoryStateId, - shards, failure, userMetadata, version, source, source == null ? null : clones); + shards, failure, userMetadata, version, source, clones); } private static boolean assertShardsConsistent(SnapshotId source, State state, Map indices, @@ -1044,7 +1044,11 @@ public void writeTo(StreamOutput out) throws IOException { } if (out.getVersion().onOrAfter(SnapshotsService.CLONE_SNAPSHOT_VERSION)) { out.writeOptionalWriteable(source); - out.writeMap(shardStatusByRepoShardId); + if (source == null) { + out.writeMap(ImmutableOpenMap.of()); + } else { + out.writeMap(shardStatusByRepoShardId); + } } if (out.getVersion().onOrAfter(FEATURE_STATES_VERSION)) { out.writeList(featureStates);