Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Broken Serialization of SnapshotsInProgress in 7.x #76553

Merged
merged 2 commits into from
Aug 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ private Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, St
List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, long startTime, long repositoryStateId,
ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards, String failure, Map<String, Object> userMetadata,
Version version, @Nullable SnapshotId source,
ImmutableOpenMap<RepositoryShardId, ShardSnapshotStatus> shardStatusByRepoShardId) {
@Nullable ImmutableOpenMap<RepositoryShardId, ShardSnapshotStatus> shardStatusByRepoShardId) {
this.state = state;
this.snapshot = snapshot;
this.includeGlobalState = includeGlobalState;
Expand Down Expand Up @@ -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<String, IndexId> indices,
Expand Down Expand Up @@ -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);
Expand Down