diff --git a/src/main/java/org/elasticsearch/discovery/zen/fd/MasterFaultDetection.java b/src/main/java/org/elasticsearch/discovery/zen/fd/MasterFaultDetection.java index 6e6124c6d32..a438d3bc736 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/fd/MasterFaultDetection.java +++ b/src/main/java/org/elasticsearch/discovery/zen/fd/MasterFaultDetection.java @@ -296,14 +296,13 @@ public class MasterFaultDetection extends AbstractComponent { if (!running) { return; } - if (exp instanceof ConnectTransportException) { - // ignore this one, we already handle it by registering a connection listener - return; - } synchronized (masterNodeMutex) { // check if the master node did not get switched on us... if (masterToPing.equals(MasterFaultDetection.this.masterNode())) { - if (exp.getCause() instanceof NoLongerMasterException) { + if (exp instanceof ConnectTransportException) { + handleTransportDisconnect(masterToPing); + return; + } else if (exp.getCause() instanceof NoLongerMasterException) { logger.debug("[master] pinging a master {} that is no longer a master", masterNode); notifyMasterFailure(masterToPing, "no longer master"); return; @@ -316,6 +315,7 @@ public class MasterFaultDetection extends AbstractComponent { notifyMasterFailure(masterToPing, "do not exists on master, act as master failure"); return; } + int retryCount = ++MasterFaultDetection.this.retryCount; logger.trace("[master] failed to ping [{}], retry [{}] out of [{}]", exp, masterNode, retryCount, pingRetryCount); if (retryCount >= pingRetryCount) { @@ -334,7 +334,8 @@ public class MasterFaultDetection extends AbstractComponent { public String executor() { return ThreadPool.Names.SAME; } - }); + } + ); } } diff --git a/src/main/java/org/elasticsearch/discovery/zen/fd/NodesFaultDetection.java b/src/main/java/org/elasticsearch/discovery/zen/fd/NodesFaultDetection.java index 4271a000e58..ed300343745 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/fd/NodesFaultDetection.java +++ b/src/main/java/org/elasticsearch/discovery/zen/fd/NodesFaultDetection.java @@ -228,15 +228,16 @@ public class NodesFaultDetection extends AbstractComponent { if (!running) { return; } - if (exp instanceof ConnectTransportException) { - // ignore this one, we already handle it by registering a connection listener - return; - } NodeFD nodeFD = nodesFD.get(node); if (nodeFD != null) { if (!nodeFD.running) { return; } + if (exp instanceof ConnectTransportException) { + handleTransportDisconnect(node); + return; + } + int retryCount = ++nodeFD.retryCount; logger.trace("[node ] failed to ping [{}], retry [{}] out of [{}]", exp, node, retryCount, pingRetryCount); if (retryCount >= pingRetryCount) { @@ -257,7 +258,8 @@ public class NodesFaultDetection extends AbstractComponent { public String executor() { return ThreadPool.Names.SAME; } - }); + } + ); } }