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

Fix a sneaky bug in rare_terms #51868

Merged
merged 2 commits into from
Feb 5, 2020
Merged

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Feb 4, 2020

When the rare_terms aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes #51020

@elasticmachine
Copy link
Collaborator

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

When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes elastic#51020
@nik9000
Copy link
Member Author

nik9000 commented Feb 4, 2020

The bwc test failure is because I haven't backported the fix. I'll suppress it.

Copy link
Contributor

@polyfractal polyfractal left a comment

Choose a reason for hiding this comment

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

Sneaky sneaky! Thanks for tracking this down! ❤️

@nik9000 nik9000 merged commit b6d06c9 into elastic:master Feb 5, 2020
@fkelbert
Copy link

fkelbert commented Feb 5, 2020

Thanks for taking care of this this quickly!

nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Feb 5, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes elastic#51020
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Feb 5, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes elastic#51020
nik9000 added a commit that referenced this pull request Feb 5, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes #51020
@polyfractal polyfractal added v7.6.0 and removed v7.6.1 labels Feb 7, 2020
nik9000 added a commit that referenced this pull request Feb 12, 2020
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes #51020
@nik9000
Copy link
Member Author

nik9000 commented Feb 12, 2020

I'm finished backporting but I'm leaving the backport pending tag on this until I can fix the skips in the BWC tests. That should be later this afternoon.

nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Feb 12, 2020
Now that elastic#51868 is fully backported we can run its tests in the
backwards compatibility tests.
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Feb 12, 2020
Now that elastic#51868 is fully backported we can run its tests in the
backwards compatibility tests.
nik9000 added a commit that referenced this pull request Feb 12, 2020
Now that #51868 is fully backported we can run its tests in the
backwards compatibility tests.
nik9000 added a commit that referenced this pull request Feb 12, 2020
Now that #51868 is fully backported we can run its tests in the
backwards compatibility tests.
@nik9000
Copy link
Member Author

nik9000 commented Feb 12, 2020

I'm finished backporting but I'm leaving the backport pending tag on this until I can fix the skips in the BWC tests. That should be later this afternoon.

All done!

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

Successfully merging this pull request may close these issues.

Filter aggregation fails with index_out_of_bounds_exception when nested within rare_terms
5 participants