From 1d07a269a00d6899f129c79f9a9c63bbdfbdb5d7 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Fri, 24 Jan 2020 09:58:56 +0100 Subject: [PATCH] only retry remote node closed --- .../action/support/master/TransportMasterNodeAction.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java b/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java index c1f1f30ddae1c..55051a6105d7a 100644 --- a/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java +++ b/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java @@ -46,6 +46,7 @@ import org.elasticsearch.tasks.Task; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.ConnectTransportException; +import org.elasticsearch.transport.RemoteTransportException; import org.elasticsearch.transport.TransportException; import org.elasticsearch.transport.TransportService; @@ -178,7 +179,8 @@ protected void doStart(ClusterState clusterState) { @Override public void handleException(final TransportException exp) { Throwable cause = exp.unwrapCause(); - if (cause instanceof ConnectTransportException || cause instanceof NodeClosedException) { + if (cause instanceof ConnectTransportException || + (exp instanceof RemoteTransportException && cause instanceof NodeClosedException)) { // we want to retry here a bit to see if a new master is elected logger.debug("connection exception while trying to forward request with action name [{}] to " + "master node [{}], scheduling a retry. Error: [{}]",