From 7b4f4d7b71e72c5e5be24de8e70e893ebb741ec2 Mon Sep 17 00:00:00 2001 From: Kishor Patil Date: Mon, 12 Oct 2015 16:31:24 +0000 Subject: [PATCH 1/2] Netty should not limit attempts to reconnect --- storm-core/src/jvm/backtype/storm/messaging/netty/Client.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java index 8697907cd45..d52baea8ebd 100644 --- a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java +++ b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java @@ -171,7 +171,7 @@ private void scheduleConnect(long delayMs) { } private boolean reconnectingAllowed() { - return !closing && connectionAttempts.get() <= (maxReconnectionAttempts + 1); + return !closing; } private boolean connectionEstablished(Channel channel) { From 5a29b30212a5f0e15c6e791758f86eb2bb8a6aa4 Mon Sep 17 00:00:00 2001 From: Kishor Patil Date: Mon, 12 Oct 2015 11:49:02 -0500 Subject: [PATCH 2/2] Deprecate configuration Config.STORM_MESSAGING_NETTY_MAX_RETRIES --- storm-core/src/jvm/backtype/storm/Config.java | 2 ++ .../src/jvm/backtype/storm/messaging/netty/Client.java | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/storm-core/src/jvm/backtype/storm/Config.java b/storm-core/src/jvm/backtype/storm/Config.java index 26a6681de63..fcdc8ad0072 100644 --- a/storm-core/src/jvm/backtype/storm/Config.java +++ b/storm-core/src/jvm/backtype/storm/Config.java @@ -73,7 +73,9 @@ public class Config extends HashMap { /** * Netty based messaging: The max # of retries that a peer will perform when a remote is not accessible + *@deprecated "Since netty clients should never stop reconnecting - this does not make sense anymore. */ + @Deprecated public static final String STORM_MESSAGING_NETTY_MAX_RETRIES = "storm.messaging.netty.max_retries"; public static final Object STORM_MESSAGING_NETTY_MAX_RETRIES_SCHEMA = ConfigValidation.IntegerValidator; diff --git a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java index d52baea8ebd..2149c0df893 100644 --- a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java +++ b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java @@ -79,12 +79,6 @@ public class Client extends ConnectionWithStatus implements IStatefulObject { */ private final AtomicReference channelRef = new AtomicReference(); - - /** - * Maximum number of reconnection attempts we will perform after a disconnect before giving up. - */ - private final int maxReconnectionAttempts; - /** * Total number of connection attempts. */ @@ -134,7 +128,7 @@ public class Client extends ConnectionWithStatus implements IStatefulObject { LOG.info("creating Netty Client, connecting to {}:{}, bufferSize: {}", host, port, bufferSize); int messageBatchSize = Utils.getInt(stormConf.get(Config.STORM_NETTY_MESSAGE_BATCH_SIZE), 262144); - maxReconnectionAttempts = Utils.getInt(stormConf.get(Config.STORM_MESSAGING_NETTY_MAX_RETRIES)); + int maxReconnectionAttempts = Utils.getInt(stormConf.get(Config.STORM_MESSAGING_NETTY_MAX_RETRIES)); int minWaitMs = Utils.getInt(stormConf.get(Config.STORM_MESSAGING_NETTY_MIN_SLEEP_MS)); int maxWaitMs = Utils.getInt(stormConf.get(Config.STORM_MESSAGING_NETTY_MAX_SLEEP_MS)); retryPolicy = new StormBoundedExponentialBackoffRetry(minWaitMs, maxWaitMs, maxReconnectionAttempts);