diff --git a/server/src/main/java/org/elasticsearch/TransportVersions.java b/server/src/main/java/org/elasticsearch/TransportVersions.java index b3d6e86f11742..ec0a28388f53f 100644 --- a/server/src/main/java/org/elasticsearch/TransportVersions.java +++ b/server/src/main/java/org/elasticsearch/TransportVersions.java @@ -60,9 +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_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); public static final TransportVersion V_8_0_0 = def(8_00_00_99); public static final TransportVersion V_8_1_0 = def(8_01_00_99); public static final TransportVersion V_8_2_0 = def(8_02_00_99); diff --git a/server/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetadata.java b/server/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetadata.java index 7ad237181a662..237ec46d936d2 100644 --- a/server/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetadata.java +++ b/server/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetadata.java @@ -221,9 +221,6 @@ public void writeTo(StreamOutput out) throws IOException { if (out.getTransportVersion().before(TransportVersions.V_8_2_0)) { // no compatible version cares about the shard ID, we can just make one up FAKE_SHARD_ID.writeTo(out); - - // NB only checked this for versions back to 7.17.0, we are assuming that we don't use this with earlier versions: - assert out.getTransportVersion().onOrAfter(TransportVersions.V_7_17_0) : out.getTransportVersion(); } metadataSnapshot.writeTo(out); out.writeCollection(peerRecoveryRetentionLeases); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRange.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRange.java index 740d53eb245e4..3744724431754 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRange.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRange.java @@ -58,11 +58,9 @@ private static String generateKey(BytesRef from, BytesRef to, DocValueFormat for } private static Bucket createFromStream(StreamInput in, DocValueFormat format) throws IOException { - // NOTE: the key is required in version == 8.0.0 and version <= 7.17.0, + // NOTE: the key is required in version == 8.0.0, // while it is optional for all subsequent versions. - String key = in.getTransportVersion().equals(TransportVersions.V_8_0_0) ? in.readString() - : in.getTransportVersion().onOrAfter(TransportVersions.V_7_17_1) ? in.readOptionalString() - : in.readString(); + String key = in.getTransportVersion().equals(TransportVersions.V_8_0_0) ? in.readString() : in.readOptionalString(); BytesRef from = in.readOptional(StreamInput::readBytesRef); BytesRef to = in.readOptional(StreamInput::readBytesRef); long docCount = in.readLong(); @@ -75,10 +73,8 @@ private static Bucket createFromStream(StreamInput in, DocValueFormat format) th public void writeTo(StreamOutput out) throws IOException { if (out.getTransportVersion().equals(TransportVersions.V_8_0_0)) { out.writeString(key == null ? generateKey(from, to, format) : key); - } else if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_17_1)) { - out.writeOptionalString(key); } else { - out.writeString(key == null ? generateKey(from, to, format) : key); + out.writeOptionalString(key); } out.writeOptional(StreamOutput::writeBytesRef, from); out.writeOptional(StreamOutput::writeBytesRef, to); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java index 1d28da5801b8a..35a72ac676363 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java @@ -138,23 +138,17 @@ private static String generateKey(double from, double to, DocValueFormat format) @Override public void writeTo(StreamOutput out) throws IOException { - // NOTE: the key is required in version == 8.0.0 and version <= 7.17.0, + // NOTE: the key is required in version == 8.0.0, // while it is optional for all subsequent versions. if (out.getTransportVersion().equals(TransportVersions.V_8_0_0)) { out.writeString(key == null ? generateKey(from, to, format) : key); - } else if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_17_1)) { - out.writeOptionalString(key); } else { - out.writeString(key == null ? generateKey(from, to, format) : key); + out.writeOptionalString(key); } out.writeDouble(from); - if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_17_0)) { - out.writeOptionalDouble(from); - } + out.writeOptionalDouble(from); out.writeDouble(to); - if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_17_0)) { - out.writeOptionalDouble(to); - } + out.writeOptionalDouble(to); out.writeVLong(docCount); aggregations.writeTo(out); } @@ -236,28 +230,22 @@ public InternalRange(StreamInput in) throws IOException { int size = in.readVInt(); List ranges = new ArrayList<>(size); for (int i = 0; i < size; i++) { - // NOTE: the key is required in version == 8.0.0 and version <= 7.17.0, + // NOTE: the key is required in version == 8.0.0, // while it is optional for all subsequent versions. - final String key = in.getTransportVersion().equals(TransportVersions.V_8_0_0) ? in.readString() - : in.getTransportVersion().onOrAfter(TransportVersions.V_7_17_1) ? in.readOptionalString() - : in.readString(); + final String key = in.getTransportVersion().equals(TransportVersions.V_8_0_0) ? in.readString() : in.readOptionalString(); double from = in.readDouble(); - if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_17_0)) { - final Double originalFrom = in.readOptionalDouble(); - if (originalFrom != null) { - from = originalFrom; - } else { - from = Double.NEGATIVE_INFINITY; - } + final Double originalFrom = in.readOptionalDouble(); + if (originalFrom != null) { + from = originalFrom; + } else { + from = Double.NEGATIVE_INFINITY; } double to = in.readDouble(); - if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_17_0)) { - final Double originalTo = in.readOptionalDouble(); - if (originalTo != null) { - to = originalTo; - } else { - to = Double.POSITIVE_INFINITY; - } + final Double originalTo = in.readOptionalDouble(); + if (originalTo != null) { + to = originalTo; + } else { + to = Double.POSITIVE_INFINITY; } long docCount = in.readVLong(); InternalAggregations aggregations = InternalAggregations.readFrom(in); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java index a4574e8081868..860b272699b79 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java @@ -10,7 +10,6 @@ import org.apache.lucene.search.ScoreMode; import org.apache.lucene.search.ScorerSupplier; -import org.elasticsearch.TransportVersions; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; @@ -176,8 +175,8 @@ public Range(StreamInput in) throws IOException { toAsStr = in.readOptionalString(); from = in.readDouble(); to = in.readDouble(); - originalFrom = in.getTransportVersion().onOrAfter(TransportVersions.V_7_17_0) ? in.readOptionalDouble() : Double.valueOf(from); - originalTo = in.getTransportVersion().onOrAfter(TransportVersions.V_7_17_0) ? in.readOptionalDouble() : Double.valueOf(to); + originalFrom = in.readOptionalDouble(); + originalTo = in.readOptionalDouble(); } @Override @@ -187,10 +186,8 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString(toAsStr); out.writeDouble(from); out.writeDouble(to); - if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_17_0)) { - out.writeOptionalDouble(originalFrom); - out.writeOptionalDouble(originalTo); - } + out.writeOptionalDouble(originalFrom); + out.writeOptionalDouble(originalTo); } public double getFrom() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformTaskParams.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformTaskParams.java index 9b49b58b0d6ec..fd48fc9ef4c20 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformTaskParams.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformTaskParams.java @@ -93,7 +93,7 @@ public String getWriteableName() { @Override public TransportVersion getMinimalSupportedVersion() { - return TransportVersions.V_7_17_0; + return TransportVersions.ZERO; } @Override diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesResponseTests.java index ab62073c12d80..73e12fe2625c3 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesResponseTests.java @@ -92,7 +92,7 @@ public void testSerializationWithRemoteIndicesThrowsOnUnsupportedVersions() thro ); final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, + TransportVersions.V_8_0_0, versionBeforeAdvancedRemoteClusterSecurity ); out.setTransportVersion(version); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/AuthenticationSerializationTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/AuthenticationSerializationTests.java index d9d235c8ce41b..b7c7681c95d03 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/AuthenticationSerializationTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/AuthenticationSerializationTests.java @@ -89,7 +89,7 @@ public void testWriteToWithCrossClusterAccessThrowsOnUnsupportedVersion() throws final BytesStreamOutput out = new BytesStreamOutput(); final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, + TransportVersions.V_8_0_0, TransportVersionUtils.getPreviousVersion(RemoteClusterPortSettings.TRANSPORT_VERSION_ADVANCED_REMOTE_CLUSTER_SECURITY) ); out.setTransportVersion(version); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/AuthenticationTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/AuthenticationTests.java index a485c495b5583..0ab13ed008ba2 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/AuthenticationTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/AuthenticationTests.java @@ -853,7 +853,7 @@ public void testMaybeRewriteForOlderVersionWithCrossClusterAccessThrowsOnUnsuppo ); final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, // the minimum compatible version of 8.x + TransportVersions.V_8_0_0, versionBeforeCrossClusterAccessRealm ); @@ -958,7 +958,7 @@ public void testCopyWithFilteredMetadataFields() { public void testMaybeRewriteForOlderVersionErasesDomainForVersionsBeforeDomains() { final TransportVersion olderVersion = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, + TransportVersions.V_8_0_0, TransportVersionUtils.getPreviousVersion(Authentication.VERSION_REALM_DOMAINS) ); final Authentication authentication = AuthenticationTestHelper.builder() diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/RoleDescriptorTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/RoleDescriptorTests.java index 3ca6777512420..b15ab80ba6c2e 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/RoleDescriptorTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/RoleDescriptorTests.java @@ -651,7 +651,7 @@ public void testSerializationWithRemoteIndicesWithElderVersion() throws IOExcept final TransportVersion versionBeforeRemoteIndices = TransportVersionUtils.getPreviousVersion(TransportVersions.V_8_8_0); final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, + TransportVersions.V_8_0_0, versionBeforeRemoteIndices ); final BytesStreamOutput output = new BytesStreamOutput(); @@ -702,7 +702,7 @@ public void testSerializationWithRemoteClusterWithElderVersion() throws IOExcept final TransportVersion versionBeforeRemoteCluster = TransportVersionUtils.getPreviousVersion(ROLE_REMOTE_CLUSTER_PRIVS); final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, + TransportVersions.V_8_0_0, versionBeforeRemoteCluster ); final BytesStreamOutput output = new BytesStreamOutput(); @@ -753,7 +753,7 @@ public void testSerializationWithWorkflowsRestrictionAndUnsupportedVersions() th final TransportVersion versionBeforeWorkflowsRestriction = TransportVersionUtils.getPreviousVersion(WORKFLOWS_RESTRICTION_VERSION); final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, + TransportVersions.V_8_0_0, versionBeforeWorkflowsRestriction ); final BytesStreamOutput output = new BytesStreamOutput(); @@ -848,7 +848,7 @@ public void testSerializationWithDescriptionAndUnsupportedVersions() throws IOEx final TransportVersion versionBeforeRoleDescription = TransportVersionUtils.getPreviousVersion(SECURITY_ROLE_DESCRIPTION); final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, + TransportVersions.V_8_0_0, versionBeforeRoleDescription ); final BytesStreamOutput output = new BytesStreamOutput(); 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 1d800fa956ec6..1e923fd300f41 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 @@ -125,9 +125,7 @@ public EqlSearchRequest(StreamInput in) throws IOException { this.waitForCompletionTimeout = in.readOptionalTimeValue(); this.keepAlive = in.readOptionalTimeValue(); this.keepOnCompletion = in.readBoolean(); - if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_17_8)) { - resultPosition = in.readString(); - } + resultPosition = in.readString(); if (in.readBoolean()) { fetchFields = in.readCollectionAsList(FieldAndFormat::new); } @@ -484,9 +482,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalTimeValue(waitForCompletionTimeout); out.writeOptionalTimeValue(keepAlive); out.writeBoolean(keepOnCompletion); - if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_17_8)) { - out.writeString(resultPosition); - } + out.writeString(resultPosition); out.writeBoolean(fetchFields != null); if (fetchFields != null) { out.writeCollection(fetchFields); 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 bbeda4f43e311..9b14837f4ad11 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 @@ -135,7 +135,7 @@ protected EqlSearchRequest mutateInstanceForVersion(EqlSearchRequest instance, T mutatedInstance.keepOnCompletion(instance.keepOnCompletion()); mutatedInstance.fetchFields(instance.fetchFields()); mutatedInstance.runtimeMappings(instance.runtimeMappings()); - mutatedInstance.resultPosition(version.onOrAfter(TransportVersions.V_7_17_8) ? instance.resultPosition() : "tail"); + mutatedInstance.resultPosition(instance.resultPosition()); mutatedInstance.maxSamplesPerKey(version.onOrAfter(TransportVersions.V_8_7_0) ? instance.maxSamplesPerKey() : 1); mutatedInstance.allowPartialSearchResults( version.onOrAfter(TransportVersions.EQL_ALLOW_PARTIAL_SEARCH_RESULTS) ? instance.allowPartialSearchResults() : false diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptorTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptorTests.java index 3a3ae55cad090..fb27f5ada1ef2 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptorTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptorTests.java @@ -969,7 +969,7 @@ public void sendRequest( ); final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.V_7_17_0, + TransportVersions.V_8_0_0, versionBeforeCrossClusterAccessRealm ); when(connection.getTransportVersion()).thenReturn(version);