|
@@ -189,6 +189,20 @@ abstract class DataNodeRequestSender {
|
|
|
if (changed.compareAndSet(true, false) == false) {
|
|
|
break;
|
|
|
}
|
|
|
+ var pendingRetries = new HashSet<ShardId>();
|
|
|
+ for (ShardId shardId : pendingShardIds) {
|
|
|
+ if (targetShards.getShard(shardId).remainingNodes.isEmpty()) {
|
|
|
+ var failure = shardFailures.get(shardId);
|
|
|
+ if (failure != null && failure.fatal == false && failure.failure instanceof NoShardAvailableActionException) {
|
|
|
+ pendingRetries.add(shardId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (pendingRetries.isEmpty() == false && remainingUnavailableShardResolutionAttempts.decrementAndGet() >= 0) {
|
|
|
+ for (var entry : resolveShards(pendingRetries).entrySet()) {
|
|
|
+ targetShards.getShard(entry.getKey()).remainingNodes.addAll(entry.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
for (ShardId shardId : pendingShardIds) {
|
|
|
if (targetShards.getShard(shardId).remainingNodes.isEmpty()) {
|
|
|
shardFailures.compute(
|
|
@@ -257,26 +271,11 @@ abstract class DataNodeRequestSender {
|
|
|
final ActionListener<DriverCompletionInfo> listener = computeListener.acquireCompute();
|
|
|
sendRequest(request.node, request.shardIds, request.aliasFilters, new NodeListener() {
|
|
|
|
|
|
- private final Set<ShardId> pendingRetries = new HashSet<>();
|
|
|
-
|
|
|
void onAfter(DriverCompletionInfo info) {
|
|
|
nodePermits.get(request.node).release();
|
|
|
if (concurrentRequests != null) {
|
|
|
concurrentRequests.release();
|
|
|
}
|
|
|
-
|
|
|
- if (pendingRetries.isEmpty() == false && remainingUnavailableShardResolutionAttempts.decrementAndGet() >= 0) {
|
|
|
- try {
|
|
|
- sendingLock.lock();
|
|
|
- var resolutions = resolveShards(pendingRetries);
|
|
|
- for (var entry : resolutions.entrySet()) {
|
|
|
- targetShards.shards.get(entry.getKey()).remainingNodes.addAll(entry.getValue());
|
|
|
- }
|
|
|
- } finally {
|
|
|
- sendingLock.unlock();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
trySendingRequestsForPendingShards(targetShards, computeListener);
|
|
|
listener.onResponse(info);
|
|
|
}
|
|
@@ -293,7 +292,6 @@ abstract class DataNodeRequestSender {
|
|
|
final ShardId shardId = entry.getKey();
|
|
|
trackShardLevelFailure(shardId, false, entry.getValue());
|
|
|
pendingShardIds.add(shardId);
|
|
|
- maybeScheduleRetry(shardId, false, entry.getValue());
|
|
|
}
|
|
|
onAfter(response.completionInfo());
|
|
|
}
|
|
@@ -303,7 +301,6 @@ abstract class DataNodeRequestSender {
|
|
|
for (ShardId shardId : request.shardIds) {
|
|
|
trackShardLevelFailure(shardId, receivedData, e);
|
|
|
pendingShardIds.add(shardId);
|
|
|
- maybeScheduleRetry(shardId, receivedData, e);
|
|
|
}
|
|
|
onAfter(DriverCompletionInfo.EMPTY);
|
|
|
}
|
|
@@ -317,14 +314,6 @@ abstract class DataNodeRequestSender {
|
|
|
onResponse(new DataNodeComputeResponse(DriverCompletionInfo.EMPTY, Map.of()));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private void maybeScheduleRetry(ShardId shardId, boolean receivedData, Exception e) {
|
|
|
- if (receivedData == false
|
|
|
- && targetShards.getShard(shardId).remainingNodes.isEmpty()
|
|
|
- && unwrapFailure(shardId, e) instanceof NoShardAvailableActionException) {
|
|
|
- pendingRetries.add(shardId);
|
|
|
- }
|
|
|
- }
|
|
|
});
|
|
|
}
|
|
|
|