diff --git a/server/src/main/java/org/elasticsearch/TransportVersions.java b/server/src/main/java/org/elasticsearch/TransportVersions.java index 36ec1979ccb28..b3d6e86f11742 100644 --- a/server/src/main/java/org/elasticsearch/TransportVersions.java +++ b/server/src/main/java/org/elasticsearch/TransportVersions.java @@ -60,8 +60,6 @@ static TransportVersion def(int id) { public static final TransportVersion V_7_8_1 = def(7_08_01_99); public static final TransportVersion V_7_9_0 = def(7_09_00_99); public static final TransportVersion V_7_10_0 = def(7_10_00_99); - public static final TransportVersion V_7_15_0 = def(7_15_00_99); - public static final TransportVersion V_7_15_1 = def(7_15_01_99); public static final TransportVersion V_7_17_0 = def(7_17_00_99); public static final TransportVersion V_7_17_1 = def(7_17_01_99); public static final TransportVersion V_7_17_8 = def(7_17_08_99); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplanation.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplanation.java index b7eecb6b3ddd8..6acc59db1b992 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplanation.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplanation.java @@ -9,7 +9,6 @@ package org.elasticsearch.action.admin.cluster.allocation; -import org.elasticsearch.TransportVersions; import org.elasticsearch.cluster.ClusterInfo; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; @@ -80,11 +79,7 @@ public ClusterAllocationExplanation( } public ClusterAllocationExplanation(StreamInput in) throws IOException { - if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) { - this.specificShard = in.readBoolean(); - } else { - this.specificShard = true; // suppress "this is a random shard" warning in BwC situations - } + this.specificShard = in.readBoolean(); this.shardRouting = new ShardRouting(in); this.currentNode = in.readOptionalWriteable(DiscoveryNode::new); this.relocationTargetNode = in.readOptionalWriteable(DiscoveryNode::new); @@ -94,9 +89,7 @@ public ClusterAllocationExplanation(StreamInput in) throws IOException { @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) { - out.writeBoolean(specificShard); - } // else suppress "this is a random shard" warning in BwC situations + out.writeBoolean(specificShard); shardRouting.writeTo(out); out.writeOptionalWriteable(currentNode); out.writeOptionalWriteable(relocationTargetNode); diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java b/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java index 2a31873a07388..5ffc258ef8d85 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java @@ -77,11 +77,6 @@ public record UnassignedInfo( @Nullable String lastAllocatedNodeId ) implements ToXContentFragment, Writeable { - /** - * The version that the {@code lastAllocatedNode} field was added in. Used to adapt streaming of this class as appropriate for the - * version of the node sending/receiving it. Should be removed once wire compatibility with this version is no longer necessary. - */ - private static final TransportVersion VERSION_LAST_ALLOCATED_NODE_ADDED = TransportVersions.V_7_15_0; private static final TransportVersion VERSION_UNPROMOTABLE_REPLICA_ADDED = TransportVersions.V_8_7_0; 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 var lastAllocationStatus = AllocationStatus.readFrom(in); var failedNodeIds = in.readCollectionAsImmutableSet(StreamInput::readString); String lastAllocatedNodeId; - if (in.getTransportVersion().onOrAfter(VERSION_LAST_ALLOCATED_NODE_ADDED)) { - lastAllocatedNodeId = in.readOptionalString(); - } else { - lastAllocatedNodeId = null; - } + lastAllocatedNodeId = in.readOptionalString(); return new UnassignedInfo( reason, message, @@ -335,9 +326,7 @@ public static UnassignedInfo fromStreamInput(StreamInput in) throws IOException } public void writeTo(StreamOutput out) throws IOException { - if (reason.equals(Reason.NODE_RESTARTING) && out.getTransportVersion().before(VERSION_LAST_ALLOCATED_NODE_ADDED)) { - out.writeByte((byte) Reason.NODE_LEFT.ordinal()); - } else if (reason.equals(Reason.UNPROMOTABLE_REPLICA) && out.getTransportVersion().before(VERSION_UNPROMOTABLE_REPLICA_ADDED)) { + if (reason.equals(Reason.UNPROMOTABLE_REPLICA) && out.getTransportVersion().before(VERSION_UNPROMOTABLE_REPLICA_ADDED)) { out.writeByte((byte) Reason.PRIMARY_FAILED.ordinal()); } else if (reason.equals(Reason.RESHARD_ADDED) && out.getTransportVersion().before(TransportVersions.UNASSIGENEDINFO_RESHARD_ADDED)) { @@ -355,9 +344,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeVInt(failedAllocations); lastAllocationStatus.writeTo(out); out.writeStringCollection(failedNodeIds); - if (out.getTransportVersion().onOrAfter(VERSION_LAST_ALLOCATED_NODE_ADDED)) { - out.writeOptionalString(lastAllocatedNodeId); - } + out.writeOptionalString(lastAllocatedNodeId); } /** diff --git a/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java b/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java index 372e1c11951bc..18e51fcb545bd 100644 --- a/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java +++ b/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java @@ -13,8 +13,6 @@ import org.apache.logging.log4j.Logger; import org.apache.lucene.store.RateLimiter; import org.apache.lucene.store.RateLimiter.SimpleRateLimiter; -import org.elasticsearch.TransportVersion; -import org.elasticsearch.TransportVersions; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodeRole; import org.elasticsearch.common.settings.ClusterSettings; @@ -50,7 +48,6 @@ public class RecoverySettings { public static final IndexVersion SNAPSHOT_RECOVERIES_SUPPORTED_INDEX_VERSION = IndexVersions.V_7_15_0; - public static final TransportVersion SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION = TransportVersions.V_7_15_0; public static final IndexVersion SEQ_NO_SNAPSHOT_RECOVERIES_SUPPORTED_VERSION = IndexVersions.V_7_16_0; private static final Logger logger = LogManager.getLogger(RecoverySettings.class); diff --git a/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySnapshotFileRequest.java b/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySnapshotFileRequest.java index 9e56e217a1fb9..61d75b184fb1c 100644 --- a/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySnapshotFileRequest.java +++ b/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySnapshotFileRequest.java @@ -45,8 +45,6 @@ public RecoverySnapshotFileRequest(StreamInput in) throws IOException { @Override public void writeTo(StreamOutput out) throws IOException { - assert out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION) - : "Unexpected serialization version " + out.getTransportVersion(); super.writeTo(out); out.writeString(repository); indexId.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java b/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java index 01622ce2f6dae..7cab02c8a3c86 100644 --- a/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java +++ b/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java @@ -642,9 +642,7 @@ public FileDetail(StreamInput in) throws IOException { length = in.readVLong(); recovered = in.readVLong(); reused = in.readBoolean(); - if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) { - recoveredFromSnapshot = in.readLong(); - } + recoveredFromSnapshot = in.readLong(); } @Override @@ -653,9 +651,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeVLong(length); out.writeVLong(recovered); out.writeBoolean(reused); - if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) { - out.writeLong(recoveredFromSnapshot); - } + out.writeLong(recoveredFromSnapshot); } void addRecoveredBytes(long bytes) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/GetFeatureUsageResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/GetFeatureUsageResponse.java index 1e0e28a97e0de..7b6ec21eeeab2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/GetFeatureUsageResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/GetFeatureUsageResponse.java @@ -7,7 +7,6 @@ package org.elasticsearch.license; -import org.elasticsearch.TransportVersions; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -51,11 +50,7 @@ public FeatureUsageInfo(StreamInput in) throws IOException { this.family = in.readOptionalString(); this.name = in.readString(); this.lastUsedTime = ZonedDateTime.ofInstant(Instant.ofEpochSecond(in.readLong()), ZoneOffset.UTC); - if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) { - this.context = in.readOptionalString(); - } else { - this.context = null; - } + this.context = in.readOptionalString(); this.licenseLevel = in.readString(); } @@ -64,9 +59,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString(this.family); out.writeString(name); out.writeLong(lastUsedTime.toEpochSecond()); - if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) { - out.writeOptionalString(this.context); - } + out.writeOptionalString(this.context); out.writeString(licenseLevel); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/async/AsyncTaskIndexService.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/async/AsyncTaskIndexService.java index 1993545075979..197e0694cedff 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/async/AsyncTaskIndexService.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/async/AsyncTaskIndexService.java @@ -12,7 +12,6 @@ import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.TransportVersion; -import org.elasticsearch.TransportVersions; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.DocWriteResponse; @@ -327,9 +326,7 @@ private void addResultFieldAndFinish(Writeable response, XContentBuilder source) os = Streams.noCloseStream(os); TransportVersion minNodeVersion = clusterService.state().getMinTransportVersion(); TransportVersion.writeVersion(minNodeVersion, new OutputStreamStreamOutput(os)); - if (minNodeVersion.onOrAfter(TransportVersions.V_7_15_0)) { - os = CompressorFactory.COMPRESSOR.threadLocalOutputStream(os); - } + os = CompressorFactory.COMPRESSOR.threadLocalOutputStream(os); try (OutputStreamStreamOutput out = new OutputStreamStreamOutput(os)) { out.setTransportVersion(minNodeVersion); response.writeTo(out); @@ -580,11 +577,7 @@ public int read() { TransportVersion version = TransportVersion.readVersion(new InputStreamStreamInput(encodedIn)); assert version.onOrBefore(TransportVersion.current()) : version + " >= " + TransportVersion.current(); final StreamInput input; - if (version.onOrAfter(TransportVersions.V_7_15_0)) { - input = CompressorFactory.COMPRESSOR.threadLocalStreamInput(encodedIn); - } else { - input = new InputStreamStreamInput(encodedIn); - } + input = CompressorFactory.COMPRESSOR.threadLocalStreamInput(encodedIn); try (StreamInput in = new NamedWriteableAwareStreamInput(input, registry)) { in.setTransportVersion(version); return reader.read(in); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/termsenum/action/NodeTermsEnumRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/termsenum/action/NodeTermsEnumRequest.java index 84a28d9c8d1ef..55f014db39959 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/termsenum/action/NodeTermsEnumRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/termsenum/action/NodeTermsEnumRequest.java @@ -6,7 +6,6 @@ */ package org.elasticsearch.xpack.core.termsenum.action; -import org.elasticsearch.TransportVersions; import org.elasticsearch.action.IndicesRequest; import org.elasticsearch.action.OriginalIndices; import org.elasticsearch.action.support.IndicesOptions; @@ -78,12 +77,7 @@ public NodeTermsEnumRequest(StreamInput in) throws IOException { for (int i = 0; i < numShards; i++) { shardIds.add(new ShardId(in)); } - if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_1)) { - originalIndices = OriginalIndices.readOriginalIndices(in); - } else { - String[] indicesNames = shardIds.stream().map(ShardId::getIndexName).distinct().toArray(String[]::new); - this.originalIndices = new OriginalIndices(indicesNames, null); - } + originalIndices = OriginalIndices.readOriginalIndices(in); } @Override @@ -106,9 +100,7 @@ public void writeTo(StreamOutput out) throws IOException { for (ShardId shardId : shardIds) { shardId.writeTo(out); } - if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_1)) { - OriginalIndices.writeOriginalIndices(originalIndices, out); - } + OriginalIndices.writeOriginalIndices(originalIndices, out); } public String field() { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/GetFeatureUsageResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/GetFeatureUsageResponseTests.java index cb29f2a85aa8b..0c3ff487a9a78 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/GetFeatureUsageResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/GetFeatureUsageResponseTests.java @@ -8,12 +8,10 @@ package org.elasticsearch.license; import org.elasticsearch.TransportVersion; -import org.elasticsearch.TransportVersions; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.license.GetFeatureUsageResponse.FeatureUsageInfo; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.test.TransportVersionUtils; import java.io.IOException; import java.time.ZoneOffset; @@ -46,10 +44,6 @@ public void assertStreamInputOutput(TransportVersion version, String family, Str assertThat(fui2.getLicenseLevel(), equalTo("gold")); } - public void testPre715StreamFormat() throws IOException { - assertStreamInputOutput(TransportVersionUtils.getPreviousVersion(TransportVersions.V_7_15_0), null, null); - } - public void testStreamFormat() throws IOException { assertStreamInputOutput(TransportVersion.current(), "family", "context"); // family and context are optional diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/action/EqlSearchRequest.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/action/EqlSearchRequest.java index 074b27332410f..1d800fa956ec6 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/action/EqlSearchRequest.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/action/EqlSearchRequest.java @@ -121,9 +121,7 @@ public EqlSearchRequest(StreamInput in) throws IOException { size = in.readVInt(); fetchSize = in.readVInt(); query = in.readString(); - if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) { - this.ccsMinimizeRoundtrips = in.readBoolean(); - } + this.ccsMinimizeRoundtrips = in.readBoolean(); this.waitForCompletionTimeout = in.readOptionalTimeValue(); this.keepAlive = in.readOptionalTimeValue(); this.keepOnCompletion = in.readBoolean(); @@ -482,9 +480,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeVInt(size); out.writeVInt(fetchSize); out.writeString(query); - if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) { - out.writeBoolean(ccsMinimizeRoundtrips); - } + out.writeBoolean(ccsMinimizeRoundtrips); out.writeOptionalTimeValue(waitForCompletionTimeout); out.writeOptionalTimeValue(keepAlive); out.writeBoolean(keepOnCompletion); diff --git a/x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/action/EqlSearchRequestTests.java b/x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/action/EqlSearchRequestTests.java index 02b11f717c857..bbeda4f43e311 100644 --- a/x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/action/EqlSearchRequestTests.java +++ b/x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/action/EqlSearchRequestTests.java @@ -129,7 +129,7 @@ protected EqlSearchRequest mutateInstanceForVersion(EqlSearchRequest instance, T mutatedInstance.size(instance.size()); mutatedInstance.fetchSize(instance.fetchSize()); mutatedInstance.query(instance.query()); - mutatedInstance.ccsMinimizeRoundtrips(version.onOrAfter(TransportVersions.V_7_15_0) == false || instance.ccsMinimizeRoundtrips()); + mutatedInstance.ccsMinimizeRoundtrips(instance.ccsMinimizeRoundtrips()); mutatedInstance.waitForCompletionTimeout(instance.waitForCompletionTimeout()); mutatedInstance.keepAlive(instance.keepAlive()); mutatedInstance.keepOnCompletion(instance.keepOnCompletion()); diff --git a/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilder.java b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilder.java index 4638ca1a21b01..c7a3b10cd7038 100644 --- a/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilder.java +++ b/x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/PinnedQueryBuilder.java @@ -124,28 +124,19 @@ private PinnedQueryBuilder(QueryBuilder organicQuery, List ids, List