Skip to content

Commit

Permalink
Disable parallel collection in top hits aggregator
Browse files Browse the repository at this point in the history
TopHitsAggregator calls TopFieldCollector#populateScores from each slice, which in turn
relies on createWeight calls against the searcher. This means that the
createWeight call gets parallelized with Lucene 9.9, but it should not
as we are already executing multiple slices concurrently. We have
protecions in place in Lucene to avoid this problem, but we have to
adapt our execution code in ContextIndexSearcher accordingly.

The goal is to utilize plain TaskExecutor from Lucene and avoid code
duplication. In the meantime, we can disable concurrency for top hits
aggregations as it causes actual issues currently in the lucene_snapshot
branch.
  • Loading branch information
javanna committed Oct 11, 2023
1 parent e699904 commit a5d0f53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -921,4 +921,9 @@ public String getType() {
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.ZERO;
}

@Override
public boolean supportsParallelCollection() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,8 @@ protected void assertToXContentAfterSerialization(TopHitsAggregationBuilder orig
XContentType.JSON
);
}

public void testSupportsParallelCollection() {
assertFalse(createTestAggregatorBuilder().supportsParallelCollection());
}
}

0 comments on commit a5d0f53

Please sign in to comment.