Skip to content

Commit fb3149c

Browse files
authored
ESQL: Unmute test and reuse blockFactory to avoid concurrently modifying the test factories list (#128211)
Fixes #128092 The error happens inside an ArrayList.add(), and it's a concurrency-related one. The stacktrace is quite explicative: ``` java.lang.ArrayIndexOutOfBoundsException: Index 34 out of bounds for length 33 at java.util.ArrayList.add(ArrayList.java:485) at org.elasticsearch.compute.test.ComputeTestCase.blockFactory(ComputeTestCase.java:62) at org.elasticsearch.compute.aggregation.GroupingAggregatorFunctionTestCase$4$1$1.addBlock(GroupingAggregatorFunctionTestCase.java:659) ``` We were creating new blockFactories() inside the aggregator, which was being called concurrently with different drivers. As `blockFactory()` adds it to a static ArrayList, it was sometimes throwing. The bug only affects tests. Potentially, all grouping aggregators tests.
1 parent 960222e commit fb3149c

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,6 @@ tests:
438438
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
439439
method: test {lookup-join.MvJoinKeyOnTheLookupIndex ASYNC}
440440
issue: https://github.com/elastic/elasticsearch/issues/128030
441-
- class: org.elasticsearch.compute.aggregation.PercentileIntGroupingAggregatorFunctionTests
442-
method: testManyInitialManyPartialFinalRunner
443-
issue: https://github.com/elastic/elasticsearch/issues/128092
444441
- class: org.elasticsearch.packaging.test.DockerTests
445442
method: test042KeystorePermissionsAreCorrect
446443
issue: https://github.com/elastic/elasticsearch/issues/128018

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ public AddInput prepareProcessPage(SeenGroupIds ignoredSeenGroupIds, Page page)
671671

672672
private void addBlock(int positionOffset, IntBlock groupIds) {
673673
for (int offset = 0; offset < groupIds.getPositionCount(); offset += emitChunkSize) {
674-
try (IntBlock.Builder builder = blockFactory().newIntBlockBuilder(emitChunkSize)) {
674+
try (IntBlock.Builder builder = driverContext.blockFactory().newIntBlockBuilder(emitChunkSize)) {
675675
int endP = Math.min(groupIds.getPositionCount(), offset + emitChunkSize);
676676
for (int p = offset; p < endP; p++) {
677677
int start = groupIds.getFirstValueIndex(p);

0 commit comments

Comments
 (0)