Skip to content

Commit 0680175

Browse files
Do not look over TaskCancelledException when looking at failures when updating CCS info for clusters (elastic#125206)
Do not look over `TaskCancelledException` when looking at failures when updating CCS info for clusters (cherry picked from commit 0350a48) # Conflicts: # muted-tests.yml
1 parent 1b22b0e commit 0680175

File tree

4 files changed

+140
-8
lines changed

4 files changed

+140
-8
lines changed

muted-tests.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,132 @@ tests:
241241
- class: org.elasticsearch.xpack.inference.InferenceRestIT
242242
method: test {p0=inference/30_semantic_text_inference_bwc/Calculates embeddings using the default ELSER 2 endpoint}
243243
issue: https://github.com/elastic/elasticsearch/issues/117349
244+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
245+
method: test {p0=transform/transforms_reset/Test reset running transform}
246+
issue: https://github.com/elastic/elasticsearch/issues/117473
247+
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
248+
method: test {p0=search.highlight/50_synthetic_source/text multi unified from vectors}
249+
issue: https://github.com/elastic/elasticsearch/issues/117815
250+
- class: org.elasticsearch.xpack.ml.integration.RegressionIT
251+
method: testTwoJobsWithSameRandomizeSeedUseSameTrainingSet
252+
issue: https://github.com/elastic/elasticsearch/issues/117805
253+
- class: org.elasticsearch.packaging.test.ArchiveTests
254+
method: test44AutoConfigurationNotTriggeredOnNotWriteableConfDir
255+
issue: https://github.com/elastic/elasticsearch/issues/118208
256+
- class: org.elasticsearch.packaging.test.ArchiveTests
257+
method: test51AutoConfigurationWithPasswordProtectedKeystore
258+
issue: https://github.com/elastic/elasticsearch/issues/118212
259+
- class: org.elasticsearch.datastreams.DataStreamsClientYamlTestSuiteIT
260+
method: test {p0=data_stream/120_data_streams_stats/Multiple data stream}
261+
issue: https://github.com/elastic/elasticsearch/issues/118217
262+
- class: org.elasticsearch.xpack.ccr.rest.ShardChangesRestIT
263+
method: testShardChangesNoOperation
264+
issue: https://github.com/elastic/elasticsearch/issues/118800
265+
- class: org.elasticsearch.xpack.security.authc.ldap.ActiveDirectoryRunAsIT
266+
issue: https://github.com/elastic/elasticsearch/issues/115727
267+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
268+
method: test {p0=transform/transforms_start_stop/Test start/stop/start transform}
269+
issue: https://github.com/elastic/elasticsearch/issues/119508
270+
- class: org.elasticsearch.smoketest.MlWithSecurityIT
271+
method: test {yaml=ml/sparse_vector_search/Test sparse_vector search with query vector and pruning config}
272+
issue: https://github.com/elastic/elasticsearch/issues/119548
273+
- class: org.elasticsearch.xpack.ml.integration.ForecastIT
274+
method: testOverflowToDisk
275+
issue: https://github.com/elastic/elasticsearch/issues/117740
276+
- class: org.elasticsearch.xpack.security.authc.ldap.MultiGroupMappingIT
277+
issue: https://github.com/elastic/elasticsearch/issues/119599
278+
- class: org.elasticsearch.multi_cluster.MultiClusterYamlTestSuiteIT
279+
issue: https://github.com/elastic/elasticsearch/issues/119983
280+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
281+
method: test {p0=transform/transforms_unattended/Test unattended put and start}
282+
issue: https://github.com/elastic/elasticsearch/issues/120019
283+
- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT
284+
method: testUpdatePolicyToAddPhasesYieldsInvalidActionsToBeSkipped
285+
issue: https://github.com/elastic/elasticsearch/issues/118406
286+
- class: org.elasticsearch.xpack.security.QueryableReservedRolesIT
287+
method: testConfiguredReservedRolesAfterClosingAndOpeningIndex
288+
issue: https://github.com/elastic/elasticsearch/issues/120127
289+
- class: org.elasticsearch.oldrepos.OldRepositoryAccessIT
290+
method: testOldRepoAccess
291+
issue: https://github.com/elastic/elasticsearch/issues/120148
292+
- class: org.elasticsearch.oldrepos.OldRepositoryAccessIT
293+
method: testOldSourceOnlyRepoAccess
294+
issue: https://github.com/elastic/elasticsearch/issues/120080
295+
- class: org.elasticsearch.xpack.ccr.FollowIndexSecurityIT
296+
method: testCleanShardFollowTaskAfterDeleteFollower
297+
issue: https://github.com/elastic/elasticsearch/issues/120339
298+
- class: org.elasticsearch.reservedstate.service.FileSettingsServiceTests
299+
method: testInvalidJSON
300+
issue: https://github.com/elastic/elasticsearch/issues/120482
301+
- class: org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeToCharProcessorTests
302+
issue: https://github.com/elastic/elasticsearch/issues/120575
303+
- class: org.elasticsearch.xpack.inference.DefaultEndPointsIT
304+
method: testMultipleInferencesTriggeringDownloadAndDeploy
305+
issue: https://github.com/elastic/elasticsearch/issues/120668
306+
- class: org.elasticsearch.xpack.security.authc.ldap.ADLdapUserSearchSessionFactoryTests
307+
issue: https://github.com/elastic/elasticsearch/issues/119882
308+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
309+
method: test {p0=ml/3rd_party_deployment/Test start deployment fails while model download in progress}
310+
issue: https://github.com/elastic/elasticsearch/issues/120810
311+
- class: org.elasticsearch.xpack.security.authc.service.ServiceAccountIT
312+
method: testAuthenticateShouldNotFallThroughInCaseOfFailure
313+
issue: https://github.com/elastic/elasticsearch/issues/120902
314+
- class: org.elasticsearch.packaging.test.DockerTests
315+
method: test050BasicApiTests
316+
issue: https://github.com/elastic/elasticsearch/issues/120911
317+
- class: org.elasticsearch.packaging.test.DockerTests
318+
method: test140CgroupOsStatsAreAvailable
319+
issue: https://github.com/elastic/elasticsearch/issues/120914
320+
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
321+
method: testReservedStatePersistsOnRestart
322+
issue: https://github.com/elastic/elasticsearch/issues/120923
323+
- class: org.elasticsearch.packaging.test.DockerTests
324+
method: test070BindMountCustomPathConfAndJvmOptions
325+
issue: https://github.com/elastic/elasticsearch/issues/120910
326+
- class: org.elasticsearch.packaging.test.DockerTests
327+
method: test071BindMountCustomPathWithDifferentUID
328+
issue: https://github.com/elastic/elasticsearch/issues/120918
329+
- class: org.elasticsearch.packaging.test.DockerTests
330+
method: test171AdditionalCliOptionsAreForwarded
331+
issue: https://github.com/elastic/elasticsearch/issues/120925
332+
- class: org.elasticsearch.action.search.SearchProgressActionListenerIT
333+
method: testSearchProgressWithQuery
334+
issue: https://github.com/elastic/elasticsearch/issues/120994
335+
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
336+
method: test {p0=nodes.stats/11_indices_metrics/indices mappings exact count test for indices level}
337+
issue: https://github.com/elastic/elasticsearch/issues/120950
338+
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
339+
method: testFileSettingsReprocessedOnRestartWithoutVersionChange
340+
issue: https://github.com/elastic/elasticsearch/issues/120964
341+
- class: org.elasticsearch.xpack.ml.integration.PyTorchModelIT
342+
issue: https://github.com/elastic/elasticsearch/issues/121165
343+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
344+
method: test {p0=transform/*}
345+
issue: https://github.com/elastic/elasticsearch/issues/120816
346+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
347+
method: test {p0=ml/*}
348+
issue: https://github.com/elastic/elasticsearch/issues/120816
349+
- class: org.elasticsearch.xpack.security.authc.ldap.ActiveDirectorySessionFactoryTests
350+
issue: https://github.com/elastic/elasticsearch/issues/121285
351+
- class: org.elasticsearch.env.NodeEnvironmentTests
352+
method: testGetBestDowngradeVersion
353+
issue: https://github.com/elastic/elasticsearch/issues/121316
354+
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
355+
issue: https://github.com/elastic/elasticsearch/issues/121407
356+
- class: org.elasticsearch.analysis.common.CommonAnalysisClientYamlTestSuiteIT
357+
method: test {yaml=analysis-common/40_token_filters/stemmer_override file access}
358+
issue: https://github.com/elastic/elasticsearch/issues/121625
359+
- class: org.elasticsearch.xpack.application.CohereServiceUpgradeIT
360+
issue: https://github.com/elastic/elasticsearch/issues/121537
361+
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
362+
method: test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously}
363+
issue: https://github.com/elastic/elasticsearch/issues/122102
364+
- class: org.elasticsearch.smoketest.SmokeTestMonitoringWithSecurityIT
365+
method: testHTTPExporterWithSSL
366+
issue: https://github.com/elastic/elasticsearch/issues/122220
367+
- class: org.elasticsearch.blocks.SimpleBlocksIT
368+
method: testConcurrentAddBlock
369+
issue: https://github.com/elastic/elasticsearch/issues/122324
244370
- class: org.elasticsearch.search.basic.SearchWithRandomDisconnectsIT
245371
method: testSearchWithRandomDisconnects
246372
issue: https://github.com/elastic/elasticsearch/issues/116175

server/src/main/java/org/elasticsearch/ExceptionsHelper.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.elasticsearch.core.Nullable;
2020
import org.elasticsearch.index.Index;
2121
import org.elasticsearch.rest.RestStatus;
22+
import org.elasticsearch.tasks.TaskCancelledException;
2223
import org.elasticsearch.transport.ConnectTransportException;
2324
import org.elasticsearch.transport.NoSeedNodeLeftException;
2425
import org.elasticsearch.transport.NoSuchRemoteClusterException;
@@ -514,6 +515,15 @@ public static boolean isRemoteUnavailableException(Exception e) {
514515
return false;
515516
}
516517

518+
/**
519+
* Utility method to check if an Exception is/was caused by TaskCancelledException.
520+
* @param e Exception we're interested in evaluating.
521+
* @return true if the Exception is/was caused by TaskCancelledException, else false.
522+
*/
523+
public static boolean isTaskCancelledException(Exception e) {
524+
return ExceptionsHelper.unwrapCausesAndSuppressed(e, ex -> ex instanceof TaskCancelledException).isPresent();
525+
}
526+
517527
private static class GroupBy {
518528
final String reason;
519529
final String index;

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import org.elasticsearch.search.internal.SearchContext;
3939
import org.elasticsearch.search.internal.ShardSearchContextId;
4040
import org.elasticsearch.search.internal.ShardSearchRequest;
41-
import org.elasticsearch.tasks.TaskCancelledException;
4241
import org.elasticsearch.transport.Transport;
4342

4443
import java.util.ArrayList;
@@ -505,7 +504,7 @@ void onShardFailure(final int shardIndex, SearchShardTarget shardTarget, Excepti
505504
}
506505
// we don't aggregate shard on failures due to the internal cancellation,
507506
// but do keep the header counts right
508-
if ((requestCancelled.get() && isTaskCancelledException(e)) == false) {
507+
if ((requestCancelled.get() && ExceptionsHelper.isTaskCancelledException(e)) == false) {
509508
AtomicArray<ShardSearchFailure> shardFailures = this.shardFailures.get();
510509
// lazily create shard failures, so we can early build the empty shard failure list in most cases (no failures)
511510
if (shardFailures == null) { // this is double checked locking but it's fine since SetOnce uses a volatile read internally
@@ -535,10 +534,6 @@ void onShardFailure(final int shardIndex, SearchShardTarget shardTarget, Excepti
535534
}
536535
}
537536

538-
private static boolean isTaskCancelledException(Exception e) {
539-
return ExceptionsHelper.unwrapCausesAndSuppressed(e, ex -> ex instanceof TaskCancelledException).isPresent();
540-
}
541-
542537
/**
543538
* Executed once for every successful shard level request.
544539
* @param result the result returned form the shard

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ public final void onFailure(Exception e) {
17091709
ShardSearchFailure f = new ShardSearchFailure(e);
17101710
logCCSError(f, clusterAlias, skipUnavailable);
17111711
SearchResponse.Cluster cluster = clusters.getCluster(clusterAlias);
1712-
if (skipUnavailable) {
1712+
if (skipUnavailable && ExceptionsHelper.isTaskCancelledException(e) == false) {
17131713
if (cluster != null) {
17141714
ccsClusterInfoUpdate(f, clusters, clusterAlias, true);
17151715
}
@@ -1718,7 +1718,8 @@ public final void onFailure(Exception e) {
17181718
ccsClusterInfoUpdate(f, clusters, clusterAlias, false);
17191719
}
17201720
Exception exception = e;
1721-
if (RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY.equals(clusterAlias) == false) {
1721+
if (RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY.equals(clusterAlias) == false
1722+
&& ExceptionsHelper.isTaskCancelledException(e) == false) {
17221723
exception = wrapRemoteClusterFailure(clusterAlias, e);
17231724
}
17241725
if (exceptions.compareAndSet(null, exception) == false) {

0 commit comments

Comments
 (0)