Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ tests:
- class: org.elasticsearch.xpack.ccr.FollowIndexSecurityIT
method: testCleanShardFollowTaskAfterDeleteFollower
issue: https://github.com/elastic/elasticsearch/issues/120339
- class: org.elasticsearch.search.ccs.CrossClusterIT
method: testCancel
issue: https://github.com/elastic/elasticsearch/issues/108061
- class: org.elasticsearch.reservedstate.service.FileSettingsServiceTests
method: testInvalidJSON
issue: https://github.com/elastic/elasticsearch/issues/120482
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void onShardFailure(final int shardIndex, SearchShardTarget shardTarget, Excepti
}
}

private static boolean isTaskCancelledException(Exception e) {
static boolean isTaskCancelledException(Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say, let's move this method to ExceptionsHelper itself, since we need to call it in more than one place. It's a little awkward for TransportSearchAction to depend on methods in AbstractSearchAsyncAction.

return ExceptionsHelper.unwrapCausesAndSuppressed(e, ex -> ex instanceof TaskCancelledException).isPresent();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
import java.util.function.LongSupplier;
import java.util.stream.Collectors;

import static org.elasticsearch.action.search.AbstractSearchAsyncAction.isTaskCancelledException;
import static org.elasticsearch.action.search.SearchType.DFS_QUERY_THEN_FETCH;
import static org.elasticsearch.action.search.SearchType.QUERY_THEN_FETCH;
import static org.elasticsearch.action.search.TransportSearchHelper.checkCCSVersionCompatibility;
Expand Down Expand Up @@ -1716,7 +1717,7 @@ public final void onFailure(Exception e) {
ShardSearchFailure f = new ShardSearchFailure(e);
logCCSError(f, clusterAlias, skipUnavailable);
SearchResponse.Cluster cluster = clusters.getCluster(clusterAlias);
if (skipUnavailable) {
if (skipUnavailable && isTaskCancelledException(e) == false) {
if (cluster != null) {
ccsClusterInfoUpdate(f, clusters, clusterAlias, true);
}
Expand All @@ -1725,7 +1726,7 @@ public final void onFailure(Exception e) {
ccsClusterInfoUpdate(f, clusters, clusterAlias, false);
}
Exception exception = e;
if (RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY.equals(clusterAlias) == false) {
if (RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY.equals(clusterAlias) == false && isTaskCancelledException(e) == false) {
exception = wrapRemoteClusterFailure(clusterAlias, e);
}
if (exceptions.compareAndSet(null, exception) == false) {
Expand Down
Loading