Skip to content

Commit a054bbc

Browse files
authored
Remove 7.2 transport versions (#118434)
1 parent b7d109c commit a054bbc

File tree

13 files changed

+39
-170
lines changed

13 files changed

+39
-170
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ static TransportVersion def(int id) {
5252
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // remove the transport versions with which v9 will not need to interact
5353
public static final TransportVersion ZERO = def(0);
5454
public static final TransportVersion V_7_0_0 = def(7_00_00_99);
55-
public static final TransportVersion V_7_2_0 = def(7_02_00_99);
56-
public static final TransportVersion V_7_2_1 = def(7_02_01_99);
5755
public static final TransportVersion V_7_3_0 = def(7_03_00_99);
5856
public static final TransportVersion V_7_4_0 = def(7_04_00_99);
5957
public static final TransportVersion V_7_5_0 = def(7_05_00_99);

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,11 +1618,7 @@ private static class IndexMetadataDiff implements Diff<IndexMetadata> {
16181618
version = in.readLong();
16191619
mappingVersion = in.readVLong();
16201620
settingsVersion = in.readVLong();
1621-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
1622-
aliasesVersion = in.readVLong();
1623-
} else {
1624-
aliasesVersion = 1;
1625-
}
1621+
aliasesVersion = in.readVLong();
16261622
state = State.fromId(in.readByte());
16271623
if (in.getTransportVersion().onOrAfter(SETTING_DIFF_VERSION)) {
16281624
settings = null;
@@ -1688,9 +1684,7 @@ public void writeTo(StreamOutput out) throws IOException {
16881684
out.writeLong(version);
16891685
out.writeVLong(mappingVersion);
16901686
out.writeVLong(settingsVersion);
1691-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
1692-
out.writeVLong(aliasesVersion);
1693-
}
1687+
out.writeVLong(aliasesVersion);
16941688
out.writeByte(state.id);
16951689
assert settings != null
16961690
: "settings should always be non-null since this instance is not expected to have been read from another node";
@@ -1776,9 +1770,7 @@ public static IndexMetadata readFrom(StreamInput in, @Nullable Function<String,
17761770
builder.version(in.readLong());
17771771
builder.mappingVersion(in.readVLong());
17781772
builder.settingsVersion(in.readVLong());
1779-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
1780-
builder.aliasesVersion(in.readVLong());
1781-
}
1773+
builder.aliasesVersion(in.readVLong());
17821774
builder.setRoutingNumShards(in.readInt());
17831775
builder.state(State.fromId(in.readByte()));
17841776
builder.settings(readSettingsFromStream(in));
@@ -1848,9 +1840,7 @@ public void writeTo(StreamOutput out, boolean mappingsAsHash) throws IOException
18481840
out.writeLong(version);
18491841
out.writeVLong(mappingVersion);
18501842
out.writeVLong(settingsVersion);
1851-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
1852-
out.writeVLong(aliasesVersion);
1853-
}
1843+
out.writeVLong(aliasesVersion);
18541844
out.writeInt(routingNumShards);
18551845
out.writeByte(state.id());
18561846
settings.writeTo(out);

server/src/main/java/org/elasticsearch/index/query/DistanceFeatureQueryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,6 @@ public String toString() {
201201

202202
@Override
203203
public TransportVersion getMinimalSupportedVersion() {
204-
return TransportVersions.V_7_2_0;
204+
return TransportVersions.ZERO;
205205
}
206206
}

server/src/main/java/org/elasticsearch/index/query/IntervalsSourceProvider.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ public Match(StreamInput in) throws IOException {
129129
this.ordered = in.readBoolean();
130130
this.analyzer = in.readOptionalString();
131131
this.filter = in.readOptionalWriteable(IntervalFilter::new);
132-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
133-
this.useField = in.readOptionalString();
134-
} else {
135-
this.useField = null;
136-
}
132+
this.useField = in.readOptionalString();
137133
}
138134

139135
private static IntervalsSource intervals(
@@ -213,9 +209,7 @@ public void writeTo(StreamOutput out) throws IOException {
213209
out.writeBoolean(ordered);
214210
out.writeOptionalString(analyzer);
215211
out.writeOptionalWriteable(filter);
216-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
217-
out.writeOptionalString(useField);
218-
}
212+
out.writeOptionalString(useField);
219213
}
220214

221215
@Override

server/src/main/java/org/elasticsearch/index/query/MatchBoolPrefixQueryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,6 @@ public String getWriteableName() {
377377

378378
@Override
379379
public TransportVersion getMinimalSupportedVersion() {
380-
return TransportVersions.V_7_2_0;
380+
return TransportVersions.ZERO;
381381
}
382382
}

server/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java

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

1010
package org.elasticsearch.index.refresh;
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;
@@ -40,21 +39,17 @@ public RefreshStats() {}
4039
public RefreshStats(StreamInput in) throws IOException {
4140
total = in.readVLong();
4241
totalTimeInMillis = in.readVLong();
43-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
44-
externalTotal = in.readVLong();
45-
externalTotalTimeInMillis = in.readVLong();
46-
}
42+
externalTotal = in.readVLong();
43+
externalTotalTimeInMillis = in.readVLong();
4744
listeners = in.readVInt();
4845
}
4946

5047
@Override
5148
public void writeTo(StreamOutput out) throws IOException {
5249
out.writeVLong(total);
5350
out.writeVLong(totalTimeInMillis);
54-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
55-
out.writeVLong(externalTotal);
56-
out.writeVLong(externalTotalTimeInMillis);
57-
}
51+
out.writeVLong(externalTotal);
52+
out.writeVLong(externalTotalTimeInMillis);
5853
out.writeVInt(listeners);
5954
}
6055

server/src/test/java/org/elasticsearch/TransportVersionTests.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,27 @@
3131
public class TransportVersionTests extends ESTestCase {
3232

3333
public void testVersionComparison() {
34-
TransportVersion V_7_2_0 = TransportVersions.V_7_2_0;
35-
TransportVersion V_8_0_0 = TransportVersions.V_8_0_0;
36-
assertThat(V_7_2_0.before(V_8_0_0), is(true));
37-
assertThat(V_7_2_0.before(V_7_2_0), is(false));
38-
assertThat(V_8_0_0.before(V_7_2_0), is(false));
39-
40-
assertThat(V_7_2_0.onOrBefore(V_8_0_0), is(true));
41-
assertThat(V_7_2_0.onOrBefore(V_7_2_0), is(true));
42-
assertThat(V_8_0_0.onOrBefore(V_7_2_0), is(false));
43-
44-
assertThat(V_7_2_0.after(V_8_0_0), is(false));
45-
assertThat(V_7_2_0.after(V_7_2_0), is(false));
46-
assertThat(V_8_0_0.after(V_7_2_0), is(true));
47-
48-
assertThat(V_7_2_0.onOrAfter(V_8_0_0), is(false));
49-
assertThat(V_7_2_0.onOrAfter(V_7_2_0), is(true));
50-
assertThat(V_8_0_0.onOrAfter(V_7_2_0), is(true));
51-
52-
assertThat(V_7_2_0, is(lessThan(V_8_0_0)));
53-
assertThat(V_7_2_0.compareTo(V_7_2_0), is(0));
54-
assertThat(V_8_0_0, is(greaterThan(V_7_2_0)));
34+
TransportVersion V_8_2_0 = TransportVersions.V_8_2_0;
35+
TransportVersion V_8_16_0 = TransportVersions.V_8_16_0;
36+
assertThat(V_8_2_0.before(V_8_16_0), is(true));
37+
assertThat(V_8_2_0.before(V_8_2_0), is(false));
38+
assertThat(V_8_16_0.before(V_8_2_0), is(false));
39+
40+
assertThat(V_8_2_0.onOrBefore(V_8_16_0), is(true));
41+
assertThat(V_8_2_0.onOrBefore(V_8_2_0), is(true));
42+
assertThat(V_8_16_0.onOrBefore(V_8_2_0), is(false));
43+
44+
assertThat(V_8_2_0.after(V_8_16_0), is(false));
45+
assertThat(V_8_2_0.after(V_8_2_0), is(false));
46+
assertThat(V_8_16_0.after(V_8_2_0), is(true));
47+
48+
assertThat(V_8_2_0.onOrAfter(V_8_16_0), is(false));
49+
assertThat(V_8_2_0.onOrAfter(V_8_2_0), is(true));
50+
assertThat(V_8_16_0.onOrAfter(V_8_2_0), is(true));
51+
52+
assertThat(V_8_2_0, is(lessThan(V_8_16_0)));
53+
assertThat(V_8_2_0.compareTo(V_8_2_0), is(0));
54+
assertThat(V_8_16_0, is(greaterThan(V_8_2_0)));
5555
}
5656

5757
public static class CorrectFakeVersion {

server/src/test/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequestTests.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ public void testBwcSerialization() throws Exception {
6464
|| request.indicesOptions().expandWildcardsHidden()) {
6565
assertEquals(request.indicesOptions(), indicesOptions);
6666
}
67-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
68-
assertEquals(request.waitForActiveShards(), ActiveShardCount.readFrom(in));
69-
} else {
70-
assertEquals(0, in.available());
71-
}
67+
assertEquals(request.waitForActiveShards(), ActiveShardCount.readFrom(in));
7268
}
7369
}
7470
}
@@ -85,9 +81,7 @@ public void testBwcSerialization() throws Exception {
8581
out.writeTimeValue(sample.ackTimeout());
8682
out.writeStringArray(sample.indices());
8783
sample.indicesOptions().writeIndicesOptions(out);
88-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
89-
sample.waitForActiveShards().writeTo(out);
90-
}
84+
sample.waitForActiveShards().writeTo(out);
9185

9286
final CloseIndexRequest deserializedRequest;
9387
try (StreamInput in = out.bytes().streamInput()) {
@@ -105,11 +99,7 @@ public void testBwcSerialization() throws Exception {
10599
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0) || sample.indicesOptions().expandWildcardsHidden()) {
106100
assertEquals(sample.indicesOptions(), deserializedRequest.indicesOptions());
107101
}
108-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
109-
assertEquals(sample.waitForActiveShards(), deserializedRequest.waitForActiveShards());
110-
} else {
111-
assertEquals(ActiveShardCount.NONE, deserializedRequest.waitForActiveShards());
112-
}
102+
assertEquals(sample.waitForActiveShards(), deserializedRequest.waitForActiveShards());
113103
}
114104
}
115105
}

server/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@
2626
import org.apache.lucene.search.TermQuery;
2727
import org.apache.lucene.search.TopDocs;
2828
import org.apache.lucene.store.Directory;
29-
import org.elasticsearch.TransportVersions;
3029
import org.elasticsearch.action.termvectors.TermVectorsRequest.Flag;
3130
import org.elasticsearch.common.bytes.BytesArray;
3231
import org.elasticsearch.common.bytes.BytesReference;
3332
import org.elasticsearch.common.io.stream.InputStreamStreamInput;
3433
import org.elasticsearch.common.io.stream.OutputStreamStreamOutput;
3534
import org.elasticsearch.core.RestApiVersion;
36-
import org.elasticsearch.index.shard.ShardId;
3735
import org.elasticsearch.rest.action.document.RestTermVectorsAction;
38-
import org.elasticsearch.tasks.TaskId;
3936
import org.elasticsearch.test.ESTestCase;
4037
import org.elasticsearch.test.StreamsUtils;
4138
import org.elasticsearch.xcontent.XContentParser;
@@ -247,52 +244,6 @@ public void testStreamRequest() throws IOException {
247244
}
248245
}
249246

250-
public void testStreamRequestLegacyVersion() throws IOException {
251-
for (int i = 0; i < 10; i++) {
252-
TermVectorsRequest request = new TermVectorsRequest("index", "id");
253-
request.offsets(random().nextBoolean());
254-
request.fieldStatistics(random().nextBoolean());
255-
request.payloads(random().nextBoolean());
256-
request.positions(random().nextBoolean());
257-
request.termStatistics(random().nextBoolean());
258-
String pref = random().nextBoolean() ? "somePreference" : null;
259-
request.preference(pref);
260-
request.doc(new BytesArray("{}"), randomBoolean(), XContentType.JSON);
261-
262-
// write using older version which contains types
263-
ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
264-
OutputStreamStreamOutput out = new OutputStreamStreamOutput(outBuffer);
265-
out.setTransportVersion(TransportVersions.V_7_2_0);
266-
request.writeTo(out);
267-
268-
// First check the type on the stream was written as "_doc" by manually parsing the stream until the type
269-
ByteArrayInputStream esInBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
270-
InputStreamStreamInput esBuffer = new InputStreamStreamInput(esInBuffer);
271-
TaskId.readFromStream(esBuffer);
272-
if (esBuffer.readBoolean()) {
273-
new ShardId(esBuffer);
274-
}
275-
esBuffer.readOptionalString();
276-
assertThat(esBuffer.readString(), equalTo("_doc"));
277-
278-
// now read the stream as normal to check it is parsed correct if received from an older node
279-
esInBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
280-
esBuffer = new InputStreamStreamInput(esInBuffer);
281-
esBuffer.setTransportVersion(TransportVersions.V_7_2_0);
282-
TermVectorsRequest req2 = new TermVectorsRequest(esBuffer);
283-
284-
assertThat(request.offsets(), equalTo(req2.offsets()));
285-
assertThat(request.fieldStatistics(), equalTo(req2.fieldStatistics()));
286-
assertThat(request.payloads(), equalTo(req2.payloads()));
287-
assertThat(request.positions(), equalTo(req2.positions()));
288-
assertThat(request.termStatistics(), equalTo(req2.termStatistics()));
289-
assertThat(request.preference(), equalTo(pref));
290-
assertThat(request.routing(), equalTo(null));
291-
assertEquals(new BytesArray("{}"), request.doc());
292-
assertEquals(XContentType.JSON, request.xContentType());
293-
}
294-
}
295-
296247
public void testMultiParser() throws Exception {
297248
byte[] bytes = StreamsUtils.copyToBytesFromClasspath("/org/elasticsearch/action/termvectors/multiRequest1.json");
298249
try (XContentParser parser = createParser(JsonXContent.jsonXContent, bytes)) {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingRequest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
package org.elasticsearch.xpack.core.security.action.rolemapping;
88

9-
import org.elasticsearch.TransportVersions;
109
import org.elasticsearch.action.ActionRequest;
1110
import org.elasticsearch.action.ActionRequestValidationException;
1211
import org.elasticsearch.action.support.WriteRequest;
@@ -48,9 +47,7 @@ public PutRoleMappingRequest(StreamInput in) throws IOException {
4847
this.name = in.readString();
4948
this.enabled = in.readBoolean();
5049
this.roles = in.readStringCollectionAsList();
51-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
52-
this.roleTemplates = in.readCollectionAsList(TemplateRoleName::new);
53-
}
50+
this.roleTemplates = in.readCollectionAsList(TemplateRoleName::new);
5451
this.rules = ExpressionParser.readExpression(in);
5552
this.metadata = in.readGenericMap();
5653
this.refreshPolicy = RefreshPolicy.readFrom(in);
@@ -165,9 +162,7 @@ public void writeTo(StreamOutput out) throws IOException {
165162
out.writeString(name);
166163
out.writeBoolean(enabled);
167164
out.writeStringCollection(roles);
168-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
169-
out.writeCollection(roleTemplates);
170-
}
165+
out.writeCollection(roleTemplates);
171166
ExpressionParser.writeExpression(rules, out);
172167
out.writeGenericMap(metadata);
173168
refreshPolicy.writeTo(out);

0 commit comments

Comments
 (0)