From 7a55a957d3a49b30eef4497c9416cd07964e909a Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 18 Jun 2015 15:48:16 +0200 Subject: [PATCH] removed retry start watcher mechanism If nodes drop and .watches / .triggered_watches shards are available after those shards were started a new cluster state update will come along that triggers the start watcher logic. Original commit: elastic/x-pack-elasticsearch@af36f8b078fbc61abcfd403fbc2f76dd01be5a63 --- .../watcher/WatcherLifeCycleService.java | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/elasticsearch/watcher/WatcherLifeCycleService.java b/src/main/java/org/elasticsearch/watcher/WatcherLifeCycleService.java index c7776fdc1fa..bf4d724c789 100644 --- a/src/main/java/org/elasticsearch/watcher/WatcherLifeCycleService.java +++ b/src/main/java/org/elasticsearch/watcher/WatcherLifeCycleService.java @@ -78,30 +78,12 @@ public class WatcherLifeCycleService extends AbstractComponent implements Cluste return; } - int attempts = 0; - for (; attempts < 3; attempts++) { - try { - if (logger.isDebugEnabled()) { - logger.debug("start attempt [{}]...", attempts); - } else if (logger.isTraceEnabled()) { - logger.trace("starting... (attempt [{}] - based on cluster state version [{}])", attempts, state.getVersion()); - } - watcherService.start(state); - return; - } catch (Exception e) { - logger.warn("error occurred while starting, retrying...", e); - try { - Thread.sleep(1000); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - } - if (!clusterService.localNode().masterNode()) { - logger.error("abort retry, we are no longer master"); - return; - } - } + logger.trace("starting... (based on cluster state version [{}])", state.getVersion()); + try { + watcherService.start(state); + } catch (Exception e) { + logger.debug("failed to start watcher. please wait for the cluster to become ready or try to start Watcher manually"); } - logger.error("failed to start watcher. attempted to start [{}] times. please try to start Watcher manually", attempts); } @Override