Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Fix slice collectors to leaves association with post filter #11150

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.lucene.search.Weight;
import org.apache.lucene.util.Bits;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.search.profile.query.ProfileWeight;

import java.io.IOException;

Expand All @@ -64,6 +65,9 @@ public Collector getCollector() {

@Override
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
if (filter instanceof ProfileWeight) {
((ProfileWeight) filter).associateCollectorToLeaves(context, collector);
}
final ScorerSupplier filterScorerSupplier = filter.scorerSupplier(context);
final LeafCollector in = collector.getLeafCollector(context);
final Bits bits = Lucene.asSequentialAccessBits(context.reader().maxDoc(), filterScorerSupplier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@
// creates a new weight and breakdown map for each rewritten query. This new breakdown map captures the timing information for
// the new rewritten query. The sliceCollectorsToLeaves is empty because this breakdown for rewritten query gets created later
// in search leaf path which doesn't have collector. Also, this is not needed since this breakdown is per leaf and there is no
// concurrency involved. An empty sliceCollectorsToLeaves could also happen in the case of early termination.
// concurrency involved.
assert contexts.size() == 1 : "Unexpected size: "
+ contexts.size()

Check warning on line 88 in server/src/main/java/org/opensearch/search/profile/query/ConcurrentQueryProfileBreakdown.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/search/profile/query/ConcurrentQueryProfileBreakdown.java#L88

Added line #L88 was not covered by tests
+ " of leaves breakdown in ConcurrentQueryProfileBreakdown of rewritten query for a leaf.";
AbstractProfileBreakdown<QueryTimingType> breakdown = contexts.values().iterator().next();
queryNodeTime = breakdown.toNodeTime() + createWeightTime;
maxSliceNodeTime = 0L;
Expand Down
Loading