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:
parent
27724bef6a
commit
72155311f0
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue