Skip to content

Commit

Permalink
[Internal] Do not use a background thread to disconnect node which ar…
Browse files Browse the repository at this point in the history
…e 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
  • Loading branch information
bleskes committed Sep 3, 2014
1 parent 96ba1a9 commit 863ed86
Showing 1 changed file with 6 additions and 9 deletions.
Expand Up @@ -443,15 +443,12 @@ public void run() {
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);
Expand Down

0 comments on commit 863ed86

Please sign in to comment.