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
This commit is contained in:
Boaz Leskes 2014-12-05 09:45:39 +01:00
parent 27724bef6a
commit 72155311f0
1 changed files with 1 additions and 1 deletions

View File

@ -104,6 +104,7 @@ public class GatewayService extends AbstractLifecycleComponent<GatewayService> 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<GatewayService> i
} else {
logger.debug("can't wait on start for (possibly) reading state from gateway, will do it asynchronously");
}
clusterService.addLast(this);
}
@Override