diff --git a/build.gradle b/build.gradle index 9d62059148c10..4a7952374e44d 100644 --- a/build.gradle +++ b/build.gradle @@ -175,8 +175,8 @@ tasks.register("verifyVersions") { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = false -final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/65601" /* place a PR link here when committing bwc changes */ +boolean bwc_tests_enabled = true +final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */ if (bwc_tests_enabled == false) { if (bwc_tests_disabled_issue.isEmpty()) { throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false") diff --git a/server/src/main/java/org/elasticsearch/transport/TransportService.java b/server/src/main/java/org/elasticsearch/transport/TransportService.java index 8e0824e563617..906c2f37fae51 100644 --- a/server/src/main/java/org/elasticsearch/transport/TransportService.java +++ b/server/src/main/java/org/elasticsearch/transport/TransportService.java @@ -490,8 +490,6 @@ private HandshakeRequest() { public static class HandshakeResponse extends TransportResponse { - private static final Version BUILD_HASH_HANDSHAKE_VERSION = Version.V_8_0_0; - private final Version version; @Nullable // if version < BUILD_HASH_HANDSHAKE_VERSION @@ -510,60 +508,47 @@ public HandshakeResponse(Version version, String buildHash, DiscoveryNode discov public HandshakeResponse(StreamInput in) throws IOException { super(in); - if (in.getVersion().onOrAfter(BUILD_HASH_HANDSHAKE_VERSION)) { - // the first two fields need only VInts and raw (ASCII) characters, so we cross our fingers and hope that they appear - // on the wire as we expect them to even if this turns out to be an incompatible build - version = Version.readVersion(in); - buildHash = in.readString(); - - try { - // If the remote node is incompatible then make an effort to identify it anyway, so we can mention it in the exception - // message, but recognise that this may fail - discoveryNode = new DiscoveryNode(in); - } catch (Exception e) { - if (isIncompatibleBuild(version, buildHash)) { - throw new IllegalArgumentException("unidentifiable remote node is build [" + buildHash + - "] of version [" + version + "] but this node is build [" + Build.CURRENT.hash() + - "] of version [" + Version.CURRENT + "] which has an incompatible wire format", e); - } else { - throw e; - } - } + // the first two fields need only VInts and raw (ASCII) characters, so we cross our fingers and hope that they appear + // on the wire as we expect them to even if this turns out to be an incompatible build + version = Version.readVersion(in); + buildHash = in.readString(); + try { + // If the remote node is incompatible then make an effort to identify it anyway, so we can mention it in the exception + // message, but recognise that this may fail + discoveryNode = new DiscoveryNode(in); + } catch (Exception e) { if (isIncompatibleBuild(version, buildHash)) { - if (PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS) { - logger.warn("remote node [{}] is build [{}] of version [{}] but this node is build [{}] of version [{}] " + - "which may not be compatible; remove system property [{}] to resolve this warning", - discoveryNode, buildHash, version, Build.CURRENT.hash(), Version.CURRENT, - PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY); - } else { - throw new IllegalArgumentException("remote node [" + discoveryNode + "] is build [" + buildHash + - "] of version [" + version + "] but this node is build [" + Build.CURRENT.hash() + - "] of version [" + Version.CURRENT + "] which has an incompatible wire format"); - } + throw new IllegalArgumentException("unidentifiable remote node is build [" + buildHash + + "] of version [" + version + "] but this node is build [" + Build.CURRENT.hash() + + "] of version [" + Version.CURRENT + "] which has an incompatible wire format", e); + } else { + throw e; } + } - clusterName = new ClusterName(in); - } else { - discoveryNode = in.readOptionalWriteable(DiscoveryNode::new); - clusterName = new ClusterName(in); - version = Version.readVersion(in); - buildHash = null; + if (isIncompatibleBuild(version, buildHash)) { + if (PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS) { + logger.warn("remote node [{}] is build [{}] of version [{}] but this node is build [{}] of version [{}] " + + "which may not be compatible; remove system property [{}] to resolve this warning", + discoveryNode, buildHash, version, Build.CURRENT.hash(), Version.CURRENT, + PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY); + } else { + throw new IllegalArgumentException("remote node [" + discoveryNode + "] is build [" + buildHash + + "] of version [" + version + "] but this node is build [" + Build.CURRENT.hash() + + "] of version [" + Version.CURRENT + "] which has an incompatible wire format"); + } } + + clusterName = new ClusterName(in); } @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(BUILD_HASH_HANDSHAKE_VERSION)) { - Version.writeVersion(version, out); - out.writeString(buildHash); - discoveryNode.writeTo(out); - clusterName.writeTo(out); - } else { - out.writeOptionalWriteable(discoveryNode); - clusterName.writeTo(out); - Version.writeVersion(version, out); - } + Version.writeVersion(version, out); + out.writeString(buildHash); + discoveryNode.writeTo(out); + clusterName.writeTo(out); } public Version getVersion() {