mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-13 08:25:26 +00:00
Transport Client: When sniff
is enabled, use the sniffed nodes to be the list fo nodes to ping as well as the provided nodes, closes #1217.
This commit is contained in:
parent
0c82fc5901
commit
e0fdccd9c0
@ -29,6 +29,7 @@ import org.elasticsearch.client.Requests;
|
|||||||
import org.elasticsearch.cluster.ClusterName;
|
import org.elasticsearch.cluster.ClusterName;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.common.collect.ImmutableList;
|
import org.elasticsearch.common.collect.ImmutableList;
|
||||||
|
import org.elasticsearch.common.collect.Maps;
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
@ -43,6 +44,7 @@ import org.elasticsearch.transport.TransportService;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
@ -288,11 +290,21 @@ public class TransportClientNodesService extends AbstractComponent {
|
|||||||
if (closed) {
|
if (closed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ImmutableList<DiscoveryNode> listedNodes = TransportClientNodesService.this.listedNodes;
|
|
||||||
final CountDownLatch latch = new CountDownLatch(listedNodes.size());
|
// the nodes we are going to ping include the core listed nodes that were added
|
||||||
|
// and the last round of discovered nodes
|
||||||
|
Map<TransportAddress, DiscoveryNode> nodesToPing = Maps.newHashMap();
|
||||||
|
for (DiscoveryNode node : listedNodes) {
|
||||||
|
nodesToPing.put(node.address(), node);
|
||||||
|
}
|
||||||
|
for (DiscoveryNode node : nodes) {
|
||||||
|
nodesToPing.put(node.address(), node);
|
||||||
|
}
|
||||||
|
|
||||||
|
final CountDownLatch latch = new CountDownLatch(nodesToPing.size());
|
||||||
final CopyOnWriteArrayList<NodesInfoResponse> nodesInfoResponses = new CopyOnWriteArrayList<NodesInfoResponse>();
|
final CopyOnWriteArrayList<NodesInfoResponse> nodesInfoResponses = new CopyOnWriteArrayList<NodesInfoResponse>();
|
||||||
for (final DiscoveryNode listedNode : listedNodes) {
|
for (final DiscoveryNode listedNode : nodesToPing.values()) {
|
||||||
threadPool.cached().execute(new Runnable() {
|
threadPool.executor(ThreadPool.Names.MANAGEMENT).execute(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
try {
|
try {
|
||||||
transportService.connectToNode(listedNode); // make sure we are connected to it
|
transportService.connectToNode(listedNode); // make sure we are connected to it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user