[Internal] Do not use a background thread to disconnect node which are remove from the ClusterState
After a node fails to respond to a ping correctly (master or node fault detection), they are removed from the cluster state through an UpdateTask. When a node is removed, a background task is scheduled using the generic threadpool to actually disconnect the node. However, in the case of temporary node failures (for example) it may be that the node was re-added by the time the task get executed, causing an untimely disconnect call. Disconnect is cheep and should be done during the UpdateTask. Closes #7543
This commit is contained in:
parent
395744b0d2
commit
1f8db672fc
|
@ -443,15 +443,12 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
||||||
listener.clusterChanged(clusterChangedEvent);
|
listener.clusterChanged(clusterChangedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nodesDelta.removedNodes().isEmpty()) {
|
for (DiscoveryNode node : nodesDelta.removedNodes()) {
|
||||||
threadPool.generic().execute(new Runnable() {
|
try {
|
||||||
@Override
|
transportService.disconnectFromNode(node);
|
||||||
public void run() {
|
} catch (Throwable e) {
|
||||||
for (DiscoveryNode node : nodesDelta.removedNodes()) {
|
logger.warn("failed to disconnect to node [" + node + "]", e);
|
||||||
transportService.disconnectFromNode(node);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newClusterState.status(ClusterState.ClusterStateStatus.APPLIED);
|
newClusterState.status(ClusterState.ClusterStateStatus.APPLIED);
|
||||||
|
|
Loading…
Reference in New Issue