From d4bc187be90fb4bf65bde43d6166073429041749 Mon Sep 17 00:00:00 2001 From: kimchy Date: Fri, 9 Apr 2010 00:09:30 +0300 Subject: [PATCH] rename node to DiscoveryNode --- .../admin/cluster/node/info/NodeInfo.java | 6 +- .../node/shutdown/NodesShutdownResponse.java | 4 +- ...TransportSearchDfsQueryAndFetchAction.java | 12 +-- ...ransportSearchDfsQueryThenFetchAction.java | 20 ++-- .../TransportSearchQueryAndFetchAction.java | 4 +- .../TransportSearchQueryThenFetchAction.java | 12 +-- ...nsportSearchScrollQueryAndFetchAction.java | 16 +-- ...sportSearchScrollQueryThenFetchAction.java | 16 +-- .../type/TransportSearchTypeAction.java | 12 +-- .../TransportBroadcastOperationAction.java | 8 +- .../TransportMasterNodeOperationAction.java | 4 +- .../support/nodes/NodeOperationResponse.java | 10 +- .../nodes/TransportNodesOperationAction.java | 6 +- ...nsportShardReplicationOperationAction.java | 10 +- .../TransportSingleOperationAction.java | 8 +- .../client/transport/TransportClient.java | 4 +- .../TransportClientNodesService.java | 30 +++--- .../action/ClientTransportAction.java | 6 +- .../support/BaseClientTransportAction.java | 6 +- .../support/InternalTransportClient.java | 38 +++---- .../InternalTransportClusterAdminClient.java | 30 +++--- .../InternalTransportIndicesAdminClient.java | 42 ++++---- .../cluster/ClusterChangedEvent.java | 6 +- .../elasticsearch/cluster/ClusterState.java | 24 ++--- .../action/index/NodeIndexCreatedAction.java | 4 +- .../action/index/NodeIndexDeletedAction.java | 4 +- .../index/NodeMappingCreatedAction.java | 4 +- .../action/shard/ShardStateAction.java | 6 +- .../node/{Node.java => DiscoveryNode.java} | 18 ++-- .../node/{Nodes.java => DiscoveryNodes.java} | 98 +++++++++---------- .../DefaultShardsRoutingStrategy.java | 12 +-- .../service/InternalClusterService.java | 4 +- .../discovery/jgroups/JgroupsDiscovery.java | 20 ++-- .../discovery/local/LocalDiscovery.java | 14 +-- .../index/shard/recovery/RecoveryAction.java | 12 +-- .../recovery/RecoveryFailedException.java | 4 +- .../cluster/IndicesClusterStateService.java | 12 +-- .../elasticsearch/jmx/JmxClusterService.java | 8 +- .../jmx/action/GetJmxServiceUrlAction.java | 4 +- .../monitor/dump/SimpleDumpGenerator.java | 4 +- .../dump/cluster/ClusterDumpContributor.java | 4 +- .../action/SearchServiceTransportAction.java | 20 ++-- .../transport/ConnectTransportException.java | 10 +- .../SendRequestTransportException.java | 4 +- .../elasticsearch/transport/Transport.java | 8 +- .../transport/TransportService.java | 10 +- .../transport/local/LocalTransport.java | 8 +- .../transport/netty/NettyTransport.java | 14 +-- ...gleShardNoBackupsRoutingStrategyTests.java | 14 +-- ...gleShardOneBackupRoutingStrategyTests.java | 8 +- .../TenShardsOneBackupRoutingTests.java | 8 +- .../ClusterSerializationTests.java | 12 +-- .../local/SimpleLocalTransportTests.java | 10 +- .../netty/SimpleNettyTransportTests.java | 10 +- .../netty/benchmark/BenchmarkNettyClient.java | 4 +- 55 files changed, 353 insertions(+), 353 deletions(-) rename modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/{Node.java => DiscoveryNode.java} (86%) rename modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/{Nodes.java => DiscoveryNodes.java} (73%) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java index 88480851d0b..a942fced4d2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.cluster.node.info; import com.google.common.collect.ImmutableMap; import org.elasticsearch.action.support.nodes.NodeOperationResponse; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.io.stream.StreamInput; import org.elasticsearch.util.io.stream.StreamOutput; import org.elasticsearch.util.settings.ImmutableSettings; @@ -42,11 +42,11 @@ public class NodeInfo extends NodeOperationResponse { NodeInfo() { } - public NodeInfo(Node node, Map attributes, Settings settings) { + public NodeInfo(DiscoveryNode node, Map attributes, Settings settings) { this(node, ImmutableMap.copyOf(attributes), settings); } - public NodeInfo(Node node, ImmutableMap attributes, Settings settings) { + public NodeInfo(DiscoveryNode node, ImmutableMap attributes, Settings settings) { super(node); this.attributes = attributes; this.settings = settings; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java index 9b6104df3fe..4c887230a88 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java @@ -22,7 +22,7 @@ package org.elasticsearch.action.admin.cluster.node.shutdown; import org.elasticsearch.action.support.nodes.NodeOperationResponse; import org.elasticsearch.action.support.nodes.NodesOperationResponse; import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.io.stream.StreamInput; import org.elasticsearch.util.io.stream.StreamOutput; @@ -61,7 +61,7 @@ public class NodesShutdownResponse extends NodesOperationResponse listener) { + @Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener listener) { searchService.sendExecuteDfs(node, request, listener); } @@ -88,7 +88,7 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc int localOperations = 0; for (DfsSearchResult dfsResult : dfsResults) { - Node node = nodes.get(dfsResult.shardTarget().nodeId()); + DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { localOperations++; } else { @@ -101,7 +101,7 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc threadPool.execute(new Runnable() { @Override public void run() { for (DfsSearchResult dfsResult : dfsResults) { - Node node = nodes.get(dfsResult.shardTarget().nodeId()); + DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { QuerySearchRequest querySearchRequest = new QuerySearchRequest(dfsResult.id(), dfs); executeSecondPhase(counter, node, querySearchRequest); @@ -112,7 +112,7 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (DfsSearchResult dfsResult : dfsResults) { - final Node node = nodes.get(dfsResult.shardTarget().nodeId()); + final DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { final QuerySearchRequest querySearchRequest = new QuerySearchRequest(dfsResult.id(), dfs); if (localAsync) { @@ -130,7 +130,7 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc } } - private void executeSecondPhase(final AtomicInteger counter, Node node, QuerySearchRequest querySearchRequest) { + private void executeSecondPhase(final AtomicInteger counter, DiscoveryNode node, QuerySearchRequest querySearchRequest) { searchService.sendExecuteFetch(node, querySearchRequest, new SearchServiceListener() { @Override public void onResult(QueryFetchSearchResult result) { queryFetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java index 13581b8ed75..b2823339581 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java @@ -23,7 +23,7 @@ import com.google.inject.Inject; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.search.SearchShardTarget; @@ -78,7 +78,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA return "dfs"; } - @Override protected void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener listener) { + @Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener listener) { searchService.sendExecuteDfs(node, request, listener); } @@ -93,7 +93,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA int localOperations = 0; for (DfsSearchResult dfsResult : dfsResults) { - Node node = nodes.get(dfsResult.shardTarget().nodeId()); + DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { localOperations++; } else { @@ -107,7 +107,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA threadPool.execute(new Runnable() { @Override public void run() { for (DfsSearchResult dfsResult : dfsResults) { - Node node = nodes.get(dfsResult.shardTarget().nodeId()); + DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { QuerySearchRequest querySearchRequest = new QuerySearchRequest(dfsResult.id(), dfs); executeQuery(counter, querySearchRequest, node); @@ -118,7 +118,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (DfsSearchResult dfsResult : dfsResults) { - final Node node = nodes.get(dfsResult.shardTarget().nodeId()); + final DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { final QuerySearchRequest querySearchRequest = new QuerySearchRequest(dfsResult.id(), dfs); if (localAsync) { @@ -136,7 +136,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA } } - private void executeQuery(final AtomicInteger counter, QuerySearchRequest querySearchRequest, Node node) { + private void executeQuery(final AtomicInteger counter, QuerySearchRequest querySearchRequest, DiscoveryNode node) { searchService.sendExecuteQuery(node, querySearchRequest, new SearchServiceListener() { @Override public void onResult(QuerySearchResult result) { queryResults.put(result.shardTarget(), result); @@ -178,7 +178,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA final AtomicInteger counter = new AtomicInteger(docIdsToLoad.size()); int localOperations = 0; for (Map.Entry entry : docIdsToLoad.entrySet()) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { localOperations++; } else { @@ -192,7 +192,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA threadPool.execute(new Runnable() { @Override public void run() { for (Map.Entry entry : docIdsToLoad.entrySet()) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(entry.getKey()).id(), entry.getValue()); executeFetch(counter, fetchSearchRequest, node); @@ -203,7 +203,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (Map.Entry entry : docIdsToLoad.entrySet()) { - final Node node = nodes.get(entry.getKey().nodeId()); + final DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { final FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(entry.getKey()).id(), entry.getValue()); if (localAsync) { @@ -223,7 +223,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA releaseIrrelevantSearchContexts(queryResults, docIdsToLoad); } - private void executeFetch(final AtomicInteger counter, FetchSearchRequest fetchSearchRequest, Node node) { + private void executeFetch(final AtomicInteger counter, FetchSearchRequest fetchSearchRequest, DiscoveryNode node) { searchService.sendExecuteFetch(node, fetchSearchRequest, new SearchServiceListener() { @Override public void onResult(FetchSearchResult result) { fetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java index 37818542ca7..3c4682b68a5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.search.SearchShardTarget; @@ -68,7 +68,7 @@ public class TransportSearchQueryAndFetchAction extends TransportSearchTypeActio return "query_fetch"; } - @Override protected void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener listener) { + @Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener listener) { searchService.sendExecuteFetch(node, request, listener); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java index adcc6f5b5b1..ef82fa0cc43 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java @@ -23,7 +23,7 @@ import com.google.inject.Inject; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.search.SearchShardTarget; @@ -72,7 +72,7 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi return "query"; } - @Override protected void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener listener) { + @Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener listener) { searchService.sendExecuteQuery(node, request, listener); } @@ -93,7 +93,7 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi int localOperations = 0; for (Map.Entry entry : docIdsToLoad.entrySet()) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { localOperations++; } else { @@ -107,7 +107,7 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi threadPool.execute(new Runnable() { @Override public void run() { for (Map.Entry entry : docIdsToLoad.entrySet()) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(entry.getKey()).id(), entry.getValue()); executeFetch(counter, fetchSearchRequest, node); @@ -118,7 +118,7 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (Map.Entry entry : docIdsToLoad.entrySet()) { - final Node node = nodes.get(entry.getKey().nodeId()); + final DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { final FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(entry.getKey()).id(), entry.getValue()); if (localAsync) { @@ -138,7 +138,7 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi releaseIrrelevantSearchContexts(queryResults, docIdsToLoad); } - private void executeFetch(final AtomicInteger counter, FetchSearchRequest fetchSearchRequest, Node node) { + private void executeFetch(final AtomicInteger counter, FetchSearchRequest fetchSearchRequest, DiscoveryNode node) { searchService.sendExecuteFetch(node, fetchSearchRequest, new SearchServiceListener() { @Override public void onResult(FetchSearchResult result) { fetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java index 9d2f0eddbac..5ccde73ec9f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java @@ -23,8 +23,8 @@ import com.google.inject.Inject; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.action.SearchServiceListener; import org.elasticsearch.search.action.SearchServiceTransportAction; @@ -81,7 +81,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent private final ParsedScrollId scrollId; - private final Nodes nodes; + private final DiscoveryNodes nodes; protected final Collection shardFailures = searchCache.obtainShardFailures(); @@ -107,7 +107,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent int localOperations = 0; for (Tuple target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node != null) { if (nodes.localNodeId().equals(node.id())) { localOperations++; @@ -130,7 +130,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent threadPool.execute(new Runnable() { @Override public void run() { for (Tuple target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { executePhase(node, target.v2()); } @@ -140,7 +140,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Tuple target : scrollId.values()) { - final Node node = nodes.get(target.v1()); + final DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { if (localAsync) { threadPool.execute(new Runnable() { @@ -157,7 +157,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent } for (Tuple target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node == null) { if (logger.isDebugEnabled()) { logger.debug("Node [" + target.v1() + "] not available for scroll request [" + scrollId.source() + "]"); @@ -171,7 +171,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent } } - private void executePhase(Node node, long searchId) { + private void executePhase(DiscoveryNode node, long searchId) { searchService.sendExecuteFetch(node, internalScrollSearchRequest(searchId, request), new SearchServiceListener() { @Override public void onResult(QueryFetchSearchResult result) { queryFetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java index a146019e986..a2f1a00eb04 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java @@ -23,8 +23,8 @@ import com.google.inject.Inject; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.action.SearchServiceListener; import org.elasticsearch.search.action.SearchServiceTransportAction; @@ -85,7 +85,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent private final ParsedScrollId scrollId; - private final Nodes nodes; + private final DiscoveryNodes nodes; protected final Collection shardFailures = searchCache.obtainShardFailures(); @@ -113,7 +113,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent int localOperations = 0; for (Tuple target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node != null) { if (nodes.localNodeId().equals(node.id())) { localOperations++; @@ -136,7 +136,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent threadPool.execute(new Runnable() { @Override public void run() { for (Tuple target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { executeQueryPhase(counter, node, target.v2()); } @@ -146,7 +146,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Tuple target : scrollId.values()) { - final Node node = nodes.get(target.v1()); + final DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { if (localAsync) { threadPool.execute(new Runnable() { @@ -163,7 +163,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent } } - private void executeQueryPhase(final AtomicInteger counter, Node node, long searchId) { + private void executeQueryPhase(final AtomicInteger counter, DiscoveryNode node, long searchId) { searchService.sendExecuteQuery(node, internalScrollSearchRequest(searchId, request), new SearchServiceListener() { @Override public void onResult(QuerySearchResult result) { queryResults.put(result.shardTarget(), result); @@ -199,7 +199,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent SearchShardTarget shardTarget = entry.getKey(); ExtTIntArrayList docIds = entry.getValue(); FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(shardTarget).id(), docIds); - Node node = nodes.get(shardTarget.nodeId()); + DiscoveryNode node = nodes.get(shardTarget.nodeId()); searchService.sendExecuteFetch(node, fetchSearchRequest, new SearchServiceListener() { @Override public void onResult(FetchSearchResult result) { fetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java index 5e0ca3d3b8a..b186a9e9b5a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java @@ -24,8 +24,8 @@ import org.elasticsearch.action.search.*; import org.elasticsearch.action.support.BaseAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; @@ -83,7 +83,7 @@ public abstract class TransportSearchTypeAction extends BaseAction() { @Override public void onResult(FirstResult result) { onFirstPhaseResult(shard, result, shardIt); @@ -281,7 +281,7 @@ public abstract class TransportSearchTypeAction extends BaseAction docIdsToLoad) { for (Map.Entry entry : queryResults.entrySet()) { if (!docIdsToLoad.containsKey(entry.getKey())) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node != null) { // should not happen (==null) but safeguard anyhow searchService.sendFreeContext(node, entry.getValue().id()); } @@ -313,7 +313,7 @@ public abstract class TransportSearchTypeAction extends BaseAction listener); + protected abstract void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener listener); protected abstract void processFirstPhaseResult(ShardRouting shard, FirstResult result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java index 585a8270ffd..ed26cca460e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java @@ -25,8 +25,8 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.BaseAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; @@ -111,7 +111,7 @@ public abstract class TransportBroadcastOperationAction() { @Override public ShardResponse newInstance() { return newShardResponse(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java index 5d067981775..8928a5b6ac6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.support.BaseAction; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.settings.Settings; @@ -60,7 +60,7 @@ public abstract class TransportMasterNodeOperationAction listener) { - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java index 6e15509d561..cd58ba28adc 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java @@ -19,7 +19,7 @@ package org.elasticsearch.action.support.nodes; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.io.stream.StreamInput; import org.elasticsearch.util.io.stream.StreamOutput; import org.elasticsearch.util.io.stream.Streamable; @@ -31,21 +31,21 @@ import java.io.IOException; */ public abstract class NodeOperationResponse implements Streamable { - private Node node; + private DiscoveryNode node; protected NodeOperationResponse() { } - protected NodeOperationResponse(Node node) { + protected NodeOperationResponse(DiscoveryNode node) { this.node = node; } - public Node node() { + public DiscoveryNode node() { return node; } @Override public void readFrom(StreamInput in) throws IOException { - node = Node.readNode(in); + node = DiscoveryNode.readNode(in); } @Override public void writeTo(StreamOutput out) throws IOException { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java index 459a8a02e89..1406bc171da 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.action.support.BaseAction; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.settings.Settings; @@ -108,7 +108,7 @@ public abstract class TransportNodesOperationAction() { @Override public Response newInstance() { @@ -399,7 +399,7 @@ public abstract class TransportShardReplicationOperationAction listener) { this.request = request; @@ -164,7 +164,7 @@ public abstract class TransportSingleOperationAction() { @Override public Response newInstance() { return newResponse(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java index 4d46c434dd2..c9761b7179f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java @@ -47,7 +47,7 @@ import org.elasticsearch.client.Client; import org.elasticsearch.client.transport.action.ClientTransportActionModule; import org.elasticsearch.client.transport.support.InternalTransportClient; import org.elasticsearch.cluster.ClusterNameModule; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.env.Environment; import org.elasticsearch.env.EnvironmentModule; import org.elasticsearch.server.internal.InternalSettingsPerparer; @@ -166,7 +166,7 @@ public class TransportClient implements Client { *

The nodes include all the nodes that are currently alive based on the transport * addresses provided. */ - public ImmutableList connectedNodes() { + public ImmutableList connectedNodes() { return nodesService.connectedNodes(); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java index 2e202c239af..de32ec5ca6c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java @@ -28,8 +28,8 @@ import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterStateListener; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportResponseHandler; import org.elasticsearch.transport.ConnectTransportException; @@ -65,9 +65,9 @@ public class TransportClientNodesService extends AbstractComponent implements Cl private final Object transportMutex = new Object(); - private volatile ImmutableList nodes = ImmutableList.of(); + private volatile ImmutableList nodes = ImmutableList.of(); - private volatile Nodes discoveredNodes; + private volatile DiscoveryNodes discoveredNodes; private final AtomicInteger tempNodeIdGenerator = new AtomicInteger(); @@ -100,7 +100,7 @@ public class TransportClientNodesService extends AbstractComponent implements Cl return this.transportAddresses; } - public ImmutableList connectedNodes() { + public ImmutableList connectedNodes() { return this.nodes; } @@ -128,13 +128,13 @@ public class TransportClientNodesService extends AbstractComponent implements Cl } public T execute(NodeCallback callback) throws ElasticSearchException { - ImmutableList nodes = this.nodes; + ImmutableList nodes = this.nodes; if (nodes.isEmpty()) { throw new NoNodeAvailableException(); } int index = randomNodeGenerator.incrementAndGet(); for (int i = 0; i < nodes.size(); i++) { - Node node = nodes.get((index + i) % nodes.size()); + DiscoveryNode node = nodes.get((index + i) % nodes.size()); try { return callback.doWithNode(node); } catch (ConnectTransportException e) { @@ -151,9 +151,9 @@ public class TransportClientNodesService extends AbstractComponent implements Cl @Override public void clusterChanged(ClusterChangedEvent event) { transportService.nodesAdded(event.nodesDelta().addedNodes()); this.discoveredNodes = event.state().nodes(); - HashSet newNodes = new HashSet(nodes); + HashSet newNodes = new HashSet(nodes); newNodes.addAll(discoveredNodes.nodes().values()); - nodes = new ImmutableList.Builder().addAll(newNodes).build(); + nodes = new ImmutableList.Builder().addAll(newNodes).build(); transportService.nodesRemoved(event.nodesDelta().removedNodes()); } @@ -163,11 +163,11 @@ public class TransportClientNodesService extends AbstractComponent implements Cl ImmutableList transportAddresses = TransportClientNodesService.this.transportAddresses; final CountDownLatch latch = new CountDownLatch(transportAddresses.size()); final CopyOnWriteArrayList nodesInfoResponses = new CopyOnWriteArrayList(); - final CopyOnWriteArrayList tempNodes = new CopyOnWriteArrayList(); + final CopyOnWriteArrayList tempNodes = new CopyOnWriteArrayList(); for (final TransportAddress transportAddress : transportAddresses) { threadPool.execute(new Runnable() { @Override public void run() { - Node tempNode = new Node("#temp#-" + tempNodeIdGenerator.incrementAndGet(), transportAddress); + DiscoveryNode tempNode = new DiscoveryNode("#temp#-" + tempNodeIdGenerator.incrementAndGet(), transportAddress); tempNodes.add(tempNode); try { transportService.nodesAdded(ImmutableList.of(tempNode)); @@ -201,10 +201,10 @@ public class TransportClientNodesService extends AbstractComponent implements Cl return; } - HashSet newNodes = new HashSet(); + HashSet newNodes = new HashSet(); for (NodesInfoResponse nodesInfoResponse : nodesInfoResponses) { if (nodesInfoResponse.nodes().length > 0) { - Node node = nodesInfoResponse.nodes()[0].node(); + DiscoveryNode node = nodesInfoResponse.nodes()[0].node(); if (!clusterName.equals(nodesInfoResponse.clusterName())) { logger.warn("Node {} not part of the cluster {}, ignoring...", node, clusterName); } else { @@ -218,7 +218,7 @@ public class TransportClientNodesService extends AbstractComponent implements Cl if (discoveredNodes != null) { newNodes.addAll(discoveredNodes.nodes().values()); } - nodes = new ImmutableList.Builder().addAll(newNodes).build(); + nodes = new ImmutableList.Builder().addAll(newNodes).build(); transportService.nodesRemoved(tempNodes); } @@ -226,6 +226,6 @@ public class TransportClientNodesService extends AbstractComponent implements Cl public static interface NodeCallback { - T doWithNode(Node node) throws ElasticSearchException; + T doWithNode(DiscoveryNode node) throws ElasticSearchException; } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportAction.java index 1fcd4a51456..cb227b4ffce 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportAction.java @@ -24,14 +24,14 @@ import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; /** * @author kimchy (Shay Banon) */ public interface ClientTransportAction { - ActionFuture execute(Node node, Request request) throws ElasticSearchException; + ActionFuture execute(DiscoveryNode node, Request request) throws ElasticSearchException; - void execute(Node node, Request request, ActionListener listener); + void execute(DiscoveryNode node, Request request, ActionListener listener); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/support/BaseClientTransportAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/support/BaseClientTransportAction.java index f0d2d537871..36c4a853e0c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/support/BaseClientTransportAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/support/BaseClientTransportAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.client.transport.action.ClientTransportAction; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.transport.BaseTransportResponseHandler; import org.elasticsearch.transport.RemoteTransportException; import org.elasticsearch.transport.TransportService; @@ -59,14 +59,14 @@ public abstract class BaseClientTransportAction execute(Node node, Request request) throws ElasticSearchException { + @Override public ActionFuture execute(DiscoveryNode node, Request request) throws ElasticSearchException { PlainActionFuture future = newFuture(); request.listenerThreaded(false); execute(node, request, future); return future; } - @Override public void execute(Node node, final Request request, final ActionListener listener) { + @Override public void execute(DiscoveryNode node, final Request request, final ActionListener listener) { transportService.sendRequest(node, action(), request, new BaseTransportResponseHandler() { @Override public Response newInstance() { return BaseClientTransportAction.this.newInstance(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClient.java index 03ef658e0c0..9e9a7fc9052 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClient.java @@ -51,7 +51,7 @@ import org.elasticsearch.client.transport.action.mlt.ClientTransportMoreLikeThis import org.elasticsearch.client.transport.action.search.ClientTransportSearchAction; import org.elasticsearch.client.transport.action.search.ClientTransportSearchScrollAction; import org.elasticsearch.client.transport.action.terms.ClientTransportTermsAction; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.component.AbstractComponent; import org.elasticsearch.util.settings.Settings; @@ -112,7 +112,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture index(final IndexRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return indexAction.execute(node, request); } }); @@ -120,7 +120,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void index(final IndexRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { indexAction.execute(node, request, listener); return null; } @@ -129,7 +129,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture delete(final DeleteRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return deleteAction.execute(node, request); } }); @@ -137,7 +137,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void delete(final DeleteRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { deleteAction.execute(node, request, listener); return null; } @@ -146,7 +146,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture deleteByQuery(final DeleteByQueryRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return deleteByQueryAction.execute(node, request); } }); @@ -154,7 +154,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void deleteByQuery(final DeleteByQueryRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { deleteByQueryAction.execute(node, request, listener); return null; } @@ -163,7 +163,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture get(final GetRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return getAction.execute(node, request); } }); @@ -171,7 +171,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void get(final GetRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { getAction.execute(node, request, listener); return null; } @@ -180,7 +180,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture count(final CountRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return countAction.execute(node, request); } }); @@ -188,7 +188,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void count(final CountRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { countAction.execute(node, request, listener); return null; } @@ -197,7 +197,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture search(final SearchRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return searchAction.execute(node, request); } }); @@ -205,7 +205,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void search(final SearchRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { searchAction.execute(node, request, listener); return null; } @@ -214,7 +214,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture searchScroll(final SearchScrollRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return searchScrollAction.execute(node, request); } }); @@ -222,7 +222,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void searchScroll(final SearchScrollRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { searchScrollAction.execute(node, request, listener); return null; } @@ -231,7 +231,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture terms(final TermsRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return termsAction.execute(node, request); } }); @@ -239,7 +239,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void terms(final TermsRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { termsAction.execute(node, request, listener); return null; } @@ -248,7 +248,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture moreLikeThis(final MoreLikeThisRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return moreLikeThisAction.execute(node, request); } }); @@ -256,7 +256,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void moreLikeThis(final MoreLikeThisRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { moreLikeThisAction.execute(node, request, listener); return null; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClusterAdminClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClusterAdminClient.java index 0420e6b47f0..7fa4dbcb783 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClusterAdminClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClusterAdminClient.java @@ -46,7 +46,7 @@ import org.elasticsearch.client.transport.action.admin.cluster.ping.broadcast.Cl import org.elasticsearch.client.transport.action.admin.cluster.ping.replication.ClientTransportReplicationPingAction; import org.elasticsearch.client.transport.action.admin.cluster.ping.single.ClientTransportSinglePingAction; import org.elasticsearch.client.transport.action.admin.cluster.state.ClientTransportClusterStateAction; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.component.AbstractComponent; import org.elasticsearch.util.settings.Settings; @@ -88,7 +88,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture health(final ClusterHealthRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return clusterHealthAction.execute(node, request); } }); @@ -96,7 +96,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void health(final ClusterHealthRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { clusterHealthAction.execute(node, request, listener); return null; } @@ -105,7 +105,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture state(final ClusterStateRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return clusterStateAction.execute(node, request); } }); @@ -113,7 +113,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void state(final ClusterStateRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { clusterStateAction.execute(node, request, listener); return null; } @@ -122,7 +122,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture ping(final SinglePingRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return singlePingAction.execute(node, request); } }); @@ -130,7 +130,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void ping(final SinglePingRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { singlePingAction.execute(node, request, listener); return null; } @@ -139,7 +139,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture ping(final BroadcastPingRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return broadcastPingAction.execute(node, request); } }); @@ -147,7 +147,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void ping(final BroadcastPingRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { broadcastPingAction.execute(node, request, listener); return null; } @@ -156,7 +156,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture ping(final ReplicationPingRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return replicationPingAction.execute(node, request); } }); @@ -164,7 +164,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void ping(final ReplicationPingRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { replicationPingAction.execute(node, request, listener); return null; } @@ -173,7 +173,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture nodesInfo(final NodesInfoRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return nodesInfoAction.execute(node, request); } }); @@ -181,7 +181,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void nodesInfo(final NodesInfoRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { nodesInfoAction.execute(node, request, listener); return null; } @@ -190,7 +190,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture nodesShutdown(final NodesShutdownRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return nodesShutdownAction.execute(node, request); } }); @@ -198,7 +198,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void nodesShutdown(final NodesShutdownRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { nodesShutdownAction.execute(node, request, listener); return null; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java index d55ab7210b8..170f711c73a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java @@ -55,7 +55,7 @@ import org.elasticsearch.client.transport.action.admin.indices.mapping.create.Cl import org.elasticsearch.client.transport.action.admin.indices.optimize.ClientTransportOptimizeAction; import org.elasticsearch.client.transport.action.admin.indices.refresh.ClientTransportRefreshAction; import org.elasticsearch.client.transport.action.admin.indices.status.ClientTransportIndicesStatusAction; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.component.AbstractComponent; import org.elasticsearch.util.settings.Settings; @@ -108,7 +108,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture status(final IndicesStatusRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return indicesStatusAction.execute(node, request); } }); @@ -116,7 +116,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void status(final IndicesStatusRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { indicesStatusAction.execute(node, request, listener); return null; } @@ -125,7 +125,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture create(final CreateIndexRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return createIndexAction.execute(node, request); } }); @@ -133,7 +133,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void create(final CreateIndexRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { createIndexAction.execute(node, request, listener); return null; } @@ -142,7 +142,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture delete(final DeleteIndexRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return deleteIndexAction.execute(node, request); } }); @@ -150,7 +150,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void delete(final DeleteIndexRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { deleteIndexAction.execute(node, request, listener); return null; } @@ -159,7 +159,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture refresh(final RefreshRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return refreshAction.execute(node, request); } }); @@ -167,7 +167,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void refresh(final RefreshRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { refreshAction.execute(node, request, listener); return null; } @@ -176,7 +176,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture flush(final FlushRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return flushAction.execute(node, request); } }); @@ -184,7 +184,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void flush(final FlushRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { flushAction.execute(node, request, listener); return null; } @@ -193,7 +193,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture optimize(final OptimizeRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return optimizeAction.execute(node, request); } }); @@ -201,7 +201,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void optimize(final OptimizeRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { optimizeAction.execute(node, request, listener); return null; } @@ -210,7 +210,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture putMapping(final PutMappingRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return putMappingAction.execute(node, request); } }); @@ -218,7 +218,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void putMapping(final PutMappingRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { putMappingAction.execute(node, request, listener); return null; } @@ -227,7 +227,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture gatewaySnapshot(final GatewaySnapshotRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return gatewaySnapshotAction.execute(node, request); } }); @@ -235,7 +235,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void gatewaySnapshot(final GatewaySnapshotRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { gatewaySnapshotAction.execute(node, request, listener); return null; } @@ -244,7 +244,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture aliases(final IndicesAliasesRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return indicesAliasesAction.execute(node, request); } }); @@ -252,7 +252,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void aliases(final IndicesAliasesRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { indicesAliasesAction.execute(node, request, listener); return null; } @@ -261,7 +261,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture clearCache(final ClearIndicesCacheRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback>() { - @Override public ActionFuture doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException { return clearIndicesCacheAction.execute(node, request); } }); @@ -269,7 +269,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void clearCache(final ClearIndicesCacheRequest request, final ActionListener listener) { nodesService.execute(new TransportClientNodesService.NodeCallback() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { clearIndicesCacheAction.execute(node, request, listener); return null; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java index 62b70fe9d2f..8f829cd758c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java @@ -19,7 +19,7 @@ package org.elasticsearch.cluster; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; /** * @author kimchy (Shay Banon) @@ -34,7 +34,7 @@ public class ClusterChangedEvent { private final boolean firstMaster; - private final Nodes.Delta nodesDelta; + private final DiscoveryNodes.Delta nodesDelta; public ClusterChangedEvent(String source, ClusterState state, ClusterState previousState, boolean firstMaster) { this.source = source; @@ -75,7 +75,7 @@ public class ClusterChangedEvent { return firstMaster; } - public Nodes.Delta nodesDelta() { + public DiscoveryNodes.Delta nodesDelta() { return this.nodesDelta; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java index 0b85e1bdc8c..44232580a45 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java @@ -20,8 +20,8 @@ package org.elasticsearch.cluster; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.util.Nullable; @@ -42,14 +42,14 @@ public class ClusterState { private final RoutingTable routingTable; - private final Nodes nodes; + private final DiscoveryNodes nodes; private final MetaData metaData; // built on demand private volatile RoutingNodes routingNodes; - public ClusterState(long version, MetaData metaData, RoutingTable routingTable, Nodes nodes) { + public ClusterState(long version, MetaData metaData, RoutingTable routingTable, DiscoveryNodes nodes) { this.version = version; this.metaData = metaData; this.routingTable = routingTable; @@ -60,7 +60,7 @@ public class ClusterState { return this.version; } - public Nodes nodes() { + public DiscoveryNodes nodes() { return this.nodes; } @@ -100,13 +100,13 @@ public class ClusterState { private RoutingTable routingTable = RoutingTable.EMPTY_ROUTING_TABLE; - private Nodes nodes = Nodes.EMPTY_NODES; + private DiscoveryNodes nodes = DiscoveryNodes.EMPTY_NODES; - public Builder nodes(Nodes.Builder nodesBuilder) { + public Builder nodes(DiscoveryNodes.Builder nodesBuilder) { return nodes(nodesBuilder.build()); } - public Builder nodes(Nodes nodes) { + public Builder nodes(DiscoveryNodes nodes) { this.nodes = nodes; return this; } @@ -147,7 +147,7 @@ public class ClusterState { return os.copiedByteArray(); } - public static ClusterState fromBytes(byte[] data, Settings globalSettings, Node localNode) throws IOException { + public static ClusterState fromBytes(byte[] data, Settings globalSettings, DiscoveryNode localNode) throws IOException { return readFrom(new BytesStreamInput(data), globalSettings, localNode); } @@ -155,15 +155,15 @@ public class ClusterState { out.writeLong(state.version()); MetaData.Builder.writeTo(state.metaData(), out); RoutingTable.Builder.writeTo(state.routingTable(), out); - Nodes.Builder.writeTo(state.nodes(), out); + DiscoveryNodes.Builder.writeTo(state.nodes(), out); } - public static ClusterState readFrom(StreamInput in, @Nullable Settings globalSettings, @Nullable Node localNode) throws IOException { + public static ClusterState readFrom(StreamInput in, @Nullable Settings globalSettings, @Nullable DiscoveryNode localNode) throws IOException { Builder builder = new Builder(); builder.version = in.readLong(); builder.metaData = MetaData.Builder.readFrom(in, globalSettings); builder.routingTable = RoutingTable.Builder.readFrom(in); - builder.nodes = Nodes.Builder.readFrom(in, localNode); + builder.nodes = DiscoveryNodes.Builder.readFrom(in, localNode); return builder.build(); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java index deb15e97a51..e9affa656f1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java @@ -22,7 +22,7 @@ package org.elasticsearch.cluster.action.index; import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; @@ -69,7 +69,7 @@ public class NodeIndexCreatedAction extends AbstractComponent { } public void nodeIndexCreated(final String index, final String nodeId) throws ElasticSearchException { - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java index e6a1a686b90..8df5b788f31 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java @@ -22,7 +22,7 @@ package org.elasticsearch.cluster.action.index; import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; @@ -69,7 +69,7 @@ public class NodeIndexDeletedAction extends AbstractComponent { } public void nodeIndexDeleted(final String index, final String nodeId) throws ElasticSearchException { - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java index 82c0618416d..8cef1f8bfbf 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java @@ -22,7 +22,7 @@ package org.elasticsearch.cluster.action.index; import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; @@ -69,7 +69,7 @@ public class NodeMappingCreatedAction extends AbstractComponent { } public void nodeMappingCreated(final NodeMappingCreatedResponse response) throws ElasticSearchException { - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java index be28fc628bb..cbd7fc78f73 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java @@ -24,7 +24,7 @@ import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.RoutingTable; @@ -75,7 +75,7 @@ public class ShardStateAction extends AbstractComponent { public void shardFailed(final ShardRouting shardRouting, final String reason) throws ElasticSearchException { logger.warn("Sending failed shard for {}, reason [{}]", shardRouting, reason); - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { @@ -92,7 +92,7 @@ public class ShardStateAction extends AbstractComponent { if (logger.isDebugEnabled()) { logger.debug("Sending shard started for {}, reason [{}]", shardRouting, reason); } - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Node.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java similarity index 86% rename from modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Node.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java index 678ac34445c..7a6f35380fe 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Node.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java @@ -33,9 +33,9 @@ import java.io.Serializable; /** * @author kimchy (Shay Banon) */ -public class Node implements Streamable, Serializable { +public class DiscoveryNode implements Streamable, Serializable { - public static final ImmutableList EMPTY_LIST = ImmutableList.of(); + public static final ImmutableList EMPTY_LIST = ImmutableList.of(); private String nodeName = StringHelper.intern(""); @@ -45,14 +45,14 @@ public class Node implements Streamable, Serializable { private boolean dataNode = true; - private Node() { + private DiscoveryNode() { } - public Node(String nodeId, TransportAddress address) { + public DiscoveryNode(String nodeId, TransportAddress address) { this("", true, nodeId, address); } - public Node(String nodeName, boolean dataNode, String nodeId, TransportAddress address) { + public DiscoveryNode(String nodeName, boolean dataNode, String nodeId, TransportAddress address) { if (nodeName == null) { this.nodeName = StringHelper.intern(""); } else { @@ -91,8 +91,8 @@ public class Node implements Streamable, Serializable { return dataNode; } - public static Node readNode(StreamInput in) throws IOException { - Node node = new Node(); + public static DiscoveryNode readNode(StreamInput in) throws IOException { + DiscoveryNode node = new DiscoveryNode(); node.readFrom(in); return node; } @@ -112,10 +112,10 @@ public class Node implements Streamable, Serializable { } @Override public boolean equals(Object obj) { - if (!(obj instanceof Node)) + if (!(obj instanceof DiscoveryNode)) return false; - Node other = (Node) obj; + DiscoveryNode other = (DiscoveryNode) obj; return this.nodeId.equals(other.nodeId); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Nodes.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java similarity index 73% rename from modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Nodes.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java index 09e10599c67..dea023aae1e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Nodes.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java @@ -37,26 +37,26 @@ import static com.google.common.collect.Maps.*; /** * @author kimchy (Shay Banon) */ -public class Nodes implements Iterable { +public class DiscoveryNodes implements Iterable { - public static Nodes EMPTY_NODES = newNodesBuilder().build(); + public static DiscoveryNodes EMPTY_NODES = newNodesBuilder().build(); - private final ImmutableMap nodes; + private final ImmutableMap nodes; - private final ImmutableMap dataNodes; + private final ImmutableMap dataNodes; private final String masterNodeId; private final String localNodeId; - private Nodes(ImmutableMap nodes, ImmutableMap dataNodes, String masterNodeId, String localNodeId) { + private DiscoveryNodes(ImmutableMap nodes, ImmutableMap dataNodes, String masterNodeId, String localNodeId) { this.nodes = nodes; this.dataNodes = dataNodes; this.masterNodeId = masterNodeId; this.localNodeId = localNodeId; } - @Override public UnmodifiableIterator iterator() { + @Override public UnmodifiableIterator iterator() { return nodes.values().iterator(); } @@ -83,15 +83,15 @@ public class Nodes implements Iterable { return nodes.size(); } - public ImmutableMap nodes() { + public ImmutableMap nodes() { return this.nodes; } - public ImmutableMap dataNodes() { + public ImmutableMap dataNodes() { return this.dataNodes; } - public Node get(String nodeId) { + public DiscoveryNode get(String nodeId) { return nodes.get(nodeId); } @@ -107,17 +107,17 @@ public class Nodes implements Iterable { return this.localNodeId; } - public Node localNode() { + public DiscoveryNode localNode() { return nodes.get(localNodeId); } - public Node masterNode() { + public DiscoveryNode masterNode() { return nodes.get(masterNodeId); } - public Nodes removeDeadMembers(Set newNodes, String masterNodeId) { + public DiscoveryNodes removeDeadMembers(Set newNodes, String masterNodeId) { Builder builder = new Builder().masterNodeId(masterNodeId).localNodeId(localNodeId); - for (Node node : this) { + for (DiscoveryNode node : this) { if (newNodes.contains(node.id())) { builder.put(node); } @@ -125,28 +125,28 @@ public class Nodes implements Iterable { return builder.build(); } - public Nodes newNode(Node node) { + public DiscoveryNodes newNode(DiscoveryNode node) { return new Builder().putAll(this).put(node).build(); } /** * Returns the changes comparing this nodes to the provided nodes. */ - public Delta delta(Nodes other) { - List removed = newArrayList(); - List added = newArrayList(); - for (Node node : other) { + public Delta delta(DiscoveryNodes other) { + List removed = newArrayList(); + List added = newArrayList(); + for (DiscoveryNode node : other) { if (!this.nodeExists(node.id())) { removed.add(node); } } - for (Node node : this) { + for (DiscoveryNode node : this) { if (!other.nodeExists(node.id())) { added.add(node); } } - Node previousMasterNode = null; - Node newMasterNode = null; + DiscoveryNode previousMasterNode = null; + DiscoveryNode newMasterNode = null; if (masterNodeId != null) { if (other.masterNodeId == null || !other.masterNodeId.equals(masterNodeId)) { previousMasterNode = other.masterNode(); @@ -159,7 +159,7 @@ public class Nodes implements Iterable { public String prettyPrint() { StringBuilder sb = new StringBuilder(); sb.append("Nodes: \n"); - for (Node node : this) { + for (DiscoveryNode node : this) { sb.append(" ").append(node); if (node == localNode()) { sb.append(", local"); @@ -173,23 +173,23 @@ public class Nodes implements Iterable { } public Delta emptyDelta() { - return new Delta(null, null, localNodeId, Node.EMPTY_LIST, Node.EMPTY_LIST); + return new Delta(null, null, localNodeId, DiscoveryNode.EMPTY_LIST, DiscoveryNode.EMPTY_LIST); } public static class Delta { private final String localNodeId; - private final Node previousMasterNode; - private final Node newMasterNode; - private final ImmutableList removed; - private final ImmutableList added; + private final DiscoveryNode previousMasterNode; + private final DiscoveryNode newMasterNode; + private final ImmutableList removed; + private final ImmutableList added; - public Delta(String localNodeId, ImmutableList removed, ImmutableList added) { + public Delta(String localNodeId, ImmutableList removed, ImmutableList added) { this(null, null, localNodeId, removed, added); } - public Delta(@Nullable Node previousMasterNode, @Nullable Node newMasterNode, String localNodeId, ImmutableList removed, ImmutableList added) { + public Delta(@Nullable DiscoveryNode previousMasterNode, @Nullable DiscoveryNode newMasterNode, String localNodeId, ImmutableList removed, ImmutableList added) { this.previousMasterNode = previousMasterNode; this.newMasterNode = newMasterNode; this.localNodeId = localNodeId; @@ -205,11 +205,11 @@ public class Nodes implements Iterable { return newMasterNode != null; } - public Node previousMasterNode() { + public DiscoveryNode previousMasterNode() { return previousMasterNode; } - public Node newMasterNode() { + public DiscoveryNode newMasterNode() { return newMasterNode; } @@ -217,7 +217,7 @@ public class Nodes implements Iterable { return !removed.isEmpty(); } - public ImmutableList removedNodes() { + public ImmutableList removedNodes() { return removed; } @@ -225,7 +225,7 @@ public class Nodes implements Iterable { return !added.isEmpty(); } - public ImmutableList addedNodes() { + public ImmutableList addedNodes() { return added; } @@ -252,7 +252,7 @@ public class Nodes implements Iterable { sb.append(", "); } sb.append("Removed {"); - for (Node node : removedNodes()) { + for (DiscoveryNode node : removedNodes()) { sb.append(node).append(','); } sb.append("}"); @@ -265,7 +265,7 @@ public class Nodes implements Iterable { sb.append(", "); } sb.append("Added {"); - for (Node node : addedNodes()) { + for (DiscoveryNode node : addedNodes()) { if (!node.id().equals(localNodeId)) { // don't print ourself sb.append(node).append(','); @@ -284,28 +284,28 @@ public class Nodes implements Iterable { public static class Builder { - private Map nodes = newHashMap(); + private Map nodes = newHashMap(); private String masterNodeId; private String localNodeId; - public Builder putAll(Nodes nodes) { + public Builder putAll(DiscoveryNodes nodes) { this.masterNodeId = nodes.masterNodeId(); this.localNodeId = nodes.localNodeId(); - for (Node node : nodes) { + for (DiscoveryNode node : nodes) { put(node); } return this; } - public Builder put(Node node) { + public Builder put(DiscoveryNode node) { nodes.put(node.id(), node); return this; } - public Builder putAll(Iterable nodes) { - for (Node node : nodes) { + public Builder putAll(Iterable nodes) { + for (DiscoveryNode node : nodes) { put(node); } return this; @@ -326,25 +326,25 @@ public class Nodes implements Iterable { return this; } - public Nodes build() { - ImmutableMap.Builder dataNodesBuilder = ImmutableMap.builder(); - for (Map.Entry nodeEntry : nodes.entrySet()) { + public DiscoveryNodes build() { + ImmutableMap.Builder dataNodesBuilder = ImmutableMap.builder(); + for (Map.Entry nodeEntry : nodes.entrySet()) { if (nodeEntry.getValue().dataNode()) { dataNodesBuilder.put(nodeEntry.getKey(), nodeEntry.getValue()); } } - return new Nodes(ImmutableMap.copyOf(nodes), dataNodesBuilder.build(), masterNodeId, localNodeId); + return new DiscoveryNodes(ImmutableMap.copyOf(nodes), dataNodesBuilder.build(), masterNodeId, localNodeId); } - public static void writeTo(Nodes nodes, StreamOutput out) throws IOException { + public static void writeTo(DiscoveryNodes nodes, StreamOutput out) throws IOException { out.writeUTF(nodes.masterNodeId); out.writeVInt(nodes.size()); - for (Node node : nodes) { + for (DiscoveryNode node : nodes) { node.writeTo(out); } } - public static Nodes readFrom(StreamInput in, @Nullable Node localNode) throws IOException { + public static DiscoveryNodes readFrom(StreamInput in, @Nullable DiscoveryNode localNode) throws IOException { Builder builder = new Builder(); builder.masterNodeId(in.readUTF()); if (localNode != null) { @@ -352,7 +352,7 @@ public class Nodes implements Iterable { } int size = in.readVInt(); for (int i = 0; i < size; i++) { - Node node = Node.readNode(in); + DiscoveryNode node = DiscoveryNode.readNode(in); if (localNode != null && node.id().equals(localNode.id())) { // reuse the same instance of our address and local node id for faster equality node = localNode; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/DefaultShardsRoutingStrategy.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/DefaultShardsRoutingStrategy.java index c2241742191..6a7052a3276 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/DefaultShardsRoutingStrategy.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/DefaultShardsRoutingStrategy.java @@ -20,7 +20,7 @@ package org.elasticsearch.cluster.routing.strategy; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.*; import java.util.Iterator; @@ -54,7 +54,7 @@ public class DefaultShardsRoutingStrategy implements ShardsRoutingStrategy { @Override public RoutingTable reroute(ClusterState clusterState) { RoutingNodes routingNodes = clusterState.routingNodes(); - Iterable dataNodes = clusterState.nodes().dataNodes().values(); + Iterable dataNodes = clusterState.nodes().dataNodes().values(); boolean changed = false; // first, clear from the shards any node id they used to belong to that is now dead @@ -212,8 +212,8 @@ public class DefaultShardsRoutingStrategy implements ShardsRoutingStrategy { * * @param liveNodes currently live nodes. */ - private void applyNewNodes(RoutingNodes routingNodes, Iterable liveNodes) { - for (Node node : liveNodes) { + private void applyNewNodes(RoutingNodes routingNodes, Iterable liveNodes) { + for (DiscoveryNode node : liveNodes) { if (!routingNodes.nodesToShards().containsKey(node.id())) { RoutingNode routingNode = new RoutingNode(node.id()); routingNodes.nodesToShards().put(node.id(), routingNode); @@ -221,10 +221,10 @@ public class DefaultShardsRoutingStrategy implements ShardsRoutingStrategy { } } - private boolean deassociateDeadNodes(RoutingNodes routingNodes, Iterable liveNodes) { + private boolean deassociateDeadNodes(RoutingNodes routingNodes, Iterable liveNodes) { boolean changed = false; Set liveNodeIds = newHashSet(); - for (Node liveNode : liveNodes) { + for (DiscoveryNode liveNode : liveNodes) { liveNodeIds.add(liveNode.id()); } Set nodeIdsToRemove = newHashSet(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java index f6c97ba5f76..5fb356c7a39 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java @@ -22,7 +22,7 @@ package org.elasticsearch.cluster.service; import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.*; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; @@ -172,7 +172,7 @@ public class InternalClusterService extends AbstractLifecycleComponent 0) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java index cb92631e774..a4edcb21c4a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java @@ -23,8 +23,8 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.cluster.*; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.DiscoveryException; import org.elasticsearch.discovery.InitialStateDiscoveryListener; @@ -70,7 +70,7 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent impl private volatile boolean addressSet = false; - private Node localNode; + private DiscoveryNode localNode; private volatile boolean firstMaster = false; @@ -142,13 +142,13 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent impl channel.connect(clusterName.value()); channel.setReceiver(this); logger.debug("Connected to cluster [{}], address [{}]", channel.getClusterName(), channel.getAddress()); - this.localNode = new Node(settings.get("name"), settings.getAsBoolean("node.data", true), channel.getAddress().toString(), transportService.boundAddress().publishAddress()); + this.localNode = new DiscoveryNode(settings.get("name"), settings.getAsBoolean("node.data", true), channel.getAddress().toString(), transportService.boundAddress().publishAddress()); if (isMaster()) { firstMaster = true; clusterService.submitStateUpdateTask("jgroups-disco-initialconnect(master)", new ProcessedClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes.Builder builder = new Nodes.Builder() + DiscoveryNodes.Builder builder = new DiscoveryNodes.Builder() .localNodeId(localNode.id()) .masterNodeId(localNode.id()) // put our local node @@ -164,7 +164,7 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent impl } else { clusterService.submitStateUpdateTask("jgroups-disco-initialconnect", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes.Builder builder = new Nodes.Builder() + DiscoveryNodes.Builder builder = new DiscoveryNodes.Builder() .localNodeId(localNode.id()) .put(localNode); return newClusterStateBuilder().state(currentState).nodes(builder).build(); @@ -248,7 +248,7 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent impl if (isMaster()) { try { BytesStreamInput is = new BytesStreamInput(msg.getBuffer()); - final Node newNode = Node.readNode(is); + final DiscoveryNode newNode = DiscoveryNode.readNode(is); is.close(); if (logger.isDebugEnabled()) { @@ -310,8 +310,8 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent impl clusterService.submitStateUpdateTask("jgroups-disco-view", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes newNodes = currentState.nodes().removeDeadMembers(newMembers, newView.getCreator().toString()); - Nodes.Delta delta = newNodes.delta(currentState.nodes()); + DiscoveryNodes newNodes = currentState.nodes().removeDeadMembers(newMembers, newView.getCreator().toString()); + DiscoveryNodes.Delta delta = newNodes.delta(currentState.nodes()); if (delta.added()) { logger.warn("No new nodes should be created when a new discovery view is accepted"); } @@ -328,7 +328,7 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent impl // check whether I have been removed due to temporary disconnect final String me = channel.getAddress().toString(); boolean foundMe = false; - for (Node node : clusterService.state().nodes()) { + for (DiscoveryNode node : clusterService.state().nodes()) { if (node.id().equals(me)) { foundMe = true; break; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java index 045c78aabd6..a04105975a0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java @@ -23,8 +23,8 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.cluster.*; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.InitialStateDiscoveryListener; import org.elasticsearch.transport.TransportService; @@ -54,7 +54,7 @@ public class LocalDiscovery extends AbstractLifecycleComponent implem private final ClusterName clusterName; - private Node localNode; + private DiscoveryNode localNode; private volatile boolean master = false; @@ -84,7 +84,7 @@ public class LocalDiscovery extends AbstractLifecycleComponent implem clusterGroups.put(clusterName, clusterGroup); } logger.debug("Connected to cluster [{}]", clusterName); - this.localNode = new Node(settings.get("name"), settings.getAsBoolean("node.data", true), Long.toString(nodeIdGenerator.incrementAndGet()), transportService.boundAddress().publishAddress()); + this.localNode = new DiscoveryNode(settings.get("name"), settings.getAsBoolean("node.data", true), Long.toString(nodeIdGenerator.incrementAndGet()), transportService.boundAddress().publishAddress()); clusterGroup.members().add(this); if (clusterGroup.members().size() == 1) { @@ -93,7 +93,7 @@ public class LocalDiscovery extends AbstractLifecycleComponent implem firstMaster = true; clusterService.submitStateUpdateTask("local-disco-initialconnect(master)", new ProcessedClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes.Builder builder = new Nodes.Builder() + DiscoveryNodes.Builder builder = new DiscoveryNodes.Builder() .localNodeId(localNode.id()) .masterNodeId(localNode.id()) // put our local node @@ -153,8 +153,8 @@ public class LocalDiscovery extends AbstractLifecycleComponent implem masterDiscovery.clusterService.submitStateUpdateTask("local-disco-update", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes newNodes = currentState.nodes().removeDeadMembers(newMembers, masterDiscovery.localNode.id()); - Nodes.Delta delta = newNodes.delta(currentState.nodes()); + DiscoveryNodes newNodes = currentState.nodes().removeDeadMembers(newMembers, masterDiscovery.localNode.id()); + DiscoveryNodes.Delta delta = newNodes.delta(currentState.nodes()); if (delta.added()) { logger.warn("No new nodes should be created when a new discovery view is accepted"); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java index 04d8009a8c1..825b738321e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java @@ -25,7 +25,7 @@ import org.apache.lucene.store.IndexOutput; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchInterruptedException; import org.elasticsearch.ExceptionsHelper; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.index.deletionpolicy.SnapshotIndexCommit; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.engine.RecoveryEngineException; @@ -135,7 +135,7 @@ public class RecoveryAction extends AbstractIndexShardComponent implements Close } } - public synchronized void startRecovery(Node node, Node targetNode, boolean markAsRelocated) throws ElasticSearchException { + public synchronized void startRecovery(DiscoveryNode node, DiscoveryNode targetNode, boolean markAsRelocated) throws ElasticSearchException { sendStartRecoveryThread = Thread.currentThread(); try { // mark the shard as recovering @@ -224,20 +224,20 @@ public class RecoveryAction extends AbstractIndexShardComponent implements Close private static class StartRecoveryRequest implements Streamable { - private Node node; + private DiscoveryNode node; private boolean markAsRelocated; private StartRecoveryRequest() { } - private StartRecoveryRequest(Node node, boolean markAsRelocated) { + private StartRecoveryRequest(DiscoveryNode node, boolean markAsRelocated) { this.node = node; this.markAsRelocated = markAsRelocated; } @Override public void readFrom(StreamInput in) throws IOException { - node = Node.readNode(in); + node = DiscoveryNode.readNode(in); markAsRelocated = in.readBoolean(); } @@ -255,7 +255,7 @@ public class RecoveryAction extends AbstractIndexShardComponent implements Close @Override public void messageReceived(final StartRecoveryRequest startRecoveryRequest, final TransportChannel channel) throws Exception { logger.trace("Starting recovery to {}, markAsRelocated {}", startRecoveryRequest.node, startRecoveryRequest.markAsRelocated); - final Node node = startRecoveryRequest.node; + final DiscoveryNode node = startRecoveryRequest.node; cleanOpenIndex(); final RecoveryStatus recoveryStatus = new RecoveryStatus(); indexShard.recover(new Engine.RecoveryHandler() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryFailedException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryFailedException.java index 71c38e34c47..3ce9bea28f1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryFailedException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryFailedException.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.shard.recovery; import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.index.shard.ShardId; /** @@ -28,7 +28,7 @@ import org.elasticsearch.index.shard.ShardId; */ public class RecoveryFailedException extends ElasticSearchException { - public RecoveryFailedException(ShardId shardId, Node node, Node targetNode, Throwable cause) { + public RecoveryFailedException(ShardId shardId, DiscoveryNode node, DiscoveryNode targetNode, Throwable cause) { super(shardId + ": Recovery failed from " + targetNode + " into " + node, cause); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java index 537bcc814c5..60aeec46d69 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java @@ -30,8 +30,8 @@ import org.elasticsearch.cluster.action.index.NodeIndexDeletedAction; import org.elasticsearch.cluster.action.index.NodeMappingCreatedAction; import org.elasticsearch.cluster.action.shard.ShardStateAction; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.RoutingTable; @@ -228,7 +228,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent listener) { + public void sendExecuteDfs(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { DfsSearchResult result = searchService.executeDfsPhase(request); @@ -103,7 +103,7 @@ public class SearchServiceTransportAction { } } - public void sendExecuteQuery(Node node, final InternalSearchRequest request, final SearchServiceListener listener) { + public void sendExecuteQuery(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QuerySearchResult result = searchService.executeQueryPhase(request); @@ -133,7 +133,7 @@ public class SearchServiceTransportAction { } } - public void sendExecuteQuery(Node node, final QuerySearchRequest request, final SearchServiceListener listener) { + public void sendExecuteQuery(DiscoveryNode node, final QuerySearchRequest request, final SearchServiceListener listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QuerySearchResult result = searchService.executeQueryPhase(request); @@ -163,7 +163,7 @@ public class SearchServiceTransportAction { } } - public void sendExecuteQuery(Node node, final InternalScrollSearchRequest request, final SearchServiceListener listener) { + public void sendExecuteQuery(DiscoveryNode node, final InternalScrollSearchRequest request, final SearchServiceListener listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QuerySearchResult result = searchService.executeQueryPhase(request); @@ -193,7 +193,7 @@ public class SearchServiceTransportAction { } } - public void sendExecuteFetch(Node node, final InternalSearchRequest request, final SearchServiceListener listener) { + public void sendExecuteFetch(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QueryFetchSearchResult result = searchService.executeFetchPhase(request); @@ -223,7 +223,7 @@ public class SearchServiceTransportAction { } } - public void sendExecuteFetch(Node node, final QuerySearchRequest request, final SearchServiceListener listener) { + public void sendExecuteFetch(DiscoveryNode node, final QuerySearchRequest request, final SearchServiceListener listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QueryFetchSearchResult result = searchService.executeFetchPhase(request); @@ -253,7 +253,7 @@ public class SearchServiceTransportAction { } } - public void sendExecuteFetch(Node node, final InternalScrollSearchRequest request, final SearchServiceListener listener) { + public void sendExecuteFetch(DiscoveryNode node, final InternalScrollSearchRequest request, final SearchServiceListener listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QueryFetchSearchResult result = searchService.executeFetchPhase(request); @@ -283,7 +283,7 @@ public class SearchServiceTransportAction { } } - public void sendExecuteFetch(Node node, final FetchSearchRequest request, final SearchServiceListener listener) { + public void sendExecuteFetch(DiscoveryNode node, final FetchSearchRequest request, final SearchServiceListener listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { FetchSearchResult result = searchService.executeFetchPhase(request); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ConnectTransportException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ConnectTransportException.java index 05a661db429..6b0abb69ec6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ConnectTransportException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ConnectTransportException.java @@ -19,25 +19,25 @@ package org.elasticsearch.transport; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; /** * @author kimchy (Shay Banon) */ public class ConnectTransportException extends TransportException { - private final Node node; + private final DiscoveryNode node; - public ConnectTransportException(Node node, String msg) { + public ConnectTransportException(DiscoveryNode node, String msg) { this(node, msg, null); } - public ConnectTransportException(Node node, String msg, Throwable cause) { + public ConnectTransportException(DiscoveryNode node, String msg, Throwable cause) { super(node + ": " + msg, cause); this.node = node; } - public Node node() { + public DiscoveryNode node() { return node; } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/SendRequestTransportException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/SendRequestTransportException.java index 5d2c219ca17..4159ea4dd26 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/SendRequestTransportException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/SendRequestTransportException.java @@ -19,14 +19,14 @@ package org.elasticsearch.transport; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; /** * @author kimchy (shay.banon) */ public class SendRequestTransportException extends RemoteTransportException { - public SendRequestTransportException(Node node, String action, Throwable cause) { + public SendRequestTransportException(DiscoveryNode node, String action, Throwable cause) { super(node.name(), node.address(), action, cause); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java index 272a7ec695d..bf1a4e65615 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java @@ -19,7 +19,7 @@ package org.elasticsearch.transport; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.component.LifecycleComponent; import org.elasticsearch.util.io.stream.Streamable; import org.elasticsearch.util.transport.BoundTransportAddress; @@ -70,10 +70,10 @@ public interface Transport extends LifecycleComponent { */ boolean addressSupported(Class address); - void nodesAdded(Iterable nodes); + void nodesAdded(Iterable nodes); - void nodesRemoved(Iterable nodes); + void nodesRemoved(Iterable nodes); - void sendRequest(Node node, long requestId, String action, + void sendRequest(DiscoveryNode node, long requestId, String action, Streamable message, TransportResponseHandler handler) throws IOException, TransportException; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java index 88ec72ae654..8fce3ea7278 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java @@ -21,7 +21,7 @@ package org.elasticsearch.transport; import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.util.component.AbstractLifecycleComponent; import org.elasticsearch.util.concurrent.highscalelib.NonBlockingHashMapLong; @@ -96,7 +96,7 @@ public class TransportService extends AbstractLifecycleComponent nodes) { + public void nodesAdded(Iterable nodes) { try { transport.nodesAdded(nodes); } catch (Exception e) { @@ -104,7 +104,7 @@ public class TransportService extends AbstractLifecycleComponent nodes) { + public void nodesRemoved(Iterable nodes) { try { transport.nodesRemoved(nodes); } catch (Exception e) { @@ -123,14 +123,14 @@ public class TransportService extends AbstractLifecycleComponent TransportFuture submitRequest(Node node, String action, Streamable message, + public TransportFuture submitRequest(DiscoveryNode node, String action, Streamable message, TransportResponseHandler handler) throws TransportException { PlainTransportFuture futureHandler = new PlainTransportFuture(handler); sendRequest(node, action, message, futureHandler); return futureHandler; } - public void sendRequest(final Node node, final String action, final Streamable message, + public void sendRequest(final DiscoveryNode node, final String action, final Streamable message, final TransportResponseHandler handler) throws TransportException { final long requestId = newRequestId(); try { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java index 7f3ed394373..31a9e41c1d2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java @@ -21,7 +21,7 @@ package org.elasticsearch.transport.local; import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.Nullable; @@ -92,13 +92,13 @@ public class LocalTransport extends AbstractLifecycleComponent implem return boundAddress; } - @Override public void nodesAdded(Iterable nodes) { + @Override public void nodesAdded(Iterable nodes) { } - @Override public void nodesRemoved(Iterable nodes) { + @Override public void nodesRemoved(Iterable nodes) { } - @Override public void sendRequest(final Node node, final long requestId, final String action, + @Override public void sendRequest(final DiscoveryNode node, final long requestId, final String action, final Streamable message, final TransportResponseHandler handler) throws IOException, TransportException { HandlesStreamOutput stream = BytesStreamOutput.Cached.cachedHandles(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java index 03820ff645e..f11bcfbe9d8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java @@ -23,7 +23,7 @@ import com.google.common.collect.Lists; import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalStateException; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.SizeValue; @@ -355,7 +355,7 @@ public class NettyTransport extends AbstractLifecycleComponent implem private static final byte[] LENGTH_PLACEHOLDER = new byte[4]; - @Override public void sendRequest(Node node, long requestId, String action, + @Override public void sendRequest(DiscoveryNode node, long requestId, String action, Streamable streamable, final TransportResponseHandler handler) throws IOException, TransportException { Channel targetChannel = nodeChannel(node); @@ -391,11 +391,11 @@ public class NettyTransport extends AbstractLifecycleComponent implem // }); } - @Override public void nodesAdded(Iterable nodes) { + @Override public void nodesAdded(Iterable nodes) { if (!lifecycle.started()) { throw new ElasticSearchIllegalStateException("Can't add nodes to a stopped transport"); } - for (Node node : nodes) { + for (DiscoveryNode node : nodes) { try { nodeChannel(node); } catch (Exception e) { @@ -404,8 +404,8 @@ public class NettyTransport extends AbstractLifecycleComponent implem } } - @Override public void nodesRemoved(Iterable nodes) { - for (Node node : nodes) { + @Override public void nodesRemoved(Iterable nodes) { + for (DiscoveryNode node : nodes) { NodeConnections nodeConnections = clientChannels.remove(node.id()); if (nodeConnections != null) { nodeConnections.close(); @@ -413,7 +413,7 @@ public class NettyTransport extends AbstractLifecycleComponent implem } } - private Channel nodeChannel(Node node) throws ConnectTransportException { + private Channel nodeChannel(DiscoveryNode node) throws ConnectTransportException { if (node == null) { throw new ConnectTransportException(node, "Can't connect to a null node"); } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardNoBackupsRoutingStrategyTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardNoBackupsRoutingStrategyTests.java index 62db40f7cf4..bae7350ea7b 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardNoBackupsRoutingStrategyTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardNoBackupsRoutingStrategyTests.java @@ -21,8 +21,8 @@ package org.elasticsearch.cluster.routing.strategy; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.MutableShardRouting; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.RoutingNodes; @@ -40,7 +40,7 @@ import static com.google.common.collect.Sets.*; import static org.elasticsearch.cluster.ClusterState.*; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; import static org.elasticsearch.cluster.metadata.MetaData.*; -import static org.elasticsearch.cluster.node.Nodes.*; +import static org.elasticsearch.cluster.node.DiscoveryNodes.*; import static org.elasticsearch.cluster.routing.RoutingBuilders.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.hamcrest.MatcherAssert.*; @@ -231,8 +231,8 @@ public class SingleShardNoBackupsRoutingStrategyTests { } logger.info("Adding " + (numberOfIndices / 2) + " nodes"); - Nodes.Builder nodesBuilder = newNodesBuilder(); - List nodes = newArrayList(); + DiscoveryNodes.Builder nodesBuilder = newNodesBuilder(); + List nodes = newArrayList(); for (int i = 0; i < (numberOfIndices / 2); i++) { nodesBuilder.put(newNode("node" + i)); } @@ -436,7 +436,7 @@ public class SingleShardNoBackupsRoutingStrategyTests { } } - private Node newNode(String nodeId) { - return new Node(nodeId, DummyTransportAddress.INSTANCE); + private DiscoveryNode newNode(String nodeId) { + return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE); } } \ No newline at end of file diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardOneBackupRoutingStrategyTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardOneBackupRoutingStrategyTests.java index 24bc9e03399..5a804f9355a 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardOneBackupRoutingStrategyTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardOneBackupRoutingStrategyTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.cluster.routing.strategy; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.util.logging.Loggers; @@ -32,7 +32,7 @@ import org.testng.annotations.Test; import static org.elasticsearch.cluster.ClusterState.*; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; import static org.elasticsearch.cluster.metadata.MetaData.*; -import static org.elasticsearch.cluster.node.Nodes.*; +import static org.elasticsearch.cluster.node.DiscoveryNodes.*; import static org.elasticsearch.cluster.routing.RoutingBuilders.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.hamcrest.MatcherAssert.*; @@ -178,7 +178,7 @@ public class SingleShardOneBackupRoutingStrategyTests { assertThat(routingTable.index("test").shard(0).backupsShards().get(0).currentNodeId(), equalTo("node3")); } - private Node newNode(String nodeId) { - return new Node(nodeId, DummyTransportAddress.INSTANCE); + private DiscoveryNode newNode(String nodeId) { + return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE); } } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/TenShardsOneBackupRoutingTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/TenShardsOneBackupRoutingTests.java index b7abd607b93..0f374ec7221 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/TenShardsOneBackupRoutingTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/TenShardsOneBackupRoutingTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.cluster.routing.strategy; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.util.logging.Loggers; @@ -32,7 +32,7 @@ import org.testng.annotations.Test; import static org.elasticsearch.cluster.ClusterState.*; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; import static org.elasticsearch.cluster.metadata.MetaData.*; -import static org.elasticsearch.cluster.node.Nodes.*; +import static org.elasticsearch.cluster.node.DiscoveryNodes.*; import static org.elasticsearch.cluster.routing.RoutingBuilders.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.hamcrest.MatcherAssert.*; @@ -182,7 +182,7 @@ public class TenShardsOneBackupRoutingTests { assertThat(routingNodes.node("node3").numberOfShardsWithState(STARTED), equalTo(6)); } - private Node newNode(String nodeId) { - return new Node(nodeId, DummyTransportAddress.INSTANCE); + private DiscoveryNode newNode(String nodeId) { + return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE); } } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java index b360935cbaf..b245dcb0b90 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java @@ -21,8 +21,8 @@ package org.elasticsearch.cluster.serialization; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.strategy.DefaultShardsRoutingStrategy; import org.elasticsearch.util.io.stream.BytesStreamInput; @@ -52,7 +52,7 @@ public class ClusterSerializationTests { .add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .build(); - Nodes nodes = Nodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).localNodeId("node1").masterNodeId("node2").build(); + DiscoveryNodes nodes = DiscoveryNodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).localNodeId("node1").masterNodeId("node2").build(); ClusterState clusterState = newClusterStateBuilder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); @@ -74,7 +74,7 @@ public class ClusterSerializationTests { .add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .build(); - Nodes nodes = Nodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).build(); + DiscoveryNodes nodes = DiscoveryNodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).build(); ClusterState clusterState = newClusterStateBuilder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); @@ -89,7 +89,7 @@ public class ClusterSerializationTests { assertThat(target.prettyPrint(), equalTo(source.prettyPrint())); } - private Node newNode(String nodeId) { - return new Node(nodeId, DummyTransportAddress.INSTANCE); + private DiscoveryNode newNode(String nodeId) { + return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE); } } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java index 8d8bc34b32a..79e36daaf3e 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.transport.local; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.scaling.ScalingThreadPool; import org.elasticsearch.transport.*; @@ -41,17 +41,17 @@ public class SimpleLocalTransportTests { private TransportService serviceA; private TransportService serviceB; - private Node serviceANode; - private Node serviceBNode; + private DiscoveryNode serviceANode; + private DiscoveryNode serviceBNode; @BeforeClass public void setUp() { threadPool = new ScalingThreadPool(); serviceA = new TransportService(new LocalTransport(threadPool), threadPool).start(); - serviceANode = new Node("A", serviceA.boundAddress().publishAddress()); + serviceANode = new DiscoveryNode("A", serviceA.boundAddress().publishAddress()); serviceB = new TransportService(new LocalTransport(threadPool), threadPool).start(); - serviceBNode = new Node("B", serviceB.boundAddress().publishAddress()); + serviceBNode = new DiscoveryNode("B", serviceB.boundAddress().publishAddress()); } @AfterClass public void tearDown() { diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java index f238cc6c891..c004b914165 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.transport.netty; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.scaling.ScalingThreadPool; import org.elasticsearch.transport.*; @@ -41,17 +41,17 @@ public class SimpleNettyTransportTests { private TransportService serviceA; private TransportService serviceB; - private Node serviceANode; - private Node serviceBNode; + private DiscoveryNode serviceANode; + private DiscoveryNode serviceBNode; @BeforeClass public void setUp() { threadPool = new ScalingThreadPool(); serviceA = new TransportService(new NettyTransport(threadPool), threadPool).start(); - serviceANode = new Node("A", serviceA.boundAddress().publishAddress()); + serviceANode = new DiscoveryNode("A", serviceA.boundAddress().publishAddress()); serviceB = new TransportService(new NettyTransport(threadPool), threadPool).start(); - serviceBNode = new Node("B", serviceB.boundAddress().publishAddress()); + serviceBNode = new DiscoveryNode("B", serviceB.boundAddress().publishAddress()); } @AfterClass public void tearDown() { diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java index ab8ad69f298..b5fd824dbed 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java @@ -20,7 +20,7 @@ package org.elasticsearch.transport.netty.benchmark; import com.google.common.collect.Lists; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.cached.CachedThreadPool; import org.elasticsearch.transport.BaseTransportResponseHandler; @@ -60,7 +60,7 @@ public class BenchmarkNettyClient { final ThreadPool threadPool = new CachedThreadPool(); final TransportService transportService = new TransportService(new NettyTransport(settings, threadPool), threadPool).start(); - final Node node = new Node("server", new InetSocketTransportAddress("localhost", 9999)); + final DiscoveryNode node = new DiscoveryNode("server", new InetSocketTransportAddress("localhost", 9999)); transportService.nodesAdded(Lists.newArrayList(node));