Skip to content

Commit 81fef7e

Browse files
committed
Add Transport version checks
1 parent 0d776db commit 81fef7e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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.ELASTICSEARCH_9_0)) {
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.ELASTICSEARCH_9_0)) {
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)