Skip to content

Commit 1414f98

Browse files
authored
[8.16] Fix testSearchConcurrencyDoesNotCreateMoreTasksThanThreads failure (#116269)
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 0cb6957 commit 1414f98

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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)