Skip to content

Release agg context in tests part 3#91598

Merged
not-napoleon merged 16 commits intoelastic:mainfrom
not-napoleon:release-agg-context-in-tests-part-3
Nov 17, 2022
Merged

Release agg context in tests part 3#91598
not-napoleon merged 16 commits intoelastic:mainfrom
not-napoleon:release-agg-context-in-tests-part-3

Conversation

@not-napoleon
Copy link
Copy Markdown
Member

This PR, which is hopefully the last in the aggregations test refactoring saga, enables the fix for MockBigArrays which in turn enables circuit breaker tracking for a lot of aggs tests. Consequentially, it causes a bunch of failures from tests that are doing the wrong thing, so this PR includes fixes for those.

In general, I've tried to favor fixing these tests by standardizing them on calling either AggregatorTestCase#searchAndReduce or AggregatorTestCase#testCase, which have the correct handling for the BigArrays held by AggregationContext. In some cases, this has not been possible, and I've just released the AggregationContext in a try block within the test. That's less than ideal, but there aren't many tests I've needed to do that for.

@not-napoleon not-napoleon added >non-issue >test Issues or PRs that are addressing/adding tests :Analytics/Aggregations Aggregations >tech debt v8.6.0 labels Nov 15, 2022
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 15, 2022
@kingherc kingherc added v8.7.0 and removed v8.6.0 labels Nov 16, 2022
aggregator.postCollection();
RareTerms result = (RareTerms) aggregator.buildTopLevel();

*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover commenting?


Global global = (Global) aggregator.buildTopLevel();

*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also leftover?


Max max = (Max) aggregator.buildAggregation(0L);

*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another leftover?

addToDocument(0, document, createDocument("term-field", "a", "long", 100L));
indexWriter.addDocument(document);
}
List<Releasable> releasables = new ArrayList<>();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't put anything in the list other than context - I think it's slightly more normal to declare AggregationContext context = null and then assign something to it and release the context, null or not.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or try() it, I guess.

Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants