mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
* Don't generate stacktrace in TaskCancelledException (#125002) # Conflicts: # modules/aggregations/src/internalClusterTest/java/org/elasticsearch/aggregations/bucket/SearchCancellationIT.java * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
This commit is contained in:
parent
73fc040661
commit
0dec400ebc
3 changed files with 14 additions and 1 deletions
5
docs/changelog/125002.yaml
Normal file
5
docs/changelog/125002.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
pr: 125002
|
||||
summary: Don't generate stacktrace in `TaskCancelledException`
|
||||
area: Search
|
||||
type: bug
|
||||
issues: []
|
|
@ -42,6 +42,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
|
|||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
|
||||
public class SearchCancellationIT extends AbstractSearchCancellationTestCase {
|
||||
|
||||
|
@ -124,7 +125,9 @@ public class SearchCancellationIT extends AbstractSearchCancellationTestCase {
|
|||
logger.info("All shards failed with", ex);
|
||||
if (lowLevelCancellation) {
|
||||
// Ensure that we cancelled in TimeSeriesIndexSearcher and not in reduce phase
|
||||
assertThat(ExceptionsHelper.stackTrace(ex), containsString("TimeSeriesIndexSearcher"));
|
||||
assertThat(ExceptionsHelper.stackTrace(ex), not(containsString("not building sub-aggregations due to task cancellation")));
|
||||
} else {
|
||||
assertThat(ExceptionsHelper.stackTrace(ex), containsString("not building sub-aggregations due to task cancellation"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,11 @@ public class TaskCancelledException extends ElasticsearchException {
|
|||
super(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Throwable fillInStackTrace() {
|
||||
return this; // this exception doesn't imply a bug, no need for a stack trace
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestStatus status() {
|
||||
// Tasks are typically cancelled at the request of the client, so a 4xx status code is more accurate than the default of 500 (and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue