Skip to content

Commit 750c747

Browse files
committed
Reapply "Remove references to V8_1_0 transport version (#136239)" (#136560) (#139008)
This reverts commit efb3549.
1 parent 31c08fd commit 750c747

File tree

32 files changed

+78
-285
lines changed

32 files changed

+78
-285
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
@@ -64,7 +64,6 @@ static TransportVersion def(int id) {
6464
public static final TransportVersion V_7_9_0 = def(7_09_00_99);
6565
public static final TransportVersion V_7_10_0 = def(7_10_00_99);
6666
public static final TransportVersion V_8_0_0 = def(8_00_00_99);
67-
public static final TransportVersion V_8_1_0 = def(8_01_00_99);
6867
public static final TransportVersion V_8_2_0 = def(8_02_00_99);
6968
public static final TransportVersion V_8_3_0 = def(8_03_00_99);
7069
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: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -501,19 +501,7 @@ public DataStreamTemplate(boolean hidden, boolean allowCustomRouting) {
501501

502502
DataStreamTemplate(StreamInput in) throws IOException {
503503
hidden = in.readBoolean();
504-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
505-
allowCustomRouting = in.readBoolean();
506-
} else {
507-
allowCustomRouting = false;
508-
}
509-
if (in.getTransportVersion().between(TransportVersions.V_8_1_0, TransportVersions.V_8_3_0)) {
510-
// Accidentally included index_mode to binary node to node protocol in previous releases.
511-
// (index_mode is removed and was part of code based when tsdb was behind a feature flag)
512-
// (index_mode was behind a feature in the xcontent parser, so it could never actually used)
513-
// (this used to be an optional enum, so just need to (de-)serialize a false boolean value here)
514-
boolean value = in.readBoolean();
515-
assert value == false : "expected false, because this used to be an optional enum that never got set";
516-
}
504+
allowCustomRouting = in.readBoolean();
517505
}
518506

519507
/**
@@ -545,13 +533,7 @@ public boolean isAllowCustomRouting() {
545533
@Override
546534
public void writeTo(StreamOutput out) throws IOException {
547535
out.writeBoolean(hidden);
548-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
549-
out.writeBoolean(allowCustomRouting);
550-
}
551-
if (out.getTransportVersion().between(TransportVersions.V_8_1_0, TransportVersions.V_8_3_0)) {
552-
// See comment in constructor.
553-
out.writeBoolean(false);
554-
}
536+
out.writeBoolean(allowCustomRouting);
555537
}
556538

557539
@Override

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ public static DataStream read(StreamInput in) throws IOException {
271271
var hidden = in.readBoolean();
272272
var replicated = in.readBoolean();
273273
var system = in.readBoolean();
274-
var allowCustomRouting = in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0) ? in.readBoolean() : false;
275-
var indexMode = in.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0) ? in.readOptionalEnum(IndexMode.class) : null;
274+
var allowCustomRouting = in.readBoolean();
275+
var indexMode = in.readOptionalEnum(IndexMode.class);
276276
var lifecycle = in.getTransportVersion().onOrAfter(TransportVersions.V_8_9_X)
277277
? in.readOptionalWriteable(DataStreamLifecycle::new)
278278
: null;
@@ -1361,12 +1361,8 @@ public void writeTo(StreamOutput out) throws IOException {
13611361
out.writeBoolean(hidden);
13621362
out.writeBoolean(replicated);
13631363
out.writeBoolean(system);
1364-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
1365-
out.writeBoolean(allowCustomRouting);
1366-
}
1367-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
1368-
out.writeOptionalEnum(indexMode);
1369-
}
1364+
out.writeBoolean(allowCustomRouting);
1365+
out.writeOptionalEnum(indexMode);
13701366
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_9_X)) {
13711367
out.writeOptionalWriteable(lifecycle);
13721368
}

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)