Skip to content

Commit 7ecfe8f

Browse files
committed
Add Transport version checks
1 parent 0d776db commit 7ecfe8f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ static TransportVersion def(int id) {
173173
public static final TransportVersion INFERENCE_REQUEST_ADAPTIVE_RATE_LIMITING = def(8_839_0_00);
174174
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00);
175175
public static final TransportVersion ELASTICSEARCH_9_0 = def(9_000_0_00);
176+
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES = def(9_000_0_01);
176177

177178
/*
178179
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.action.admin.cluster.snapshots.get;
1111

12+
import org.elasticsearch.TransportVersions;
1213
import org.elasticsearch.action.ActionResponse;
1314
import org.elasticsearch.common.Strings;
1415
import org.elasticsearch.common.collect.Iterators;
@@ -48,8 +49,9 @@ public GetSnapshotsResponse(List<SnapshotInfo> snapshots, @Nullable String next,
4849

4950
public GetSnapshotsResponse(StreamInput in) throws IOException {
5051
this.snapshots = in.readCollectionAsImmutableList(SnapshotInfo::readFrom);
51-
// TODO Skip when we have V9 in TransportVersions
52-
in.readMap(StreamInput::readException);
52+
if (in.getTransportVersion().before(TransportVersions.REMOVE_SNAPSHOT_FAILURES)) {
53+
in.readMap(StreamInput::readException);
54+
}
5355
this.next = in.readOptionalString();
5456
this.total = in.readVInt();
5557
this.remaining = in.readVInt();
@@ -80,8 +82,9 @@ public int remaining() {
8082
@Override
8183
public void writeTo(StreamOutput out) throws IOException {
8284
out.writeCollection(snapshots);
83-
// TODO Skip when we have V9 in TransportVersions
84-
out.writeMap(Map.of(), StreamOutput::writeException);
85+
if (out.getTransportVersion().before(TransportVersions.REMOVE_SNAPSHOT_FAILURES)) {
86+
out.writeMap(Map.of(), StreamOutput::writeException);
87+
}
8588
out.writeOptionalString(next);
8689
out.writeVInt(total);
8790
out.writeVInt(remaining);

0 commit comments

Comments
 (0)