Skip to content

Commit 9b08040

Browse files
authored
Remove 7.15 transport versions (#124193)
1 parent 6afd3ec commit 9b08040

File tree

13 files changed

+23
-95
lines changed

13 files changed

+23
-95
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ static TransportVersion def(int id) {
6060
public static final TransportVersion V_7_8_1 = def(7_08_01_99);
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);
63-
public static final TransportVersion V_7_15_0 = def(7_15_00_99);
64-
public static final TransportVersion V_7_15_1 = def(7_15_01_99);
6563
public static final TransportVersion V_7_17_0 = def(7_17_00_99);
6664
public static final TransportVersion V_7_17_1 = def(7_17_01_99);
6765
public static final TransportVersion V_7_17_8 = def(7_17_08_99);

server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplanation.java

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

1010
package org.elasticsearch.action.admin.cluster.allocation;
1111

12-
import org.elasticsearch.TransportVersions;
1312
import org.elasticsearch.cluster.ClusterInfo;
1413
import org.elasticsearch.cluster.node.DiscoveryNode;
1514
import org.elasticsearch.cluster.routing.ShardRouting;
@@ -80,11 +79,7 @@ public ClusterAllocationExplanation(
8079
}
8180

8281
public ClusterAllocationExplanation(StreamInput in) throws IOException {
83-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
84-
this.specificShard = in.readBoolean();
85-
} else {
86-
this.specificShard = true; // suppress "this is a random shard" warning in BwC situations
87-
}
82+
this.specificShard = in.readBoolean();
8883
this.shardRouting = new ShardRouting(in);
8984
this.currentNode = in.readOptionalWriteable(DiscoveryNode::new);
9085
this.relocationTargetNode = in.readOptionalWriteable(DiscoveryNode::new);
@@ -94,9 +89,7 @@ public ClusterAllocationExplanation(StreamInput in) throws IOException {
9489

9590
@Override
9691
public void writeTo(StreamOutput out) throws IOException {
97-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
98-
out.writeBoolean(specificShard);
99-
} // else suppress "this is a random shard" warning in BwC situations
92+
out.writeBoolean(specificShard);
10093
shardRouting.writeTo(out);
10194
out.writeOptionalWriteable(currentNode);
10295
out.writeOptionalWriteable(relocationTargetNode);

server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ public record UnassignedInfo(
7777
@Nullable String lastAllocatedNodeId
7878
) implements ToXContentFragment, Writeable {
7979

80-
/**
81-
* The version that the {@code lastAllocatedNode} field was added in. Used to adapt streaming of this class as appropriate for the
82-
* version of the node sending/receiving it. Should be removed once wire compatibility with this version is no longer necessary.
83-
*/
84-
private static final TransportVersion VERSION_LAST_ALLOCATED_NODE_ADDED = TransportVersions.V_7_15_0;
8580
private static final TransportVersion VERSION_UNPROMOTABLE_REPLICA_ADDED = TransportVersions.V_8_7_0;
8681

8782
public static final DateFormatter DATE_TIME_FORMATTER = DateFormatter.forPattern("date_optional_time").withZone(ZoneOffset.UTC);
@@ -315,11 +310,7 @@ public static UnassignedInfo fromStreamInput(StreamInput in) throws IOException
315310
var lastAllocationStatus = AllocationStatus.readFrom(in);
316311
var failedNodeIds = in.readCollectionAsImmutableSet(StreamInput::readString);
317312
String lastAllocatedNodeId;
318-
if (in.getTransportVersion().onOrAfter(VERSION_LAST_ALLOCATED_NODE_ADDED)) {
319-
lastAllocatedNodeId = in.readOptionalString();
320-
} else {
321-
lastAllocatedNodeId = null;
322-
}
313+
lastAllocatedNodeId = in.readOptionalString();
323314
return new UnassignedInfo(
324315
reason,
325316
message,
@@ -335,9 +326,7 @@ public static UnassignedInfo fromStreamInput(StreamInput in) throws IOException
335326
}
336327

337328
public void writeTo(StreamOutput out) throws IOException {
338-
if (reason.equals(Reason.NODE_RESTARTING) && out.getTransportVersion().before(VERSION_LAST_ALLOCATED_NODE_ADDED)) {
339-
out.writeByte((byte) Reason.NODE_LEFT.ordinal());
340-
} else if (reason.equals(Reason.UNPROMOTABLE_REPLICA) && out.getTransportVersion().before(VERSION_UNPROMOTABLE_REPLICA_ADDED)) {
329+
if (reason.equals(Reason.UNPROMOTABLE_REPLICA) && out.getTransportVersion().before(VERSION_UNPROMOTABLE_REPLICA_ADDED)) {
341330
out.writeByte((byte) Reason.PRIMARY_FAILED.ordinal());
342331
} else if (reason.equals(Reason.RESHARD_ADDED)
343332
&& out.getTransportVersion().before(TransportVersions.UNASSIGENEDINFO_RESHARD_ADDED)) {
@@ -355,9 +344,7 @@ public void writeTo(StreamOutput out) throws IOException {
355344
out.writeVInt(failedAllocations);
356345
lastAllocationStatus.writeTo(out);
357346
out.writeStringCollection(failedNodeIds);
358-
if (out.getTransportVersion().onOrAfter(VERSION_LAST_ALLOCATED_NODE_ADDED)) {
359-
out.writeOptionalString(lastAllocatedNodeId);
360-
}
347+
out.writeOptionalString(lastAllocatedNodeId);
361348
}
362349

363350
/**

server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import org.apache.logging.log4j.Logger;
1414
import org.apache.lucene.store.RateLimiter;
1515
import org.apache.lucene.store.RateLimiter.SimpleRateLimiter;
16-
import org.elasticsearch.TransportVersion;
17-
import org.elasticsearch.TransportVersions;
1816
import org.elasticsearch.cluster.node.DiscoveryNode;
1917
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
2018
import org.elasticsearch.common.settings.ClusterSettings;
@@ -50,7 +48,6 @@
5048

5149
public class RecoverySettings {
5250
public static final IndexVersion SNAPSHOT_RECOVERIES_SUPPORTED_INDEX_VERSION = IndexVersions.V_7_15_0;
53-
public static final TransportVersion SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION = TransportVersions.V_7_15_0;
5451
public static final IndexVersion SEQ_NO_SNAPSHOT_RECOVERIES_SUPPORTED_VERSION = IndexVersions.V_7_16_0;
5552

5653
private static final Logger logger = LogManager.getLogger(RecoverySettings.class);

server/src/main/java/org/elasticsearch/indices/recovery/RecoverySnapshotFileRequest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public RecoverySnapshotFileRequest(StreamInput in) throws IOException {
4545

4646
@Override
4747
public void writeTo(StreamOutput out) throws IOException {
48-
assert out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)
49-
: "Unexpected serialization version " + out.getTransportVersion();
5048
super.writeTo(out);
5149
out.writeString(repository);
5250
indexId.writeTo(out);

server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,7 @@ public FileDetail(StreamInput in) throws IOException {
642642
length = in.readVLong();
643643
recovered = in.readVLong();
644644
reused = in.readBoolean();
645-
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) {
646-
recoveredFromSnapshot = in.readLong();
647-
}
645+
recoveredFromSnapshot = in.readLong();
648646
}
649647

650648
@Override
@@ -653,9 +651,7 @@ public void writeTo(StreamOutput out) throws IOException {
653651
out.writeVLong(length);
654652
out.writeVLong(recovered);
655653
out.writeBoolean(reused);
656-
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) {
657-
out.writeLong(recoveredFromSnapshot);
658-
}
654+
out.writeLong(recoveredFromSnapshot);
659655
}
660656

661657
void addRecoveredBytes(long bytes) {

x-pack/plugin/core/src/main/java/org/elasticsearch/license/GetFeatureUsageResponse.java

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

88
package org.elasticsearch.license;
99

10-
import org.elasticsearch.TransportVersions;
1110
import org.elasticsearch.action.ActionResponse;
1211
import org.elasticsearch.common.io.stream.StreamInput;
1312
import org.elasticsearch.common.io.stream.StreamOutput;
@@ -51,11 +50,7 @@ public FeatureUsageInfo(StreamInput in) throws IOException {
5150
this.family = in.readOptionalString();
5251
this.name = in.readString();
5352
this.lastUsedTime = ZonedDateTime.ofInstant(Instant.ofEpochSecond(in.readLong()), ZoneOffset.UTC);
54-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
55-
this.context = in.readOptionalString();
56-
} else {
57-
this.context = null;
58-
}
53+
this.context = in.readOptionalString();
5954
this.licenseLevel = in.readString();
6055
}
6156

@@ -64,9 +59,7 @@ public void writeTo(StreamOutput out) throws IOException {
6459
out.writeOptionalString(this.family);
6560
out.writeString(name);
6661
out.writeLong(lastUsedTime.toEpochSecond());
67-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
68-
out.writeOptionalString(this.context);
69-
}
62+
out.writeOptionalString(this.context);
7063
out.writeString(licenseLevel);
7164
}
7265

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/async/AsyncTaskIndexService.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.elasticsearch.ExceptionsHelper;
1313
import org.elasticsearch.ResourceNotFoundException;
1414
import org.elasticsearch.TransportVersion;
15-
import org.elasticsearch.TransportVersions;
1615
import org.elasticsearch.Version;
1716
import org.elasticsearch.action.ActionListener;
1817
import org.elasticsearch.action.DocWriteResponse;
@@ -327,9 +326,7 @@ private void addResultFieldAndFinish(Writeable response, XContentBuilder source)
327326
os = Streams.noCloseStream(os);
328327
TransportVersion minNodeVersion = clusterService.state().getMinTransportVersion();
329328
TransportVersion.writeVersion(minNodeVersion, new OutputStreamStreamOutput(os));
330-
if (minNodeVersion.onOrAfter(TransportVersions.V_7_15_0)) {
331-
os = CompressorFactory.COMPRESSOR.threadLocalOutputStream(os);
332-
}
329+
os = CompressorFactory.COMPRESSOR.threadLocalOutputStream(os);
333330
try (OutputStreamStreamOutput out = new OutputStreamStreamOutput(os)) {
334331
out.setTransportVersion(minNodeVersion);
335332
response.writeTo(out);
@@ -580,11 +577,7 @@ public int read() {
580577
TransportVersion version = TransportVersion.readVersion(new InputStreamStreamInput(encodedIn));
581578
assert version.onOrBefore(TransportVersion.current()) : version + " >= " + TransportVersion.current();
582579
final StreamInput input;
583-
if (version.onOrAfter(TransportVersions.V_7_15_0)) {
584-
input = CompressorFactory.COMPRESSOR.threadLocalStreamInput(encodedIn);
585-
} else {
586-
input = new InputStreamStreamInput(encodedIn);
587-
}
580+
input = CompressorFactory.COMPRESSOR.threadLocalStreamInput(encodedIn);
588581
try (StreamInput in = new NamedWriteableAwareStreamInput(input, registry)) {
589582
in.setTransportVersion(version);
590583
return reader.read(in);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/termsenum/action/NodeTermsEnumRequest.java

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

9-
import org.elasticsearch.TransportVersions;
109
import org.elasticsearch.action.IndicesRequest;
1110
import org.elasticsearch.action.OriginalIndices;
1211
import org.elasticsearch.action.support.IndicesOptions;
@@ -78,12 +77,7 @@ public NodeTermsEnumRequest(StreamInput in) throws IOException {
7877
for (int i = 0; i < numShards; i++) {
7978
shardIds.add(new ShardId(in));
8079
}
81-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_1)) {
82-
originalIndices = OriginalIndices.readOriginalIndices(in);
83-
} else {
84-
String[] indicesNames = shardIds.stream().map(ShardId::getIndexName).distinct().toArray(String[]::new);
85-
this.originalIndices = new OriginalIndices(indicesNames, null);
86-
}
80+
originalIndices = OriginalIndices.readOriginalIndices(in);
8781
}
8882

8983
@Override
@@ -106,9 +100,7 @@ public void writeTo(StreamOutput out) throws IOException {
106100
for (ShardId shardId : shardIds) {
107101
shardId.writeTo(out);
108102
}
109-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_1)) {
110-
OriginalIndices.writeOriginalIndices(originalIndices, out);
111-
}
103+
OriginalIndices.writeOriginalIndices(originalIndices, out);
112104
}
113105

114106
public String field() {

x-pack/plugin/core/src/test/java/org/elasticsearch/license/GetFeatureUsageResponseTests.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
package org.elasticsearch.license;
99

1010
import org.elasticsearch.TransportVersion;
11-
import org.elasticsearch.TransportVersions;
1211
import org.elasticsearch.common.io.stream.BytesStreamOutput;
1312
import org.elasticsearch.common.io.stream.StreamInput;
1413
import org.elasticsearch.license.GetFeatureUsageResponse.FeatureUsageInfo;
1514
import org.elasticsearch.test.ESTestCase;
16-
import org.elasticsearch.test.TransportVersionUtils;
1715

1816
import java.io.IOException;
1917
import java.time.ZoneOffset;
@@ -46,10 +44,6 @@ public void assertStreamInputOutput(TransportVersion version, String family, Str
4644
assertThat(fui2.getLicenseLevel(), equalTo("gold"));
4745
}
4846

49-
public void testPre715StreamFormat() throws IOException {
50-
assertStreamInputOutput(TransportVersionUtils.getPreviousVersion(TransportVersions.V_7_15_0), null, null);
51-
}
52-
5347
public void testStreamFormat() throws IOException {
5448
assertStreamInputOutput(TransportVersion.current(), "family", "context");
5549
// family and context are optional

0 commit comments

Comments
 (0)