Skip to content

Commit c0f15d6

Browse files
authored
Remove references to V8_1_0 transport version (#136239)
1 parent 65759c5 commit c0f15d6

File tree

32 files changed

+74
-273
lines changed

32 files changed

+74
-273
lines changed

modules/aggregations/src/main/java/org/elasticsearch/aggregations/bucket/timeseries/TimeSeriesAggregationBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.aggregations.bucket.timeseries;
1111

1212
import org.elasticsearch.TransportVersion;
13-
import org.elasticsearch.TransportVersions;
1413
import org.elasticsearch.common.io.stream.StreamInput;
1514
import org.elasticsearch.common.io.stream.StreamOutput;
1615
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
@@ -155,6 +154,6 @@ public int hashCode() {
155154

156155
@Override
157156
public TransportVersion getMinimalSupportedVersion() {
158-
return TransportVersions.V_8_1_0;
157+
return TransportVersion.minimumCompatible();
159158
}
160159
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ static TransportVersion def(int id) {
6161
public static final TransportVersion V_7_9_0 = def(7_09_00_99);
6262
public static final TransportVersion V_7_10_0 = def(7_10_00_99);
6363
public static final TransportVersion V_8_0_0 = def(8_00_00_99);
64-
public static final TransportVersion V_8_1_0 = def(8_01_00_99);
6564
public static final TransportVersion V_8_2_0 = def(8_02_00_99);
6665
public static final TransportVersion V_8_3_0 = def(8_03_00_99);
6766
public static final TransportVersion V_8_4_0 = def(8_04_00_99);

server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java

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

1010
package org.elasticsearch.action.admin.indices.stats;
1111

12-
import org.elasticsearch.TransportVersions;
1312
import org.elasticsearch.action.ClusterStatsLevel;
1413
import org.elasticsearch.action.admin.indices.stats.IndexStats.IndexStatsBuilder;
1514
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
@@ -56,15 +55,10 @@ public class IndicesStatsResponse extends ChunkedBroadcastResponse {
5655
IndicesStatsResponse(StreamInput in) throws IOException {
5756
super(in);
5857
shards = in.readArray(ShardStats::new, ShardStats[]::new);
59-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
60-
// Between 8.1 and INDEX_STATS_ADDITIONAL_FIELDS, we had a different format for the response
61-
// where we only had health and state available.
62-
indexHealthMap = in.readMap(ClusterHealthStatus::readFrom);
63-
indexStateMap = in.readMap(IndexMetadata.State::readFrom);
64-
} else {
65-
indexHealthMap = Map.of();
66-
indexStateMap = Map.of();
67-
}
58+
// Between 8.1 and INDEX_STATS_ADDITIONAL_FIELDS, we had a different format for the response
59+
// where we only had health and state available.
60+
indexHealthMap = in.readMap(ClusterHealthStatus::readFrom);
61+
indexStateMap = in.readMap(IndexMetadata.State::readFrom);
6862
}
6963

7064
@FixForMultiProject(description = "we can pass ProjectMetadata here")
@@ -179,10 +173,8 @@ public CommonStats getPrimaries() {
179173
public void writeTo(StreamOutput out) throws IOException {
180174
super.writeTo(out);
181175
out.writeArray(shards);
182-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
183-
out.writeMap(indexHealthMap, StreamOutput::writeWriteable);
184-
out.writeMap(indexStateMap, StreamOutput::writeWriteable);
185-
}
176+
out.writeMap(indexHealthMap, StreamOutput::writeWriteable);
177+
out.writeMap(indexStateMap, StreamOutput::writeWriteable);
186178
}
187179

188180
@Override

server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplate.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,6 @@ public DataStreamTemplate(boolean hidden, boolean allowCustomRouting) {
547547
DataStreamTemplate(StreamInput in) throws IOException {
548548
hidden = in.readBoolean();
549549
allowCustomRouting = in.readBoolean();
550-
if (in.getTransportVersion().between(TransportVersions.V_8_1_0, TransportVersions.V_8_3_0)) {
551-
// Accidentally included index_mode to binary node to node protocol in previous releases.
552-
// (index_mode is removed and was part of code based when tsdb was behind a feature flag)
553-
// (index_mode was behind a feature in the xcontent parser, so it could never actually used)
554-
// (this used to be an optional enum, so just need to (de-)serialize a false boolean value here)
555-
boolean value = in.readBoolean();
556-
assert value == false : "expected false, because this used to be an optional enum that never got set";
557-
}
558550
}
559551

560552
/**
@@ -587,10 +579,6 @@ public boolean isAllowCustomRouting() {
587579
public void writeTo(StreamOutput out) throws IOException {
588580
out.writeBoolean(hidden);
589581
out.writeBoolean(allowCustomRouting);
590-
if (out.getTransportVersion().between(TransportVersions.V_8_1_0, TransportVersions.V_8_3_0)) {
591-
// See comment in constructor.
592-
out.writeBoolean(false);
593-
}
594582
}
595583

596584
@Override

server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public static DataStream read(StreamInput in) throws IOException {
300300
var replicated = in.readBoolean();
301301
var system = in.readBoolean();
302302
var allowCustomRouting = in.readBoolean();
303-
var indexMode = in.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0) ? in.readOptionalEnum(IndexMode.class) : null;
303+
var indexMode = in.readOptionalEnum(IndexMode.class);
304304
var lifecycle = in.getTransportVersion().onOrAfter(TransportVersions.V_8_9_X)
305305
? in.readOptionalWriteable(DataStreamLifecycle::new)
306306
: null;
@@ -1450,9 +1450,7 @@ public void writeTo(StreamOutput out) throws IOException {
14501450
out.writeBoolean(replicated);
14511451
out.writeBoolean(system);
14521452
out.writeBoolean(allowCustomRouting);
1453-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
1454-
out.writeOptionalEnum(indexMode);
1455-
}
1453+
out.writeOptionalEnum(indexMode);
14561454
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_9_X)) {
14571455
out.writeOptionalWriteable(lifecycle);
14581456
}

server/src/main/java/org/elasticsearch/cluster/metadata/DesiredNodesMetadata.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.cluster.metadata;
1111

1212
import org.elasticsearch.TransportVersion;
13-
import org.elasticsearch.TransportVersions;
1413
import org.elasticsearch.cluster.AbstractNamedDiffable;
1514
import org.elasticsearch.cluster.ClusterState;
1615
import org.elasticsearch.cluster.NamedDiff;
@@ -29,7 +28,6 @@
2928
import java.util.Objects;
3029

3130
public class DesiredNodesMetadata extends AbstractNamedDiffable<Metadata.ClusterCustom> implements Metadata.ClusterCustom {
32-
private static final TransportVersion MIN_SUPPORTED_VERSION = TransportVersions.V_8_1_0;
3331
public static final String TYPE = "desired_nodes";
3432

3533
public static final DesiredNodesMetadata EMPTY = new DesiredNodesMetadata((DesiredNodes) null);
@@ -96,7 +94,7 @@ public String getWriteableName() {
9694

9795
@Override
9896
public TransportVersion getMinimalSupportedVersion() {
99-
return MIN_SUPPORTED_VERSION;
97+
return TransportVersion.minimumCompatible();
10098
}
10199

102100
@Override

server/src/main/java/org/elasticsearch/index/search/stats/FieldUsageStats.java

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

1010
package org.elasticsearch.index.search.stats;
1111

12-
import org.elasticsearch.TransportVersions;
1312
import org.elasticsearch.common.Strings;
1413
import org.elasticsearch.common.io.stream.StreamInput;
1514
import org.elasticsearch.common.io.stream.StreamOutput;
@@ -211,11 +210,7 @@ public PerFieldUsageStats(StreamInput in) throws IOException {
211210
payloads = in.readVLong();
212211
termVectors = in.readVLong();
213212
points = in.readVLong();
214-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
215-
knnVectors = in.readVLong();
216-
} else {
217-
knnVectors = 0;
218-
}
213+
knnVectors = in.readVLong();
219214
}
220215

221216
@Override
@@ -233,9 +228,7 @@ public void writeTo(StreamOutput out) throws IOException {
233228
out.writeVLong(payloads);
234229
out.writeVLong(termVectors);
235230
out.writeVLong(points);
236-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
237-
out.writeVLong(knnVectors);
238-
}
231+
out.writeVLong(knnVectors);
239232
}
240233

241234
@Override

server/src/main/java/org/elasticsearch/script/ScriptContextStats.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,8 @@ public static ScriptContextStats read(StreamInput in) throws IOException {
6161
var compilationLimitTriggered = in.readVLong();
6262
TimeSeries compilationsHistory;
6363
TimeSeries cacheEvictionsHistory;
64-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
65-
compilationsHistory = new TimeSeries(in);
66-
cacheEvictionsHistory = new TimeSeries(in);
67-
} else if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
68-
compilationsHistory = new TimeSeries(in).withTotal(compilations);
69-
cacheEvictionsHistory = new TimeSeries(in).withTotal(cacheEvictions);
70-
} else {
71-
compilationsHistory = new TimeSeries(compilations);
72-
cacheEvictionsHistory = new TimeSeries(cacheEvictions);
73-
}
64+
compilationsHistory = new TimeSeries(in);
65+
cacheEvictionsHistory = new TimeSeries(in);
7466
return new ScriptContextStats(
7567
context,
7668
compilations,

server/src/main/java/org/elasticsearch/script/ScriptStats.java

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

1010
package org.elasticsearch.script;
1111

12-
import org.elasticsearch.TransportVersions;
1312
import org.elasticsearch.common.collect.Iterators;
1413
import org.elasticsearch.common.io.stream.StreamInput;
1514
import org.elasticsearch.common.io.stream.StreamOutput;
@@ -130,17 +129,10 @@ public static ScriptStats read(StreamInput in) throws IOException {
130129
TimeSeries cacheEvictionsHistory;
131130
long compilations;
132131
long cacheEvictions;
133-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
134-
compilationsHistory = new TimeSeries(in);
135-
cacheEvictionsHistory = new TimeSeries(in);
136-
compilations = compilationsHistory.total;
137-
cacheEvictions = cacheEvictionsHistory.total;
138-
} else {
139-
compilations = in.readVLong();
140-
cacheEvictions = in.readVLong();
141-
compilationsHistory = new TimeSeries(compilations);
142-
cacheEvictionsHistory = new TimeSeries(cacheEvictions);
143-
}
132+
compilationsHistory = new TimeSeries(in);
133+
cacheEvictionsHistory = new TimeSeries(in);
134+
compilations = compilationsHistory.total;
135+
cacheEvictions = cacheEvictionsHistory.total;
144136
var compilationLimitTriggered = in.readVLong();
145137
var contextStats = in.readCollectionAsList(ScriptContextStats::read);
146138
return new ScriptStats(
@@ -155,13 +147,8 @@ public static ScriptStats read(StreamInput in) throws IOException {
155147

156148
@Override
157149
public void writeTo(StreamOutput out) throws IOException {
158-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
159-
compilationsHistory.writeTo(out);
160-
cacheEvictionsHistory.writeTo(out);
161-
} else {
162-
out.writeVLong(compilations);
163-
out.writeVLong(cacheEvictions);
164-
}
150+
compilationsHistory.writeTo(out);
151+
cacheEvictionsHistory.writeTo(out);
165152
out.writeVLong(compilationLimitTriggered);
166153
out.writeCollection(contextStats);
167154
}

server/src/main/java/org/elasticsearch/script/TimeSeries.java

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

1010
package org.elasticsearch.script;
1111

12-
import org.elasticsearch.TransportVersions;
1312
import org.elasticsearch.common.io.stream.StreamInput;
1413
import org.elasticsearch.common.io.stream.StreamOutput;
1514
import org.elasticsearch.common.io.stream.Writeable;
@@ -59,11 +58,7 @@ public TimeSeries(StreamInput in) throws IOException {
5958
fiveMinutes = in.readVLong();
6059
fifteenMinutes = in.readVLong();
6160
twentyFourHours = in.readVLong();
62-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
63-
total = in.readVLong();
64-
} else {
65-
total = 0;
66-
}
61+
total = in.readVLong();
6762
}
6863

6964
@Override
@@ -80,9 +75,7 @@ public void writeTo(StreamOutput out) throws IOException {
8075
out.writeVLong(fiveMinutes);
8176
out.writeVLong(fifteenMinutes);
8277
out.writeVLong(twentyFourHours);
83-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
84-
out.writeVLong(total);
85-
}
78+
out.writeVLong(total);
8679
}
8780

8881
public boolean areTimingsEmpty() {

0 commit comments

Comments
 (0)