-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Fix bug in circuit-breaker check for geoshape grid aggregations #57962
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
Conversation
There was a bug in the geoshape circuit-breaker check where the hash values array was being allocated before its new size was accounted for by the circuit breaker. Fixes elastic#57847.
Pinging @elastic/es-analytics-geo (:Analytics/Geo) |
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'm not really a big fan of guessing that the array will expand to using oversize
. This is right now but there isn't anything that makes sure this stays right.
to reproduce OOM, download this USA Elasticsearch document:
|
I agree with Nick's point, I wonder if we should add a method to |
is the concern that that there is nothing tying the usage of Looking at SortingNumericDocValues again now, I'm surprised there is no circuit-breaking usage there since it leverages the same resizing techniques and can, similarly, run into memory pressure. I suspect this has never been a problem because of the bucket size limit? |
I bet we just don't hit it because we don't frequently end up with very many values so the array never grows that large. I wonder if we should just pass a |
@nik9000 Note that the case for grid aggregations on geo shapes is a bit special in the sense that one value can generate potentially millions of buckets. That is not the case for other bucket aggregations where typically one doc value generates maybe a handful of buckets. (Probably the other aggregations that can generate lots of buckets are related with range field types #50109) Adding a |
That makes sense to me! Would having a mutable `LongConsumer` that we
register be ok? It could default to noop and this agg could link it to the
breaker.
…On Fri, Jun 12, 2020, 05:02 Ignacio Vera ***@***.***> wrote:
@nik9000 <https://github.com/nik9000> Note that the case for grid
aggregations on geo shapes is a bit special in the sense that one value can
generate potentially millions of tickets. That is not the case for other
bucket aggregations where typically one doc value generates maybe a handful
of buckets. (Probably the other aggregations that can generate lots of
buckets are related with range field types #50109
<#50109>)
Adding a LongConsumer to the constructor will touch lots of other
implementations so I would like to avoid it for this PR. Maybe we can find
a middle ground here and add a TODO to design a more resilient
implementation?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#57962 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABUXIT3VUS4AAY66CWUUS3RWHVKDANCNFSM4N24FRIQ>
.
|
+1 |
👍 yes. I had planned to push this forward this week |
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.
lgtm
I re-ran this using and this branch resulted in a circuit-breaker response
while |
it may also not be clear, but the aggregator keeps track of these bytes added, and cleans them up upon closing of the aggregation here elasticsearch/server/src/main/java/org/elasticsearch/search/aggregations/AggregatorBase.java Line 268 in dc91a30
|
server/src/main/java/org/elasticsearch/index/fielddata/SortingNumericDocValues.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/fielddata/SortingNumericDocValues.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/fielddata/SortingNumericDocValues.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/fielddata/SortingNumericDocValues.java
Outdated
Show resolved
Hide resolved
thank you @nik9000. your suggestions were real great. updated! |
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.
LGTM
server/src/main/java/org/elasticsearch/index/fielddata/SortingNumericDocValues.java
Outdated
Show resolved
Hide resolved
…tic#57962) There was a bug in the geoshape circuit-breaker check where the hash values array was being allocated before its new size was accounted for by the circuit breaker. Fixes elastic#57847.
PR #57962 increased the precision from 6 to 7 without realizing the effects on CI — This resulted in out of memory exceptions in CI. This commit reduces the precision down to 5.
There was a bug in the geoshape circuit-breaker check where the
hash values array was being allocated before its new size was
accounted for by the circuit breaker.
Fixes #57847.