mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 06:25:07 +00:00
clean the cluster state when starting (handles restarts better)
This commit is contained in:
parent
a59679b0c6
commit
b0c8255cd9
@ -71,10 +71,11 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
|||||||
this.discoveryService = discoveryService;
|
this.discoveryService = discoveryService;
|
||||||
this.threadPool = threadPool;
|
this.threadPool = threadPool;
|
||||||
|
|
||||||
this.timeoutInterval = componentSettings.getAsTime("timeoutInterval", timeValueMillis(500));
|
this.timeoutInterval = componentSettings.getAsTime("timeout_interval", timeValueMillis(500));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void doStart() throws ElasticSearchException {
|
@Override protected void doStart() throws ElasticSearchException {
|
||||||
|
this.clusterState = newClusterStateBuilder().build();
|
||||||
this.updateTasksExecutor = newSingleThreadExecutor(daemonThreadFactory(settings, "clusterService#updateTask"));
|
this.updateTasksExecutor = newSingleThreadExecutor(daemonThreadFactory(settings, "clusterService#updateTask"));
|
||||||
scheduledFuture = threadPool.scheduleWithFixedDelay(new Runnable() {
|
scheduledFuture = threadPool.scheduleWithFixedDelay(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
@ -156,7 +157,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
|||||||
} else {
|
} else {
|
||||||
// we got this cluster state from the master, filter out based on versions (don't call listeners)
|
// we got this cluster state from the master, filter out based on versions (don't call listeners)
|
||||||
if (clusterState.version() < previousClusterState.version()) {
|
if (clusterState.version() < previousClusterState.version()) {
|
||||||
logger.info("Got old cluster state [" + clusterState.version() + "<" + previousClusterState.version() + "] from source [" + source + "], ignoring");
|
logger.debug("Got old cluster state [" + clusterState.version() + "<" + previousClusterState.version() + "] from source [" + source + "], ignoring");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,7 +187,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
|||||||
try {
|
try {
|
||||||
transportService.connectToNode(node);
|
transportService.connectToNode(node);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO, need to mark this node as failed...
|
// the fault detection will detect it as failed as well
|
||||||
logger.warn("Failed to connect to node [" + node + "]", e);
|
logger.warn("Failed to connect to node [" + node + "]", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user