[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);
|
||||
}
|
||||
|
||||
if (!nodesDelta.removedNodes().isEmpty()) {
|
||||
threadPool.generic().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (DiscoveryNode node : nodesDelta.removedNodes()) {
|
||||
transportService.disconnectFromNode(node);
|
||||
}
|
||||
}
|
||||
});
|
||||
for (DiscoveryNode node : nodesDelta.removedNodes()) {
|
||||
try {
|
||||
transportService.disconnectFromNode(node);
|
||||
} catch (Throwable e) {
|
||||
logger.warn("failed to disconnect to node [" + node + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
newClusterState.status(ClusterState.ClusterStateStatus.APPLIED);
|
||||
|
|
Loading…
Reference in New Issue