From 72155311f01b0a0c5e9cf35c7b88e84c31dddbb8 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Fri, 5 Dec 2014 09:45:39 +0100 Subject: [PATCH] Gateway: GatewayService should register cluster state listener before checking for current state At the moment we may miss a state change and fail to recover on time. Closes #8789 --- src/main/java/org/elasticsearch/gateway/GatewayService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/gateway/GatewayService.java b/src/main/java/org/elasticsearch/gateway/GatewayService.java index 827a6559bf9..b5468aaf29e 100644 --- a/src/main/java/org/elasticsearch/gateway/GatewayService.java +++ b/src/main/java/org/elasticsearch/gateway/GatewayService.java @@ -104,6 +104,7 @@ public class GatewayService extends AbstractLifecycleComponent i @Override protected void doStart() throws ElasticsearchException { gateway.start(); + clusterService.addLast(this); // if we received initial state, see if we can recover within the start phase, so we hold the // node from starting until we recovered properly if (discoveryService.initialStateReceived()) { @@ -114,7 +115,6 @@ public class GatewayService extends AbstractLifecycleComponent i } else { logger.debug("can't wait on start for (possibly) reading state from gateway, will do it asynchronously"); } - clusterService.addLast(this); } @Override