mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 14:26:27 +00:00
handle cases where the node does not exists in the disco nodes
This commit is contained in:
parent
7c931f34fa
commit
622d4041b8
@ -183,15 +183,19 @@ public abstract class TransportSearchTypeAction extends BaseAction<SearchRequest
|
|||||||
onFirstPhaseResult(shard, shardIt, null);
|
onFirstPhaseResult(shard, shardIt, null);
|
||||||
} else {
|
} else {
|
||||||
DiscoveryNode node = nodes.get(shard.currentNodeId());
|
DiscoveryNode node = nodes.get(shard.currentNodeId());
|
||||||
sendExecuteFirstPhase(node, internalSearchRequest(shard, request), new SearchServiceListener<FirstResult>() {
|
if (node == null) {
|
||||||
@Override public void onResult(FirstResult result) {
|
onFirstPhaseResult(shard, shardIt, null);
|
||||||
onFirstPhaseResult(shard, result, shardIt);
|
} else {
|
||||||
}
|
sendExecuteFirstPhase(node, internalSearchRequest(shard, request), new SearchServiceListener<FirstResult>() {
|
||||||
|
@Override public void onResult(FirstResult result) {
|
||||||
|
onFirstPhaseResult(shard, result, shardIt);
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void onFailure(Throwable t) {
|
@Override public void onFailure(Throwable t) {
|
||||||
onFirstPhaseResult(shard, shardIt, t);
|
onFirstPhaseResult(shard, shardIt, t);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,24 +221,29 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DiscoveryNode node = nodes.get(shard.currentNodeId());
|
DiscoveryNode node = nodes.get(shard.currentNodeId());
|
||||||
transportService.sendRequest(node, transportShardAction(), shardRequest, new BaseTransportResponseHandler<ShardResponse>() {
|
if (node == null) {
|
||||||
@Override public ShardResponse newInstance() {
|
// no node connected, act as failure
|
||||||
return newShardResponse();
|
onOperation(shard, shardIt, null, false);
|
||||||
}
|
} else {
|
||||||
|
transportService.sendRequest(node, transportShardAction(), shardRequest, new BaseTransportResponseHandler<ShardResponse>() {
|
||||||
|
@Override public ShardResponse newInstance() {
|
||||||
|
return newShardResponse();
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void handleResponse(ShardResponse response) {
|
@Override public void handleResponse(ShardResponse response) {
|
||||||
onOperation(shard, response, false);
|
onOperation(shard, response, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void handleException(RemoteTransportException e) {
|
@Override public void handleException(RemoteTransportException e) {
|
||||||
onOperation(shard, shardIt, e, false);
|
onOperation(shard, shardIt, e, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean spawn() {
|
@Override public boolean spawn() {
|
||||||
// we never spawn here, we will span if needed in onOperation
|
// we never spawn here, we will span if needed in onOperation
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
|
|||||||
boolean foundPrimary = false;
|
boolean foundPrimary = false;
|
||||||
for (final ShardRouting shard : shards) {
|
for (final ShardRouting shard : shards) {
|
||||||
if (shard.primary()) {
|
if (shard.primary()) {
|
||||||
if (!shard.active()) {
|
if (!shard.active() || !nodes.nodeExists(shard.currentNodeId())) {
|
||||||
retryPrimary(fromClusterEvent, shard);
|
retryPrimary(fromClusterEvent, shard);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -403,7 +403,10 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
|
|||||||
// we index on a backup that is initializing as well since we might not have got the event
|
// we index on a backup that is initializing as well since we might not have got the event
|
||||||
// yet that it was started. We will get an exception IllegalShardState exception if its not started
|
// yet that it was started. We will get an exception IllegalShardState exception if its not started
|
||||||
// and that's fine, we will ignore it
|
// and that's fine, we will ignore it
|
||||||
if (shard.unassigned()) {
|
|
||||||
|
// if we don't have that node, it means that it might have failed and will be created again, in
|
||||||
|
// this case, we don't have to do the operation, and just let it failover
|
||||||
|
if (shard.unassigned() || !nodes.nodeExists(shard.currentNodeId())) {
|
||||||
if (counter.decrementAndGet() == 0) {
|
if (counter.decrementAndGet() == 0) {
|
||||||
if (alreadyThreaded || !request.listenerThreaded()) {
|
if (alreadyThreaded || !request.listenerThreaded()) {
|
||||||
listener.onResponse(response);
|
listener.onResponse(response);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user