Skip to content

Commit 403c069

Browse files
Do not look over TaskCancelledException when looking at failures
1 parent 7070f3f commit 403c069

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ tests:
158158
- class: org.elasticsearch.xpack.ccr.FollowIndexSecurityIT
159159
method: testCleanShardFollowTaskAfterDeleteFollower
160160
issue: https://github.com/elastic/elasticsearch/issues/120339
161-
- class: org.elasticsearch.search.ccs.CrossClusterIT
162-
method: testCancel
163-
issue: https://github.com/elastic/elasticsearch/issues/108061
164161
- class: org.elasticsearch.reservedstate.service.FileSettingsServiceTests
165162
method: testInvalidJSON
166163
issue: https://github.com/elastic/elasticsearch/issues/120482

server/src/main/java/org/elasticsearch/action/search/AbstractSearchAsyncAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ void onShardFailure(final int shardIndex, SearchShardTarget shardTarget, Excepti
483483
}
484484
}
485485

486-
private static boolean isTaskCancelledException(Exception e) {
486+
static boolean isTaskCancelledException(Exception e) {
487487
return ExceptionsHelper.unwrapCausesAndSuppressed(e, ex -> ex instanceof TaskCancelledException).isPresent();
488488
}
489489

server/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
import java.util.function.LongSupplier;
118118
import java.util.stream.Collectors;
119119

120+
import static org.elasticsearch.action.search.AbstractSearchAsyncAction.isTaskCancelledException;
120121
import static org.elasticsearch.action.search.SearchType.DFS_QUERY_THEN_FETCH;
121122
import static org.elasticsearch.action.search.SearchType.QUERY_THEN_FETCH;
122123
import static org.elasticsearch.action.search.TransportSearchHelper.checkCCSVersionCompatibility;
@@ -1717,15 +1718,15 @@ public final void onFailure(Exception e) {
17171718
logCCSError(f, clusterAlias, skipUnavailable);
17181719
SearchResponse.Cluster cluster = clusters.getCluster(clusterAlias);
17191720
if (skipUnavailable) {
1720-
if (cluster != null) {
1721+
if (cluster != null && isTaskCancelledException(e) == false) {
17211722
ccsClusterInfoUpdate(f, clusters, clusterAlias, true);
17221723
}
17231724
} else {
17241725
if (cluster != null) {
17251726
ccsClusterInfoUpdate(f, clusters, clusterAlias, false);
17261727
}
17271728
Exception exception = e;
1728-
if (RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY.equals(clusterAlias) == false) {
1729+
if (RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY.equals(clusterAlias) == false && isTaskCancelledException(e) == false) {
17291730
exception = wrapRemoteClusterFailure(clusterAlias, e);
17301731
}
17311732
if (exceptions.compareAndSet(null, exception) == false) {

0 commit comments

Comments
 (0)