Skip to content

Commit 7e5dafa

Browse files
authored
Set shard id on NoShardAvailableActionException (#126979)
1 parent 987e9f7 commit 7e5dafa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/DataNodeRequestSender.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,19 @@ interface NodeListener {
298298
void onSkip();
299299
}
300300

301-
private static Exception unwrapFailure(Exception e) {
301+
private static Exception unwrapFailure(ShardId shardId, Exception e) {
302302
e = e instanceof TransportException te ? FailureCollector.unwrapTransportException(te) : e;
303303
if (TransportActions.isShardNotAvailableException(e)) {
304-
return NoShardAvailableActionException.forOnShardFailureWrapper(e.getMessage());
304+
var ex = NoShardAvailableActionException.forOnShardFailureWrapper(e.getMessage());
305+
ex.setShard(shardId);
306+
return ex;
305307
} else {
306308
return e;
307309
}
308310
}
309311

310312
private void trackShardLevelFailure(ShardId shardId, boolean fatal, Exception originalEx) {
311-
final Exception e = unwrapFailure(originalEx);
313+
final Exception e = unwrapFailure(shardId, originalEx);
312314
final boolean isTaskCanceledException = ExceptionsHelper.unwrap(e, TaskCancelledException.class) != null;
313315
final boolean isCircuitBreakerException = ExceptionsHelper.unwrap(e, CircuitBreakingException.class) != null;
314316
shardFailures.compute(shardId, (k, current) -> {

0 commit comments

Comments
 (0)