Skip to content

Commit

Permalink
Update handshake response version constants to 7.6 (#48917)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Tim-Brooks committed Nov 11, 2019
1 parent 7115d3e commit 77a8bc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -2367,15 +2367,15 @@ 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();
responseLatch.await();
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();
Expand Down Expand Up @@ -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,
Expand All @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 77a8bc3

Please sign in to comment.