From 27485871b805c41c225f89edefe185efaf249b71 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Wed, 27 Feb 2019 13:39:25 +0100 Subject: [PATCH] Don't Ping on Handshake Connection (#39076) (#39446) * Don't Ping on Handshake Connection * It does not make sense to run pings on the handshake connection * Set the ping interval to `-1` to deactivate pings on it --- .../HandshakingTransportAddressConnector.java | 3 ++- .../discovery/zen/UnicastZenPing.java | 3 ++- .../transport/ConnectionProfile.java | 17 ----------------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/discovery/HandshakingTransportAddressConnector.java b/server/src/main/java/org/elasticsearch/discovery/HandshakingTransportAddressConnector.java index 656bfbe4f98bb..7f2512f97f87b 100644 --- a/server/src/main/java/org/elasticsearch/discovery/HandshakingTransportAddressConnector.java +++ b/server/src/main/java/org/elasticsearch/discovery/HandshakingTransportAddressConnector.java @@ -80,7 +80,8 @@ protected void doRun() throws Exception { logger.trace("[{}] opening probe connection", this); final Connection connection = transportService.openConnection(targetNode, - ConnectionProfile.buildSingleChannelProfile(Type.REG, probeConnectTimeout, probeHandshakeTimeout)); + ConnectionProfile.buildSingleChannelProfile(Type.REG, probeConnectTimeout, probeHandshakeTimeout, + TimeValue.MINUS_ONE, null)); logger.trace("[{}] opened probe connection", this); final DiscoveryNode remoteNode; diff --git a/server/src/main/java/org/elasticsearch/discovery/zen/UnicastZenPing.java b/server/src/main/java/org/elasticsearch/discovery/zen/UnicastZenPing.java index 59b8b9513d6aa..d0cd0e27976fd 100644 --- a/server/src/main/java/org/elasticsearch/discovery/zen/UnicastZenPing.java +++ b/server/src/main/java/org/elasticsearch/discovery/zen/UnicastZenPing.java @@ -293,7 +293,8 @@ protected void ping(final Consumer resultsConsumer, } final ConnectionProfile connectionProfile = - ConnectionProfile.buildSingleChannelProfile(TransportRequestOptions.Type.REG, requestDuration, requestDuration); + ConnectionProfile.buildSingleChannelProfile(TransportRequestOptions.Type.REG, requestDuration, requestDuration, + TimeValue.MINUS_ONE, null); final PingingRound pingingRound = new PingingRound(pingingRoundIdGenerator.incrementAndGet(), seedAddresses, resultsConsumer, nodes.getLocalNode(), connectionProfile); activePingingRounds.put(pingingRound.id(), pingingRound); diff --git a/server/src/main/java/org/elasticsearch/transport/ConnectionProfile.java b/server/src/main/java/org/elasticsearch/transport/ConnectionProfile.java index 07d4818ffafa1..66db091557f48 100644 --- a/server/src/main/java/org/elasticsearch/transport/ConnectionProfile.java +++ b/server/src/main/java/org/elasticsearch/transport/ConnectionProfile.java @@ -101,23 +101,6 @@ public static ConnectionProfile buildSingleChannelProfile(TransportRequestOption return buildSingleChannelProfile(channelType, null, null, null, null); } - /** - * Builds a connection profile that is dedicated to a single channel type. Allows passing compression - * settings. - */ - public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType, boolean compressionEnabled) { - return buildSingleChannelProfile(channelType, null, null, null, compressionEnabled); - } - - /** - * Builds a connection profile that is dedicated to a single channel type. Allows passing connection and - * handshake timeouts. - */ - public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType, @Nullable TimeValue connectTimeout, - @Nullable TimeValue handshakeTimeout) { - return buildSingleChannelProfile(channelType, connectTimeout, handshakeTimeout, null, null); - } - /** * Builds a connection profile that is dedicated to a single channel type. Allows passing connection and * handshake timeouts and compression settings.