Skip to content

Commit 0decdc5

Browse files
committed
Added comment explainig the test logics and numbers
1 parent 88e806b commit 0decdc5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/bucket/FiltersCancellationIT.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@
4444
import static org.hamcrest.Matchers.greaterThan;
4545
import static org.hamcrest.Matchers.not;
4646

47+
/**
48+
* Ensures the filters aggregation checks task cancellation, by ensuring it doesn't process all the docs.
49+
* <p>
50+
* The CancellableBulkScorer we use to break the execution is called per search thread in the query.
51+
* It currently breaks the "for each doc" into blocks of 4096 docs (x2 every iteration), and checks for cancellation between blocks.
52+
* This test creates N docs and releases N - X permits, to ensure the search request gets cancelled before grabbing all the permits.
53+
* </p>
54+
* <p>
55+
* Also, if the search thread pool size is too high, it can lead to them trying to process too many documents anyway (pool size * 4096),
56+
* eventually blocking the threads (And failing the test). So it's explicitly set to a small number to avoid this.
57+
* </p>
58+
*/
4759
@ESIntegTestCase.SuiteScopeTestCase
4860
public class FiltersCancellationIT extends ESIntegTestCase {
4961

0 commit comments

Comments
 (0)