diff --git a/docs/reference/setup/install/check-running.asciidoc b/docs/reference/setup/install/check-running.asciidoc index 3633b81805ca5..726de3ed9a0e4 100644 --- a/docs/reference/setup/install/check-running.asciidoc +++ b/docs/reference/setup/install/check-running.asciidoc @@ -41,8 +41,7 @@ GET / "build_snapshot" : false, "lucene_version" : "{lucene_version}", "minimum_wire_compatibility_version" : "1.2.3", - "minimum_index_compatibility_version" : "1.2.3", - "transport_version" : "123456" + "minimum_index_compatibility_version" : "1.2.3" }, "tagline" : "You Know, for Search" } @@ -55,5 +54,4 @@ GET / // TESTRESPONSE[s/"build_snapshot" : false,/"build_snapshot" : $body.version.build_snapshot,/] // TESTRESPONSE[s/"minimum_wire_compatibility_version" : "1.2.3"/"minimum_wire_compatibility_version" : $body.version.minimum_wire_compatibility_version/] // TESTRESPONSE[s/"minimum_index_compatibility_version" : "1.2.3"/"minimum_index_compatibility_version" : $body.version.minimum_index_compatibility_version/] -// TESTRESPONSE[s/"transport_version" : "123456"/"transport_version" : $body.version.transport_version/] // So much s/// but at least we test that the layout is close to matching.... diff --git a/modules/rest-root/src/main/java/org/elasticsearch/rest/root/MainResponse.java b/modules/rest-root/src/main/java/org/elasticsearch/rest/root/MainResponse.java index 84f21129e02f3..1df6efe3287bf 100644 --- a/modules/rest-root/src/main/java/org/elasticsearch/rest/root/MainResponse.java +++ b/modules/rest-root/src/main/java/org/elasticsearch/rest/root/MainResponse.java @@ -28,7 +28,6 @@ public class MainResponse extends ActionResponse implements ToXContentObject { private String nodeName; private Version version; - private TransportVersion transportVersion; private ClusterName clusterName; private String clusterUuid; private Build build; @@ -39,23 +38,18 @@ public class MainResponse extends ActionResponse implements ToXContentObject { super(in); nodeName = in.readString(); version = Version.readVersion(in); - transportVersion = in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_014) ? TransportVersion.readVersion(in) : null; + // ignoring transport version that was temporarily part of the response + if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_014)) { + TransportVersion.readVersion(in); + } clusterName = new ClusterName(in); clusterUuid = in.readString(); build = Build.readBuild(in); } - public MainResponse( - String nodeName, - Version version, - TransportVersion transportVersion, - ClusterName clusterName, - String clusterUuid, - Build build - ) { + public MainResponse(String nodeName, Version version, ClusterName clusterName, String clusterUuid, Build build) { this.nodeName = nodeName; this.version = version; - this.transportVersion = transportVersion; this.clusterName = clusterName; this.clusterUuid = clusterUuid; this.build = build; @@ -69,10 +63,6 @@ public Version getVersion() { return version; } - public TransportVersion getTransportVersion() { - return transportVersion; - } - public ClusterName getClusterName() { return clusterName; } @@ -90,7 +80,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(nodeName); Version.writeVersion(version, out); if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_019)) { - TransportVersion.writeVersion(transportVersion, out); + TransportVersion.writeVersion(TransportVersion.current(), out); } clusterName.writeTo(out); out.writeString(clusterUuid); @@ -113,7 +103,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws .field("lucene_version", version.luceneVersion().toString()) .field("minimum_wire_compatibility_version", version.minimumCompatibilityVersion().toString()) .field("minimum_index_compatibility_version", version.minimumIndexCompatibilityVersion().toString()) - .field("transport_version", transportVersion.toString()) .endObject(); builder.field("tagline", "You Know, for Search"); builder.endObject(); @@ -147,7 +136,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws response.version = Version.fromString( ((String) value.get("number")).replace("-SNAPSHOT", "").replaceFirst("-(alpha\\d+|beta\\d+|rc\\d+)", "") ); - response.transportVersion = TransportVersion.fromString(((String) value.get("transport_version"))); }, (parser, context) -> parser.map(), new ParseField("version")); } @@ -166,7 +154,6 @@ public boolean equals(Object o) { MainResponse other = (MainResponse) o; return Objects.equals(nodeName, other.nodeName) && Objects.equals(version, other.version) - && Objects.equals(transportVersion, other.transportVersion) && Objects.equals(clusterUuid, other.clusterUuid) && Objects.equals(build, other.build) && Objects.equals(clusterName, other.clusterName); @@ -174,7 +161,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(nodeName, version, transportVersion, clusterUuid, build, clusterName); + return Objects.hash(nodeName, version, clusterUuid, build, clusterName); } @Override @@ -185,8 +172,6 @@ public String toString() { + '\'' + ", version=" + version - + ", transportVersion=" - + transportVersion + ", clusterName=" + clusterName + ", clusterUuid='" diff --git a/modules/rest-root/src/main/java/org/elasticsearch/rest/root/TransportMainAction.java b/modules/rest-root/src/main/java/org/elasticsearch/rest/root/TransportMainAction.java index 633e3273e47f8..a90e40fb5e628 100644 --- a/modules/rest-root/src/main/java/org/elasticsearch/rest/root/TransportMainAction.java +++ b/modules/rest-root/src/main/java/org/elasticsearch/rest/root/TransportMainAction.java @@ -9,7 +9,6 @@ package org.elasticsearch.rest.root; import org.elasticsearch.Build; -import org.elasticsearch.TransportVersion; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; @@ -43,14 +42,7 @@ public TransportMainAction( protected void doExecute(Task task, MainRequest request, ActionListener listener) { ClusterState clusterState = clusterService.state(); listener.onResponse( - new MainResponse( - nodeName, - Version.CURRENT, - TransportVersion.current(), - clusterState.getClusterName(), - clusterState.metadata().clusterUUID(), - Build.CURRENT - ) + new MainResponse(nodeName, Version.CURRENT, clusterState.getClusterName(), clusterState.metadata().clusterUUID(), Build.CURRENT) ); } } diff --git a/modules/rest-root/src/test/java/org/elasticsearch/rest/root/MainResponseTests.java b/modules/rest-root/src/test/java/org/elasticsearch/rest/root/MainResponseTests.java index ffaf415814a9d..99ad051f2dfbe 100644 --- a/modules/rest-root/src/test/java/org/elasticsearch/rest/root/MainResponseTests.java +++ b/modules/rest-root/src/test/java/org/elasticsearch/rest/root/MainResponseTests.java @@ -9,14 +9,12 @@ package org.elasticsearch.rest.root; import org.elasticsearch.Build; -import org.elasticsearch.TransportVersion; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.test.AbstractXContentSerializingTestCase; -import org.elasticsearch.test.TransportVersionUtils; import org.elasticsearch.test.VersionUtils; import org.elasticsearch.xcontent.ToXContent; import org.elasticsearch.xcontent.XContentBuilder; @@ -35,9 +33,8 @@ protected MainResponse createTestInstance() { String nodeName = randomAlphaOfLength(10); final String date = new Date(randomNonNegativeLong()).toString(); Version version = VersionUtils.randomIndexCompatibleVersion(random()); - TransportVersion transportVersion = TransportVersionUtils.randomVersion(); Build build = new Build(Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(), version.toString()); - return new MainResponse(nodeName, version, transportVersion, clusterName, clusterUuid, build); + return new MainResponse(nodeName, version, clusterName, clusterUuid, build); } @Override @@ -55,8 +52,7 @@ public void testToXContent() throws IOException { final Build current = Build.CURRENT; Build build = new Build(current.type(), current.hash(), current.date(), current.isSnapshot(), current.qualifiedVersion()); Version version = Version.CURRENT; - TransportVersion transportVersion = TransportVersion.current(); - MainResponse response = new MainResponse("nodeName", version, transportVersion, new ClusterName("clusterName"), clusterUUID, build); + MainResponse response = new MainResponse("nodeName", version, new ClusterName("clusterName"), clusterUUID, build); XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); assertEquals( @@ -76,8 +72,7 @@ public void testToXContent() throws IOException { "build_snapshot": %s, "lucene_version": "%s", "minimum_wire_compatibility_version": "%s", - "minimum_index_compatibility_version": "%s", - "transport_version": "%s" + "minimum_index_compatibility_version": "%s" }, "tagline": "You Know, for Search" } @@ -90,8 +85,7 @@ public void testToXContent() throws IOException { current.isSnapshot(), version.luceneVersion().toString(), version.minimumCompatibilityVersion().toString(), - version.minimumIndexCompatibilityVersion().toString(), - transportVersion.toString() + version.minimumIndexCompatibilityVersion().toString() ) ), Strings.toString(builder) @@ -103,10 +97,9 @@ protected MainResponse mutateInstance(MainResponse mutateInstance) { String clusterUuid = mutateInstance.getClusterUuid(); Build build = mutateInstance.getBuild(); Version version = mutateInstance.getVersion(); - TransportVersion transportVersion = mutateInstance.getTransportVersion(); String nodeName = mutateInstance.getNodeName(); ClusterName clusterName = mutateInstance.getClusterName(); - switch (randomIntBetween(0, 5)) { + switch (randomIntBetween(0, 4)) { case 0 -> clusterUuid = clusterUuid + randomAlphaOfLength(5); case 1 -> nodeName = nodeName + randomAlphaOfLength(5); case 2 -> @@ -114,8 +107,7 @@ protected MainResponse mutateInstance(MainResponse mutateInstance) { build = new Build(Build.Type.UNKNOWN, build.hash(), build.date(), build.isSnapshot() == false, build.qualifiedVersion()); case 3 -> version = randomValueOtherThan(version, () -> VersionUtils.randomVersion(random())); case 4 -> clusterName = new ClusterName(clusterName + randomAlphaOfLength(5)); - case 5 -> transportVersion = randomValueOtherThan(transportVersion, () -> TransportVersionUtils.randomVersion(random())); } - return new MainResponse(nodeName, version, transportVersion, clusterName, clusterUuid, build); + return new MainResponse(nodeName, version, clusterName, clusterUuid, build); } } diff --git a/modules/rest-root/src/test/java/org/elasticsearch/rest/root/RestMainActionTests.java b/modules/rest-root/src/test/java/org/elasticsearch/rest/root/RestMainActionTests.java index 0c8c0dbd3a2fd..1cfebc887f058 100644 --- a/modules/rest-root/src/test/java/org/elasticsearch/rest/root/RestMainActionTests.java +++ b/modules/rest-root/src/test/java/org/elasticsearch/rest/root/RestMainActionTests.java @@ -9,7 +9,6 @@ package org.elasticsearch.rest.root; import org.elasticsearch.Build; -import org.elasticsearch.TransportVersion; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.bytes.BytesReference; @@ -35,10 +34,9 @@ public void testHeadResponse() throws Exception { final ClusterName clusterName = new ClusterName("cluster1"); final String clusterUUID = randomAlphaOfLengthBetween(10, 20); final Version version = Version.CURRENT; - final TransportVersion transportVersion = TransportVersion.current(); final Build build = Build.CURRENT; - final MainResponse mainResponse = new MainResponse(nodeName, version, transportVersion, clusterName, clusterUUID, build); + final MainResponse mainResponse = new MainResponse(nodeName, version, clusterName, clusterUUID, build); XContentBuilder builder = JsonXContent.contentBuilder(); RestRequest restRequest = new FakeRestRequest() { @Override @@ -60,11 +58,10 @@ public void testGetResponse() throws Exception { final ClusterName clusterName = new ClusterName("cluster1"); final String clusterUUID = randomAlphaOfLengthBetween(10, 20); final Version version = Version.CURRENT; - final TransportVersion transportVersion = TransportVersion.current(); final Build build = Build.CURRENT; final boolean prettyPrint = randomBoolean(); - final MainResponse mainResponse = new MainResponse(nodeName, version, transportVersion, clusterName, clusterUUID, build); + final MainResponse mainResponse = new MainResponse(nodeName, version, clusterName, clusterUUID, build); XContentBuilder builder = JsonXContent.contentBuilder(); Map params = new HashMap<>(); diff --git a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/WebServerTestCase.java b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/WebServerTestCase.java index 33d29ead479b5..f152b6756bd35 100644 --- a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/WebServerTestCase.java +++ b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/WebServerTestCase.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.sql.jdbc; import org.elasticsearch.Build; -import org.elasticsearch.TransportVersion; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.rest.root.MainResponse; @@ -50,8 +49,7 @@ MainResponse createMainResponse(Version version) { String nodeName = randomAlphaOfLength(10); final String date = new Date(randomNonNegativeLong()).toString(); Build build = new Build(Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(), version.toString()); - TransportVersion transportVersion = TransportVersion.current(); - return new MainResponse(nodeName, version, transportVersion, clusterName, clusterUuid, build); + return new MainResponse(nodeName, version, clusterName, clusterUuid, build); } String webServerAddress() {