rename node to DiscoveryNode
This commit is contained in:
parent
6379e8cc27
commit
d4bc187be9
|
@ -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<String, String> attributes, Settings settings) {
|
||||
public NodeInfo(DiscoveryNode node, Map<String, String> attributes, Settings settings) {
|
||||
this(node, ImmutableMap.copyOf(attributes), settings);
|
||||
}
|
||||
|
||||
public NodeInfo(Node node, ImmutableMap<String, String> attributes, Settings settings) {
|
||||
public NodeInfo(DiscoveryNode node, ImmutableMap<String, String> attributes, Settings settings) {
|
||||
super(node);
|
||||
this.attributes = attributes;
|
||||
this.settings = settings;
|
||||
|
|
|
@ -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<NodesShutdownR
|
|||
NodeShutdownResponse() {
|
||||
}
|
||||
|
||||
public NodeShutdownResponse(Node node) {
|
||||
public NodeShutdownResponse(DiscoveryNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -74,7 +74,7 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc
|
|||
return "dfs";
|
||||
}
|
||||
|
||||
@Override protected void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener<DfsSearchResult> listener) {
|
||||
@Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<DfsSearchResult> 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<QueryFetchSearchResult>() {
|
||||
@Override public void onResult(QueryFetchSearchResult result) {
|
||||
queryFetchResults.put(result.shardTarget(), result);
|
||||
|
|
|
@ -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<DfsSearchResult> listener) {
|
||||
@Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<DfsSearchResult> 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<QuerySearchResult>() {
|
||||
@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<SearchShardTarget, ExtTIntArrayList> 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<SearchShardTarget, ExtTIntArrayList> 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<SearchShardTarget, ExtTIntArrayList> 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<FetchSearchResult>() {
|
||||
@Override public void onResult(FetchSearchResult result) {
|
||||
fetchResults.put(result.shardTarget(), result);
|
||||
|
|
|
@ -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<QueryFetchSearchResult> listener) {
|
||||
@Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<QueryFetchSearchResult> listener) {
|
||||
searchService.sendExecuteFetch(node, request, listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<QuerySearchResult> listener) {
|
||||
@Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<QuerySearchResult> listener) {
|
||||
searchService.sendExecuteQuery(node, request, listener);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi
|
|||
|
||||
int localOperations = 0;
|
||||
for (Map.Entry<SearchShardTarget, ExtTIntArrayList> 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<SearchShardTarget, ExtTIntArrayList> 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<SearchShardTarget, ExtTIntArrayList> 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<FetchSearchResult>() {
|
||||
@Override public void onResult(FetchSearchResult result) {
|
||||
fetchResults.put(result.shardTarget(), result);
|
||||
|
|
|
@ -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<ShardSearchFailure> shardFailures = searchCache.obtainShardFailures();
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent
|
|||
|
||||
int localOperations = 0;
|
||||
for (Tuple<String, Long> 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<String, Long> 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<String, Long> 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<String, Long> 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<QueryFetchSearchResult>() {
|
||||
@Override public void onResult(QueryFetchSearchResult result) {
|
||||
queryFetchResults.put(result.shardTarget(), result);
|
||||
|
|
|
@ -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<ShardSearchFailure> shardFailures = searchCache.obtainShardFailures();
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent
|
|||
|
||||
int localOperations = 0;
|
||||
for (Tuple<String, Long> 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<String, Long> 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<String, Long> 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<QuerySearchResult>() {
|
||||
@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<FetchSearchResult>() {
|
||||
@Override public void onResult(FetchSearchResult result) {
|
||||
fetchResults.put(result.shardTarget(), result);
|
||||
|
|
|
@ -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<SearchRequest
|
|||
|
||||
protected final SearchRequest request;
|
||||
|
||||
protected final Nodes nodes;
|
||||
protected final DiscoveryNodes nodes;
|
||||
|
||||
protected final int expectedSuccessfulOps;
|
||||
|
||||
|
@ -172,7 +172,7 @@ public abstract class TransportSearchTypeAction extends BaseAction<SearchRequest
|
|||
// no more active shards... (we should not really get here, but just for safety)
|
||||
onFirstPhaseResult(shard, shardIt, null);
|
||||
} else {
|
||||
Node node = nodes.get(shard.currentNodeId());
|
||||
DiscoveryNode node = nodes.get(shard.currentNodeId());
|
||||
sendExecuteFirstPhase(node, internalSearchRequest(shard, request), new SearchServiceListener<FirstResult>() {
|
||||
@Override public void onResult(FirstResult result) {
|
||||
onFirstPhaseResult(shard, result, shardIt);
|
||||
|
@ -281,7 +281,7 @@ public abstract class TransportSearchTypeAction extends BaseAction<SearchRequest
|
|||
Map<SearchShardTarget, ExtTIntArrayList> docIdsToLoad) {
|
||||
for (Map.Entry<SearchShardTarget, QuerySearchResultProvider> 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<SearchRequest
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener<FirstResult> listener);
|
||||
protected abstract void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<FirstResult> listener);
|
||||
|
||||
protected abstract void processFirstPhaseResult(ShardRouting shard, FirstResult result);
|
||||
|
||||
|
|
|
@ -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<Request extends Broadcas
|
|||
|
||||
private final ClusterState clusterState;
|
||||
|
||||
private final Nodes nodes;
|
||||
private final DiscoveryNodes nodes;
|
||||
|
||||
private final GroupShardsIterator shardsIts;
|
||||
|
||||
|
@ -216,7 +216,7 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Node node = nodes.get(shard.currentNodeId());
|
||||
DiscoveryNode node = nodes.get(shard.currentNodeId());
|
||||
transportService.sendRequest(node, transportShardAction(), shardRequest, new BaseTransportResponseHandler<ShardResponse>() {
|
||||
@Override public ShardResponse newInstance() {
|
||||
return newShardResponse();
|
||||
|
|
|
@ -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<Request extends MasterN
|
|||
protected abstract Response masterOperation(Request request) throws ElasticSearchException;
|
||||
|
||||
@Override protected void doExecute(final Request request, final ActionListener<Response> listener) {
|
||||
Nodes nodes = clusterService.state().nodes();
|
||||
DiscoveryNodes nodes = clusterService.state().nodes();
|
||||
if (nodes.localNodeMaster()) {
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override public void run() {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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<Request extends NodesOperati
|
|||
if (nodesIds == null || nodesIds.length == 0 || (nodesIds.length == 1 && nodesIds[0].equals("_all"))) {
|
||||
int index = 0;
|
||||
nodesIds = new String[clusterState.nodes().size()];
|
||||
for (Node node : clusterState.nodes()) {
|
||||
for (DiscoveryNode node : clusterState.nodes()) {
|
||||
nodesIds[index++] = node.id();
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
|
|||
|
||||
private void start() {
|
||||
for (final String nodeId : nodesIds) {
|
||||
final Node node = clusterState.nodes().nodes().get(nodeId);
|
||||
final DiscoveryNode node = clusterState.nodes().nodes().get(nodeId);
|
||||
if (nodeId.equals("_local") || nodeId.equals(clusterState.nodes().localNodeId())) {
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override public void run() {
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.elasticsearch.cluster.ClusterService;
|
|||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.TimeoutClusterStateListener;
|
||||
import org.elasticsearch.cluster.action.shard.ShardStateAction;
|
||||
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.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.ShardsIterator;
|
||||
import org.elasticsearch.index.IndexShardMissingException;
|
||||
|
@ -201,7 +201,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
|
|||
|
||||
private final Request request;
|
||||
|
||||
private Nodes nodes;
|
||||
private DiscoveryNodes nodes;
|
||||
|
||||
private ShardsIterator shards;
|
||||
|
||||
|
@ -255,7 +255,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
|
|||
performOnPrimary(shard.id(), fromClusterEvent, false, shard);
|
||||
}
|
||||
} else {
|
||||
Node node = nodes.get(shard.currentNodeId());
|
||||
DiscoveryNode node = nodes.get(shard.currentNodeId());
|
||||
transportService.sendRequest(node, transportAction(), request, new BaseTransportResponseHandler<Response>() {
|
||||
|
||||
@Override public Response newInstance() {
|
||||
|
@ -399,7 +399,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
|
|||
private void performOnBackup(final Response response, final AtomicInteger counter, final ShardRouting shard, String nodeId) {
|
||||
final ShardOperationRequest shardRequest = new ShardOperationRequest(shards.shardId().id(), request);
|
||||
if (!nodeId.equals(nodes.localNodeId())) {
|
||||
Node node = nodes.get(nodeId);
|
||||
DiscoveryNode node = nodes.get(nodeId);
|
||||
transportService.sendRequest(node, transportBackupAction(), shardRequest, new VoidTransportResponseHandler() {
|
||||
@Override public void handleResponse(VoidStreamable vResponse) {
|
||||
finishIfPossible();
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.elasticsearch.action.NoShardAvailableActionException;
|
|||
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.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.ShardsIterator;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
|
@ -86,7 +86,7 @@ public abstract class TransportSingleOperationAction<Request extends SingleOpera
|
|||
|
||||
private final Request request;
|
||||
|
||||
private final Nodes nodes;
|
||||
private final DiscoveryNodes nodes;
|
||||
|
||||
private AsyncSingleAction(Request request, ActionListener<Response> listener) {
|
||||
this.request = request;
|
||||
|
@ -164,7 +164,7 @@ public abstract class TransportSingleOperationAction<Request extends SingleOpera
|
|||
final ShardRouting shard = shardsIt.nextActive();
|
||||
// no need to check for local nodes, we tried them already in performFirstGet
|
||||
if (!shard.currentNodeId().equals(nodes.localNodeId())) {
|
||||
Node node = nodes.get(shard.currentNodeId());
|
||||
DiscoveryNode node = nodes.get(shard.currentNodeId());
|
||||
transportService.sendRequest(node, transportShardAction(), new ShardSingleOperationRequest(request, shard.id()), new BaseTransportResponseHandler<Response>() {
|
||||
@Override public Response newInstance() {
|
||||
return newResponse();
|
||||
|
|
|
@ -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 {
|
|||
* <p>The nodes include all the nodes that are currently alive based on the transport
|
||||
* addresses provided.
|
||||
*/
|
||||
public ImmutableList<Node> connectedNodes() {
|
||||
public ImmutableList<DiscoveryNode> connectedNodes() {
|
||||
return nodesService.connectedNodes();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Node> nodes = ImmutableList.of();
|
||||
private volatile ImmutableList<DiscoveryNode> 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<Node> connectedNodes() {
|
||||
public ImmutableList<DiscoveryNode> connectedNodes() {
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
|
@ -128,13 +128,13 @@ public class TransportClientNodesService extends AbstractComponent implements Cl
|
|||
}
|
||||
|
||||
public <T> T execute(NodeCallback<T> callback) throws ElasticSearchException {
|
||||
ImmutableList<Node> nodes = this.nodes;
|
||||
ImmutableList<DiscoveryNode> 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<Node> newNodes = new HashSet<Node>(nodes);
|
||||
HashSet<DiscoveryNode> newNodes = new HashSet<DiscoveryNode>(nodes);
|
||||
newNodes.addAll(discoveredNodes.nodes().values());
|
||||
nodes = new ImmutableList.Builder<Node>().addAll(newNodes).build();
|
||||
nodes = new ImmutableList.Builder<DiscoveryNode>().addAll(newNodes).build();
|
||||
transportService.nodesRemoved(event.nodesDelta().removedNodes());
|
||||
}
|
||||
|
||||
|
@ -163,11 +163,11 @@ public class TransportClientNodesService extends AbstractComponent implements Cl
|
|||
ImmutableList<TransportAddress> transportAddresses = TransportClientNodesService.this.transportAddresses;
|
||||
final CountDownLatch latch = new CountDownLatch(transportAddresses.size());
|
||||
final CopyOnWriteArrayList<NodesInfoResponse> nodesInfoResponses = new CopyOnWriteArrayList<NodesInfoResponse>();
|
||||
final CopyOnWriteArrayList<Node> tempNodes = new CopyOnWriteArrayList<Node>();
|
||||
final CopyOnWriteArrayList<DiscoveryNode> tempNodes = new CopyOnWriteArrayList<DiscoveryNode>();
|
||||
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<Node> newNodes = new HashSet<Node>();
|
||||
HashSet<DiscoveryNode> newNodes = new HashSet<DiscoveryNode>();
|
||||
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<Node>().addAll(newNodes).build();
|
||||
nodes = new ImmutableList.Builder<DiscoveryNode>().addAll(newNodes).build();
|
||||
|
||||
transportService.nodesRemoved(tempNodes);
|
||||
}
|
||||
|
@ -226,6 +226,6 @@ public class TransportClientNodesService extends AbstractComponent implements Cl
|
|||
|
||||
public static interface NodeCallback<T> {
|
||||
|
||||
T doWithNode(Node node) throws ElasticSearchException;
|
||||
T doWithNode(DiscoveryNode node) throws ElasticSearchException;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Request extends ActionRequest, Response extends ActionResponse> {
|
||||
|
||||
ActionFuture<Response> execute(Node node, Request request) throws ElasticSearchException;
|
||||
ActionFuture<Response> execute(DiscoveryNode node, Request request) throws ElasticSearchException;
|
||||
|
||||
void execute(Node node, Request request, ActionListener<Response> listener);
|
||||
void execute(DiscoveryNode node, Request request, ActionListener<Response> listener);
|
||||
}
|
||||
|
|
|
@ -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<Request extends ActionRequest, R
|
|||
responseConstructor.setAccessible(true);
|
||||
}
|
||||
|
||||
@Override public ActionFuture<Response> execute(Node node, Request request) throws ElasticSearchException {
|
||||
@Override public ActionFuture<Response> execute(DiscoveryNode node, Request request) throws ElasticSearchException {
|
||||
PlainActionFuture<Response> future = newFuture();
|
||||
request.listenerThreaded(false);
|
||||
execute(node, request, future);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override public void execute(Node node, final Request request, final ActionListener<Response> listener) {
|
||||
@Override public void execute(DiscoveryNode node, final Request request, final ActionListener<Response> listener) {
|
||||
transportService.sendRequest(node, action(), request, new BaseTransportResponseHandler<Response>() {
|
||||
@Override public Response newInstance() {
|
||||
return BaseClientTransportAction.this.newInstance();
|
||||
|
|
|
@ -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<IndexResponse> index(final IndexRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndexResponse>>() {
|
||||
@Override public ActionFuture<IndexResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<IndexResponse> 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<IndexResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<DeleteResponse> delete(final DeleteRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteResponse>>() {
|
||||
@Override public ActionFuture<DeleteResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<DeleteResponse> 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<DeleteResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<DeleteByQueryResponse> deleteByQuery(final DeleteByQueryRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteByQueryResponse>>() {
|
||||
@Override public ActionFuture<DeleteByQueryResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<DeleteByQueryResponse> 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<DeleteByQueryResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<GetResponse> get(final GetRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<GetResponse>>() {
|
||||
@Override public ActionFuture<GetResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<GetResponse> 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<GetResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
|
||||
@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<CountResponse> count(final CountRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<CountResponse>>() {
|
||||
@Override public ActionFuture<CountResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<CountResponse> 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<CountResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<SearchResponse> search(final SearchRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
|
||||
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<SearchResponse> 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<SearchResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
|
||||
@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<SearchResponse> searchScroll(final SearchScrollRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
|
||||
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<SearchResponse> 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<SearchResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
|
||||
@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<TermsResponse> terms(final TermsRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<TermsResponse>>() {
|
||||
@Override public ActionFuture<TermsResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<TermsResponse> 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<TermsResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<Void>>() {
|
||||
@Override public ActionFuture<Void> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<Void> 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<SearchResponse> moreLikeThis(final MoreLikeThisRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() {
|
||||
@Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<SearchResponse> 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<SearchResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@Override public Void doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException {
|
||||
moreLikeThisAction.execute(node, request, listener);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -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<ClusterHealthResponse> health(final ClusterHealthRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClusterHealthResponse>>() {
|
||||
@Override public ActionFuture<ClusterHealthResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<ClusterHealthResponse> 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<ClusterHealthResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<ClusterStateResponse> state(final ClusterStateRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClusterStateResponse>>() {
|
||||
@Override public ActionFuture<ClusterStateResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<ClusterStateResponse> 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<ClusterStateResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<SinglePingResponse> ping(final SinglePingRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SinglePingResponse>>() {
|
||||
@Override public ActionFuture<SinglePingResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<SinglePingResponse> 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<SinglePingResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<BroadcastPingResponse> ping(final BroadcastPingRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<BroadcastPingResponse>>() {
|
||||
@Override public ActionFuture<BroadcastPingResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<BroadcastPingResponse> 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<BroadcastPingResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<ReplicationPingResponse> ping(final ReplicationPingRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ReplicationPingResponse>>() {
|
||||
@Override public ActionFuture<ReplicationPingResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<ReplicationPingResponse> 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<ReplicationPingResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<NodesInfoResponse> nodesInfo(final NodesInfoRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<NodesInfoResponse>>() {
|
||||
@Override public ActionFuture<NodesInfoResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<NodesInfoResponse> 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<NodesInfoResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<NodesShutdownResponse> nodesShutdown(final NodesShutdownRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<NodesShutdownResponse>>() {
|
||||
@Override public ActionFuture<NodesShutdownResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<NodesShutdownResponse> 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<NodesShutdownResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<Void>>() {
|
||||
@Override public ActionFuture<Void> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<Void> doWithNode(DiscoveryNode node) throws ElasticSearchException {
|
||||
nodesShutdownAction.execute(node, request, listener);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -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<IndicesStatusResponse> status(final IndicesStatusRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndicesStatusResponse>>() {
|
||||
@Override public ActionFuture<IndicesStatusResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<IndicesStatusResponse> 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<IndicesStatusResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<CreateIndexResponse> create(final CreateIndexRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<CreateIndexResponse>>() {
|
||||
@Override public ActionFuture<CreateIndexResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<CreateIndexResponse> 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<CreateIndexResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
|
||||
@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<DeleteIndexResponse> delete(final DeleteIndexRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteIndexResponse>>() {
|
||||
@Override public ActionFuture<DeleteIndexResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<DeleteIndexResponse> 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<DeleteIndexResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
|
||||
@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<RefreshResponse> refresh(final RefreshRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<RefreshResponse>>() {
|
||||
@Override public ActionFuture<RefreshResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<RefreshResponse> 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<RefreshResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<FlushResponse> flush(final FlushRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<FlushResponse>>() {
|
||||
@Override public ActionFuture<FlushResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<FlushResponse> 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<FlushResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
|
||||
@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<OptimizeResponse> optimize(final OptimizeRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<OptimizeResponse>>() {
|
||||
@Override public ActionFuture<OptimizeResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<OptimizeResponse> 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<OptimizeResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<Void>>() {
|
||||
@Override public ActionFuture<Void> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<Void> 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<PutMappingResponse> putMapping(final PutMappingRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<PutMappingResponse>>() {
|
||||
@Override public ActionFuture<PutMappingResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<PutMappingResponse> 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<PutMappingResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<GatewaySnapshotResponse> gatewaySnapshot(final GatewaySnapshotRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<GatewaySnapshotResponse>>() {
|
||||
@Override public ActionFuture<GatewaySnapshotResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<GatewaySnapshotResponse> 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<GatewaySnapshotResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() {
|
||||
@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<IndicesAliasesResponse> aliases(final IndicesAliasesRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndicesAliasesResponse>>() {
|
||||
@Override public ActionFuture<IndicesAliasesResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<IndicesAliasesResponse> 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<IndicesAliasesResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@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<ClearIndicesCacheResponse> clearCache(final ClearIndicesCacheRequest request) {
|
||||
return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClearIndicesCacheResponse>>() {
|
||||
@Override public ActionFuture<ClearIndicesCacheResponse> doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public ActionFuture<ClearIndicesCacheResponse> 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<ClearIndicesCacheResponse> listener) {
|
||||
nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() {
|
||||
@Override public Void doWithNode(Node node) throws ElasticSearchException {
|
||||
@Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException {
|
||||
clearIndicesCacheAction.execute(node, request, listener);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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<Node> EMPTY_LIST = ImmutableList.of();
|
||||
public static final ImmutableList<DiscoveryNode> 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);
|
||||
}
|
||||
|
|
@ -37,26 +37,26 @@ import static com.google.common.collect.Maps.*;
|
|||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
*/
|
||||
public class Nodes implements Iterable<Node> {
|
||||
public class DiscoveryNodes implements Iterable<DiscoveryNode> {
|
||||
|
||||
public static Nodes EMPTY_NODES = newNodesBuilder().build();
|
||||
public static DiscoveryNodes EMPTY_NODES = newNodesBuilder().build();
|
||||
|
||||
private final ImmutableMap<String, Node> nodes;
|
||||
private final ImmutableMap<String, DiscoveryNode> nodes;
|
||||
|
||||
private final ImmutableMap<String, Node> dataNodes;
|
||||
private final ImmutableMap<String, DiscoveryNode> dataNodes;
|
||||
|
||||
private final String masterNodeId;
|
||||
|
||||
private final String localNodeId;
|
||||
|
||||
private Nodes(ImmutableMap<String, Node> nodes, ImmutableMap<String, Node> dataNodes, String masterNodeId, String localNodeId) {
|
||||
private DiscoveryNodes(ImmutableMap<String, DiscoveryNode> nodes, ImmutableMap<String, DiscoveryNode> dataNodes, String masterNodeId, String localNodeId) {
|
||||
this.nodes = nodes;
|
||||
this.dataNodes = dataNodes;
|
||||
this.masterNodeId = masterNodeId;
|
||||
this.localNodeId = localNodeId;
|
||||
}
|
||||
|
||||
@Override public UnmodifiableIterator<Node> iterator() {
|
||||
@Override public UnmodifiableIterator<DiscoveryNode> iterator() {
|
||||
return nodes.values().iterator();
|
||||
}
|
||||
|
||||
|
@ -83,15 +83,15 @@ public class Nodes implements Iterable<Node> {
|
|||
return nodes.size();
|
||||
}
|
||||
|
||||
public ImmutableMap<String, Node> nodes() {
|
||||
public ImmutableMap<String, DiscoveryNode> nodes() {
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
public ImmutableMap<String, Node> dataNodes() {
|
||||
public ImmutableMap<String, DiscoveryNode> 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<Node> {
|
|||
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<String> newNodes, String masterNodeId) {
|
||||
public DiscoveryNodes removeDeadMembers(Set<String> 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<Node> {
|
|||
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<Node> removed = newArrayList();
|
||||
List<Node> added = newArrayList();
|
||||
for (Node node : other) {
|
||||
public Delta delta(DiscoveryNodes other) {
|
||||
List<DiscoveryNode> removed = newArrayList();
|
||||
List<DiscoveryNode> 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<Node> {
|
|||
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<Node> {
|
|||
}
|
||||
|
||||
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<Node> removed;
|
||||
private final ImmutableList<Node> added;
|
||||
private final DiscoveryNode previousMasterNode;
|
||||
private final DiscoveryNode newMasterNode;
|
||||
private final ImmutableList<DiscoveryNode> removed;
|
||||
private final ImmutableList<DiscoveryNode> added;
|
||||
|
||||
|
||||
public Delta(String localNodeId, ImmutableList<Node> removed, ImmutableList<Node> added) {
|
||||
public Delta(String localNodeId, ImmutableList<DiscoveryNode> removed, ImmutableList<DiscoveryNode> added) {
|
||||
this(null, null, localNodeId, removed, added);
|
||||
}
|
||||
|
||||
public Delta(@Nullable Node previousMasterNode, @Nullable Node newMasterNode, String localNodeId, ImmutableList<Node> removed, ImmutableList<Node> added) {
|
||||
public Delta(@Nullable DiscoveryNode previousMasterNode, @Nullable DiscoveryNode newMasterNode, String localNodeId, ImmutableList<DiscoveryNode> removed, ImmutableList<DiscoveryNode> added) {
|
||||
this.previousMasterNode = previousMasterNode;
|
||||
this.newMasterNode = newMasterNode;
|
||||
this.localNodeId = localNodeId;
|
||||
|
@ -205,11 +205,11 @@ public class Nodes implements Iterable<Node> {
|
|||
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<Node> {
|
|||
return !removed.isEmpty();
|
||||
}
|
||||
|
||||
public ImmutableList<Node> removedNodes() {
|
||||
public ImmutableList<DiscoveryNode> removedNodes() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ public class Nodes implements Iterable<Node> {
|
|||
return !added.isEmpty();
|
||||
}
|
||||
|
||||
public ImmutableList<Node> addedNodes() {
|
||||
public ImmutableList<DiscoveryNode> addedNodes() {
|
||||
return added;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ public class Nodes implements Iterable<Node> {
|
|||
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<Node> {
|
|||
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<Node> {
|
|||
|
||||
public static class Builder {
|
||||
|
||||
private Map<String, Node> nodes = newHashMap();
|
||||
private Map<String, DiscoveryNode> 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<Node> nodes) {
|
||||
for (Node node : nodes) {
|
||||
public Builder putAll(Iterable<DiscoveryNode> nodes) {
|
||||
for (DiscoveryNode node : nodes) {
|
||||
put(node);
|
||||
}
|
||||
return this;
|
||||
|
@ -326,25 +326,25 @@ public class Nodes implements Iterable<Node> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Nodes build() {
|
||||
ImmutableMap.Builder<String, Node> dataNodesBuilder = ImmutableMap.builder();
|
||||
for (Map.Entry<String, Node> nodeEntry : nodes.entrySet()) {
|
||||
public DiscoveryNodes build() {
|
||||
ImmutableMap.Builder<String, DiscoveryNode> dataNodesBuilder = ImmutableMap.builder();
|
||||
for (Map.Entry<String, DiscoveryNode> 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<Node> {
|
|||
}
|
||||
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;
|
|
@ -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<Node> dataNodes = clusterState.nodes().dataNodes().values();
|
||||
Iterable<DiscoveryNode> 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<Node> liveNodes) {
|
||||
for (Node node : liveNodes) {
|
||||
private void applyNewNodes(RoutingNodes routingNodes, Iterable<DiscoveryNode> 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<Node> liveNodes) {
|
||||
private boolean deassociateDeadNodes(RoutingNodes routingNodes, Iterable<DiscoveryNode> liveNodes) {
|
||||
boolean changed = false;
|
||||
Set<String> liveNodeIds = newHashSet();
|
||||
for (Node liveNode : liveNodes) {
|
||||
for (DiscoveryNode liveNode : liveNodes) {
|
||||
liveNodeIds.add(liveNode.id());
|
||||
}
|
||||
Set<String> nodeIdsToRemove = newHashSet();
|
||||
|
|
|
@ -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<ClusterSe
|
|||
|
||||
ClusterChangedEvent clusterChangedEvent = new ClusterChangedEvent(source, clusterState, previousClusterState, discoveryService.firstMaster());
|
||||
// new cluster state, notify all listeners
|
||||
final Nodes.Delta nodesDelta = clusterChangedEvent.nodesDelta();
|
||||
final DiscoveryNodes.Delta nodesDelta = clusterChangedEvent.nodesDelta();
|
||||
if (nodesDelta.hasChanges() && logger.isInfoEnabled()) {
|
||||
String summary = nodesDelta.shortSummary();
|
||||
if (summary.length() > 0) {
|
||||
|
|
|
@ -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<Discovery> 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<Discovery> 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<Discovery> 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<Discovery> 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<Discovery> 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<Discovery> 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;
|
||||
|
|
|
@ -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<Discovery> 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<Discovery> 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<Discovery> 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<Discovery> 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");
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Indic
|
|||
if (routingNodes == null) {
|
||||
return;
|
||||
}
|
||||
Nodes nodes = event.state().nodes();
|
||||
DiscoveryNodes nodes = event.state().nodes();
|
||||
|
||||
|
||||
for (final ShardRouting shardRouting : routingNodes) {
|
||||
|
@ -257,7 +257,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
|
|||
}
|
||||
}
|
||||
|
||||
private void applyInitializingShard(final RoutingTable routingTable, final Nodes nodes, final ShardRouting shardRouting) throws ElasticSearchException {
|
||||
private void applyInitializingShard(final RoutingTable routingTable, final DiscoveryNodes nodes, final ShardRouting shardRouting) throws ElasticSearchException {
|
||||
final IndexService indexService = indicesService.indexServiceSafe(shardRouting.index());
|
||||
final int shardId = shardRouting.id();
|
||||
|
||||
|
@ -322,7 +322,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
|
|||
for (ShardRouting entry : shardRoutingTable) {
|
||||
if (entry.primary() && entry.started()) {
|
||||
// only recover from started primary, if we can't find one, we will do it next round
|
||||
Node node = nodes.get(entry.currentNodeId());
|
||||
DiscoveryNode node = nodes.get(entry.currentNodeId());
|
||||
try {
|
||||
// we are recovering a backup from a primary, so no need to mark it as relocated
|
||||
recoveryAction.startRecovery(nodes.localNode(), node, false);
|
||||
|
@ -346,7 +346,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
|
|||
}
|
||||
} else {
|
||||
// relocating primaries, recovery from the relocating shard
|
||||
Node node = nodes.get(shardRouting.relocatingNodeId());
|
||||
DiscoveryNode node = nodes.get(shardRouting.relocatingNodeId());
|
||||
try {
|
||||
// we mark the primary we are going to recover from as relocated at the end of phase 3
|
||||
// so operations will start moving to the new primary
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.jmx;
|
|||
import org.elasticsearch.cluster.ClusterChangedEvent;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.ClusterStateListener;
|
||||
import org.elasticsearch.cluster.node.Node;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.jmx.action.GetJmxServiceUrlAction;
|
||||
import org.elasticsearch.util.component.AbstractComponent;
|
||||
import org.elasticsearch.util.settings.Settings;
|
||||
|
@ -60,7 +60,7 @@ public class JmxClusterService extends AbstractComponent {
|
|||
|
||||
if (jmxService.publishUrl() != null) {
|
||||
clusterService.add(new JmxClusterEventListener());
|
||||
for (final Node node : clusterService.state().nodes()) {
|
||||
for (final DiscoveryNode node : clusterService.state().nodes()) {
|
||||
clusterNodesJmxUpdater.execute(new Runnable() {
|
||||
@Override public void run() {
|
||||
String nodeServiceUrl = getJmxServiceUrlAction.obtainPublishUrl(node);
|
||||
|
@ -77,7 +77,7 @@ public class JmxClusterService extends AbstractComponent {
|
|||
}
|
||||
}
|
||||
|
||||
private void registerNode(Node node, String nodeServiceUrl) {
|
||||
private void registerNode(DiscoveryNode node, String nodeServiceUrl) {
|
||||
try {
|
||||
JMXServiceURL jmxServiceURL = new JMXServiceURL(nodeServiceUrl);
|
||||
JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceURL, null);
|
||||
|
@ -103,7 +103,7 @@ public class JmxClusterService extends AbstractComponent {
|
|||
if (!event.nodesChanged()) {
|
||||
return;
|
||||
}
|
||||
for (final Node node : event.nodesDelta().addedNodes()) {
|
||||
for (final DiscoveryNode node : event.nodesDelta().addedNodes()) {
|
||||
clusterNodesJmxUpdater.execute(new Runnable() {
|
||||
@Override public void run() {
|
||||
String nodeServiceUrl = getJmxServiceUrlAction.obtainPublishUrl(node);
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.jmx.action;
|
|||
import com.google.inject.Inject;
|
||||
import org.elasticsearch.ElasticSearchException;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.node.Node;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.jmx.JmxService;
|
||||
import org.elasticsearch.transport.BaseTransportRequestHandler;
|
||||
import org.elasticsearch.transport.FutureTransportResponseHandler;
|
||||
|
@ -54,7 +54,7 @@ public class GetJmxServiceUrlAction extends AbstractComponent {
|
|||
transportService.registerHandler(GetJmxServiceUrlTransportHandler.ACTION, new GetJmxServiceUrlTransportHandler());
|
||||
}
|
||||
|
||||
public String obtainPublishUrl(final Node node) throws ElasticSearchException {
|
||||
public String obtainPublishUrl(final DiscoveryNode node) throws ElasticSearchException {
|
||||
if (clusterService.state().nodes().localNodeId().equals(node.id())) {
|
||||
return jmxService.publishUrl();
|
||||
} else {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.monitor.dump;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.elasticsearch.cluster.node.Node;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.util.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -50,7 +50,7 @@ public class SimpleDumpGenerator implements DumpGenerator {
|
|||
long timestamp = System.currentTimeMillis();
|
||||
String fileName = "";
|
||||
if (context.containsKey("localNode")) {
|
||||
Node localNode = (Node) context.get("localNode");
|
||||
DiscoveryNode localNode = (DiscoveryNode) context.get("localNode");
|
||||
if (localNode.name() != null) {
|
||||
fileName += localNode.name() + "-";
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.google.inject.Inject;
|
|||
import com.google.inject.assistedinject.Assisted;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.node.Nodes;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.monitor.dump.Dump;
|
||||
import org.elasticsearch.monitor.dump.DumpContributionFailedException;
|
||||
|
@ -54,7 +54,7 @@ public class ClusterDumpContributor implements DumpContributor {
|
|||
|
||||
@Override public void contribute(Dump dump) throws DumpContributionFailedException {
|
||||
ClusterState clusterState = clusterService.state();
|
||||
Nodes nodes = clusterState.nodes();
|
||||
DiscoveryNodes nodes = clusterState.nodes();
|
||||
RoutingTable routingTable = clusterState.routingTable();
|
||||
|
||||
PrintWriter writer = new PrintWriter(dump.createFileWriter("cluster.txt"));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.search.action;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.node.Node;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.search.SearchService;
|
||||
import org.elasticsearch.search.dfs.DfsSearchResult;
|
||||
import org.elasticsearch.search.fetch.FetchSearchRequest;
|
||||
|
@ -65,7 +65,7 @@ public class SearchServiceTransportAction {
|
|||
transportService.registerHandler(SearchFetchByIdTransportHandler.ACTION, new SearchFetchByIdTransportHandler());
|
||||
}
|
||||
|
||||
public void sendFreeContext(Node node, final long contextId) {
|
||||
public void sendFreeContext(DiscoveryNode node, final long contextId) {
|
||||
if (clusterService.state().nodes().localNodeId().equals(node.id())) {
|
||||
searchService.freeContext(contextId);
|
||||
} else {
|
||||
|
@ -73,7 +73,7 @@ public class SearchServiceTransportAction {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendExecuteDfs(Node node, final InternalSearchRequest request, final SearchServiceListener<DfsSearchResult> listener) {
|
||||
public void sendExecuteDfs(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener<DfsSearchResult> 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<QuerySearchResult> listener) {
|
||||
public void sendExecuteQuery(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener<QuerySearchResult> 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<QuerySearchResult> listener) {
|
||||
public void sendExecuteQuery(DiscoveryNode node, final QuerySearchRequest request, final SearchServiceListener<QuerySearchResult> 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<QuerySearchResult> listener) {
|
||||
public void sendExecuteQuery(DiscoveryNode node, final InternalScrollSearchRequest request, final SearchServiceListener<QuerySearchResult> 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<QueryFetchSearchResult> listener) {
|
||||
public void sendExecuteFetch(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener<QueryFetchSearchResult> 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<QueryFetchSearchResult> listener) {
|
||||
public void sendExecuteFetch(DiscoveryNode node, final QuerySearchRequest request, final SearchServiceListener<QueryFetchSearchResult> 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<QueryFetchSearchResult> listener) {
|
||||
public void sendExecuteFetch(DiscoveryNode node, final InternalScrollSearchRequest request, final SearchServiceListener<QueryFetchSearchResult> 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<FetchSearchResult> listener) {
|
||||
public void sendExecuteFetch(DiscoveryNode node, final FetchSearchRequest request, final SearchServiceListener<FetchSearchResult> listener) {
|
||||
if (clusterService.state().nodes().localNodeId().equals(node.id())) {
|
||||
try {
|
||||
FetchSearchResult result = searchService.executeFetchPhase(request);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Transport> {
|
|||
*/
|
||||
boolean addressSupported(Class<? extends TransportAddress> address);
|
||||
|
||||
void nodesAdded(Iterable<Node> nodes);
|
||||
void nodesAdded(Iterable<DiscoveryNode> nodes);
|
||||
|
||||
void nodesRemoved(Iterable<Node> nodes);
|
||||
void nodesRemoved(Iterable<DiscoveryNode> nodes);
|
||||
|
||||
<T extends Streamable> void sendRequest(Node node, long requestId, String action,
|
||||
<T extends Streamable> void sendRequest(DiscoveryNode node, long requestId, String action,
|
||||
Streamable message, TransportResponseHandler<T> handler) throws IOException, TransportException;
|
||||
}
|
||||
|
|
|
@ -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<TransportServic
|
|||
return transport.boundAddress();
|
||||
}
|
||||
|
||||
public void nodesAdded(Iterable<Node> nodes) {
|
||||
public void nodesAdded(Iterable<DiscoveryNode> nodes) {
|
||||
try {
|
||||
transport.nodesAdded(nodes);
|
||||
} catch (Exception e) {
|
||||
|
@ -104,7 +104,7 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
|
|||
}
|
||||
}
|
||||
|
||||
public void nodesRemoved(Iterable<Node> nodes) {
|
||||
public void nodesRemoved(Iterable<DiscoveryNode> nodes) {
|
||||
try {
|
||||
transport.nodesRemoved(nodes);
|
||||
} catch (Exception e) {
|
||||
|
@ -123,14 +123,14 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
|
|||
this.throwConnectException = throwConnectException;
|
||||
}
|
||||
|
||||
public <T extends Streamable> TransportFuture<T> submitRequest(Node node, String action, Streamable message,
|
||||
public <T extends Streamable> TransportFuture<T> submitRequest(DiscoveryNode node, String action, Streamable message,
|
||||
TransportResponseHandler<T> handler) throws TransportException {
|
||||
PlainTransportFuture<T> futureHandler = new PlainTransportFuture<T>(handler);
|
||||
sendRequest(node, action, message, futureHandler);
|
||||
return futureHandler;
|
||||
}
|
||||
|
||||
public <T extends Streamable> void sendRequest(final Node node, final String action, final Streamable message,
|
||||
public <T extends Streamable> void sendRequest(final DiscoveryNode node, final String action, final Streamable message,
|
||||
final TransportResponseHandler<T> handler) throws TransportException {
|
||||
final long requestId = newRequestId();
|
||||
try {
|
||||
|
|
|
@ -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<Transport> implem
|
|||
return boundAddress;
|
||||
}
|
||||
|
||||
@Override public void nodesAdded(Iterable<Node> nodes) {
|
||||
@Override public void nodesAdded(Iterable<DiscoveryNode> nodes) {
|
||||
}
|
||||
|
||||
@Override public void nodesRemoved(Iterable<Node> nodes) {
|
||||
@Override public void nodesRemoved(Iterable<DiscoveryNode> nodes) {
|
||||
}
|
||||
|
||||
@Override public <T extends Streamable> void sendRequest(final Node node, final long requestId, final String action,
|
||||
@Override public <T extends Streamable> void sendRequest(final DiscoveryNode node, final long requestId, final String action,
|
||||
final Streamable message, final TransportResponseHandler<T> handler) throws IOException, TransportException {
|
||||
HandlesStreamOutput stream = BytesStreamOutput.Cached.cachedHandles();
|
||||
|
||||
|
|
|
@ -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<Transport> implem
|
|||
|
||||
private static final byte[] LENGTH_PLACEHOLDER = new byte[4];
|
||||
|
||||
@Override public <T extends Streamable> void sendRequest(Node node, long requestId, String action,
|
||||
@Override public <T extends Streamable> void sendRequest(DiscoveryNode node, long requestId, String action,
|
||||
Streamable streamable, final TransportResponseHandler<T> handler) throws IOException, TransportException {
|
||||
|
||||
Channel targetChannel = nodeChannel(node);
|
||||
|
@ -391,11 +391,11 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
// });
|
||||
}
|
||||
|
||||
@Override public void nodesAdded(Iterable<Node> nodes) {
|
||||
@Override public void nodesAdded(Iterable<DiscoveryNode> 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<Transport> implem
|
|||
}
|
||||
}
|
||||
|
||||
@Override public void nodesRemoved(Iterable<Node> nodes) {
|
||||
for (Node node : nodes) {
|
||||
@Override public void nodesRemoved(Iterable<DiscoveryNode> 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<Transport> 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");
|
||||
}
|
||||
|
|
|
@ -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<Node> nodes = newArrayList();
|
||||
DiscoveryNodes.Builder nodesBuilder = newNodesBuilder();
|
||||
List<DiscoveryNode> 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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in New Issue