Discovery: Unicast Ping should close temporary connections after returning ping results

During pinging we open light , temporary connections to the the unicast hosts. After the pinging is done we close those. At the moment we do so before returning the results of the pings to the caller. On the other hand, in our transport logic we acquire a lock specific to the node id while opening a connection. When disconnecting from node, we have to acquire the same lock in order to guarantee the the connection opening has finished. This can cause big delays in environments where opening a connection is very slow, as the connection closing has to wait *after* the pinging was done.. This can be problematic as  it causes master election to use stale data.

Closes #10849
This commit is contained in:
Boaz Leskes 2015-04-28 13:03:02 +03:00
parent c0d3205146
commit 7d8f39fc27
1 changed files with 1 additions and 1 deletions

View File

@ -220,11 +220,11 @@ public class UnicastZenPing extends AbstractLifecycleComponent<ZenPing> implemen
protected void doRun() throws Exception {
sendPings(timeout, TimeValue.timeValueMillis(timeout.millis() / 2), sendPingsHandler);
sendPingsHandler.close();
listener.onPing(sendPingsHandler.pingCollection().toArray());
for (DiscoveryNode node : sendPingsHandler.nodeToDisconnect) {
logger.trace("[{}] disconnecting from {}", sendPingsHandler.id(), node);
transportService.disconnectFromNode(node);
}
listener.onPing(sendPingsHandler.pingCollection().toArray());
}
@Override