-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Introduce TwoPhaseCollector to leverage ContextIndexSearcher in AggregatorTestCase #98835
Conversation
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Pinging @elastic/es-search (Team:Search) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two questions. LGTM - I think the TwoPhaseCollector
actually cleans post collection up a bit and bring unit tests a little closer to reality.
} else if (aggsCollector instanceof InternalProfileCollector profileCollector) { | ||
profileCollector.doPostCollection(); | ||
if (aggsCollector instanceof TwoPhaseCollector twoPhaseCollector) { | ||
twoPhaseCollector.doPostCollection(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should aggsCollector
always be a TwoPhaseCollector
? Since BucketCollectorWrapper
and InternalProfileCollector
implement that interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but trying to exploit that was a headache because some tests are abusing the Collector interface so I am leaving this for a follow up
@@ -181,6 +181,11 @@ public boolean supportsSampling() { | |||
return true; | |||
} | |||
|
|||
@Override | |||
public boolean supportsParallelCollection() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that this agg didn't support parallel collection also before this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the postcollection method is accessing doc values created in the coordinating thread.
In oder to leverage the call of postcollection in the ContextIndexSearcher, we need to introduce an abstraction that can be leverage by AggregatorTestCase. Therefore we introduce the TwoPhaseCollector which simplifies a bit the code and allow to create those collector in the AggregatorTestCase.
relates #98672