Skip to content

Commit 31d9ee3

Browse files
authored
Fix testSearchConcurrencyDoesNotCreateMoreTasksThanThreads failure (#116204)
This test was somehow difficult to write in the first place. We had to come up with a threshold of how many tasks max are going to be created, but that is not that easy to calculate as it depends on how quickly such tasks can be created and be executed. We should have rather used a higher threshold to start with, the important part is anyways that we create a total of tasks that is no longer dependent on the number of segments, given there are much less threads available to execute them. Closes #116048
1 parent 4764c35 commit 31d9ee3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,6 @@ tests:
289289
- class: org.elasticsearch.upgrades.FullClusterRestartIT
290290
method: testSnapshotRestore {cluster=OLD}
291291
issue: https://github.com/elastic/elasticsearch/issues/111777
292-
- class: org.elasticsearch.search.DefaultSearchContextTests
293-
method: testSearchConcurrencyDoesNotCreateMoreTasksThanThreads
294-
issue: https://github.com/elastic/elasticsearch/issues/116048
295292
- class: org.elasticsearch.analysis.common.CommonAnalysisClientYamlTestSuiteIT
296293
issue: https://github.com/elastic/elasticsearch/issues/116134
297294
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsRestIT

server/src/test/java/org/elasticsearch/search/DefaultSearchContextTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,9 @@ public int size() {
10561056
assertThat(executor.getCompletedTaskCount(), greaterThanOrEqualTo((long) numIters * executorPoolSize));
10571057
// while we parallelize we also limit the number of tasks that each searcher submits
10581058
assertThat(executor.getCompletedTaskCount(), lessThan((long) numIters * numSegmentTasks));
1059-
// *3 is just a wild guess to account for tasks that get executed while we are still submitting
1060-
assertThat(executor.getCompletedTaskCount(), lessThan((long) numIters * executorPoolSize * 3));
1059+
// *10 is just a wild guess to account for tasks that get executed while we are still submitting. The important bit is that it is a
1060+
// much lower factor than the number of segments
1061+
assertThat(executor.getCompletedTaskCount(), lessThan((long) numIters * executorPoolSize * 10));
10611062
}
10621063

10631064
private void doTestSearchConcurrency(ThreadPoolExecutor executor, int numIters, int numSegmentTasks, AtomicInteger completedTasks)

0 commit comments

Comments
 (0)