From 77a8bc3cd1ec585873daad50ed34577184204571 Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Mon, 11 Nov 2019 18:42:20 -0500 Subject: [PATCH] Update handshake response version constants to 7.6 (#48917) After backporting #48906 to 7.x, the new handshake response will be sent in 7.6. With this, this commit will update the version constants to reflect that change. --- .../elasticsearch/transport/TransportHandshaker.java | 6 ++---- .../transport/AbstractSimpleTransportTestCase.java | 12 ++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/transport/TransportHandshaker.java b/server/src/main/java/org/elasticsearch/transport/TransportHandshaker.java index efbf6d6018d2c..92eb641a6b1a9 100644 --- a/server/src/main/java/org/elasticsearch/transport/TransportHandshaker.java +++ b/server/src/main/java/org/elasticsearch/transport/TransportHandshaker.java @@ -231,8 +231,7 @@ private HandshakeResponse(Version requestVersion, StreamInput in) throws IOExcep // During the handshake process, nodes set their stream version to the minimum compatibility // version they support. When deserializing the response, we use the version the other node // told us that it actually is in the handshake response (`version`). - // TODO: On backport update to 6.7 - if (requestVersion.onOrAfter(Version.V_8_0_0) && version.onOrAfter(Version.V_8_0_0)) { + if (requestVersion.onOrAfter(Version.V_7_6_0) && version.onOrAfter(Version.V_7_6_0)) { clusterName = new ClusterName(in); discoveryNode = new DiscoveryNode(in); } else { @@ -249,8 +248,7 @@ public void writeTo(StreamOutput out) throws IOException { // version they support. When deciding what response to send, we use the version the other node // told us that it actually is in the handshake request (`requestVersion`). If it did not tell // us a `requestVersion`, it is at least a pre-7.6 node. - // TODO: On backport update to 6.7 - if (requestVersion != null && requestVersion.onOrAfter(Version.V_8_0_0) && version.onOrAfter(Version.V_8_0_0)) { + if (requestVersion != null && requestVersion.onOrAfter(Version.V_7_6_0) && version.onOrAfter(Version.V_7_6_0)) { clusterName.writeTo(out); discoveryNode.writeTo(out); } diff --git a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java index d4b564eca90d3..4dddb0af9b4c4 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java @@ -2357,7 +2357,7 @@ public String executor() { TransportStats transportStats = serviceC.transport.getStats(); // we did a single round-trip to do the initial handshake assertEquals(1, transportStats.getRxCount()); assertEquals(1, transportStats.getTxCount()); - assertEquals(25, transportStats.getRxSize().getBytes()); + assertEquals(138, transportStats.getRxSize().getBytes()); assertEquals(51, transportStats.getTxSize().getBytes()); }); serviceC.sendRequest(connection, "internal:action", new TestRequest("hello world"), TransportRequestOptions.EMPTY, @@ -2367,7 +2367,7 @@ public String executor() { TransportStats transportStats = serviceC.transport.getStats(); // request has ben send assertEquals(1, transportStats.getRxCount()); assertEquals(2, transportStats.getTxCount()); - assertEquals(25, transportStats.getRxSize().getBytes()); + assertEquals(138, transportStats.getRxSize().getBytes()); assertEquals(107, transportStats.getTxSize().getBytes()); }); sendResponseLatch.countDown(); @@ -2375,7 +2375,7 @@ public String executor() { stats = serviceC.transport.getStats(); // response has been received assertEquals(2, stats.getRxCount()); assertEquals(2, stats.getTxCount()); - assertEquals(46, stats.getRxSize().getBytes()); + assertEquals(159, stats.getRxSize().getBytes()); assertEquals(107, stats.getTxSize().getBytes()); } finally { serviceC.close(); @@ -2472,7 +2472,7 @@ public String executor() { TransportStats transportStats = serviceC.transport.getStats(); // request has been sent assertEquals(1, transportStats.getRxCount()); assertEquals(1, transportStats.getTxCount()); - assertEquals(25, transportStats.getRxSize().getBytes()); + assertEquals(138, transportStats.getRxSize().getBytes()); assertEquals(51, transportStats.getTxSize().getBytes()); }); serviceC.sendRequest(connection, "internal:action", new TestRequest("hello world"), TransportRequestOptions.EMPTY, @@ -2482,7 +2482,7 @@ public String executor() { TransportStats transportStats = serviceC.transport.getStats(); // request has been sent assertEquals(1, transportStats.getRxCount()); assertEquals(2, transportStats.getTxCount()); - assertEquals(25, transportStats.getRxSize().getBytes()); + assertEquals(138, transportStats.getRxSize().getBytes()); assertEquals(107, transportStats.getTxSize().getBytes()); }); sendResponseLatch.countDown(); @@ -2497,7 +2497,7 @@ public String executor() { String failedMessage = "Unexpected read bytes size. The transport exception that was received=" + exception; // 49 bytes are the non-exception message bytes that have been received. It should include the initial // handshake message and the header, version, etc bytes in the exception message. - assertEquals(failedMessage, 49 + streamOutput.bytes().length(), stats.getRxSize().getBytes()); + assertEquals(failedMessage, 162 + streamOutput.bytes().length(), stats.getRxSize().getBytes()); assertEquals(107, stats.getTxSize().getBytes()); } finally { serviceC.close();