Avoid over collecting in Limit or Lucene Operator#123296
Merged
dnhatn merged 2 commits intoelastic:mainfrom Mar 1, 2025
Merged
Avoid over collecting in Limit or Lucene Operator#123296dnhatn merged 2 commits intoelastic:mainfrom
dnhatn merged 2 commits intoelastic:mainfrom
Conversation
7754300 to
80a3936
Compare
80a3936 to
bbef844
Compare
Collaborator
|
Hi @dnhatn, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
costin
approved these changes
Mar 1, 2025
Member
Author
|
Thanks Costin! |
This was referenced Mar 1, 2025
Collaborator
You can use sqren/backport to manually backport by running |
dnhatn
added a commit
to dnhatn/elasticsearch
that referenced
this pull request
Mar 1, 2025
Currently, we rely on signal propagation for early termination. For example, FROM index | LIMIT 10 can be executed by multiple Drivers: several Drivers to read document IDs and extract fields, and the final Driver to select at most 10 rows. In this scenario, each Lucene Driver can independently collect up to 10 rows until the final Driver has enough rows and signals them to stop collecting. In most cases, this model works fine, but when extracting fields from indices in the warm/cold tier, it can impact performance. This change introduces a Limiter used between LimitOperator and LuceneSourceOperator to avoid over-collecting. We will also need a follow-up to ensure that we do not over-collect between multiple stages of query execution.
dnhatn
added a commit
to dnhatn/elasticsearch
that referenced
this pull request
Mar 1, 2025
Currently, we rely on signal propagation for early termination. For example, FROM index | LIMIT 10 can be executed by multiple Drivers: several Drivers to read document IDs and extract fields, and the final Driver to select at most 10 rows. In this scenario, each Lucene Driver can independently collect up to 10 rows until the final Driver has enough rows and signals them to stop collecting. In most cases, this model works fine, but when extracting fields from indices in the warm/cold tier, it can impact performance. This change introduces a Limiter used between LimitOperator and LuceneSourceOperator to avoid over-collecting. We will also need a follow-up to ensure that we do not over-collect between multiple stages of query execution.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 1, 2025
Currently, we rely on signal propagation for early termination. For example, FROM index | LIMIT 10 can be executed by multiple Drivers: several Drivers to read document IDs and extract fields, and the final Driver to select at most 10 rows. In this scenario, each Lucene Driver can independently collect up to 10 rows until the final Driver has enough rows and signals them to stop collecting. In most cases, this model works fine, but when extracting fields from indices in the warm/cold tier, it can impact performance. This change introduces a Limiter used between LimitOperator and LuceneSourceOperator to avoid over-collecting. We will also need a follow-up to ensure that we do not over-collect between multiple stages of query execution.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 1, 2025
…23784) * Avoid over collecting in Limit or Lucene Operator (#123296) Currently, we rely on signal propagation for early termination. For example, FROM index | LIMIT 10 can be executed by multiple Drivers: several Drivers to read document IDs and extract fields, and the final Driver to select at most 10 rows. In this scenario, each Lucene Driver can independently collect up to 10 rows until the final Driver has enough rows and signals them to stop collecting. In most cases, this model works fine, but when extracting fields from indices in the warm/cold tier, it can impact performance. This change introduces a Limiter used between LimitOperator and LuceneSourceOperator to avoid over-collecting. We will also need a follow-up to ensure that we do not over-collect between multiple stages of query execution. * Fix compilation after #123784 * fix compile * fix compile
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 1, 2025
…123783) * Avoid over collecting in Limit or Lucene Operator (#123296) Currently, we rely on signal propagation for early termination. For example, FROM index | LIMIT 10 can be executed by multiple Drivers: several Drivers to read document IDs and extract fields, and the final Driver to select at most 10 rows. In this scenario, each Lucene Driver can independently collect up to 10 rows until the final Driver has enough rows and signals them to stop collecting. In most cases, this model works fine, but when extracting fields from indices in the warm/cold tier, it can impact performance. This change introduces a Limiter used between LimitOperator and LuceneSourceOperator to avoid over-collecting. We will also need a follow-up to ensure that we do not over-collect between multiple stages of query execution. * Fix compilation after #123784 * fix compile * fix compile
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 3, 2025
dnhatn
added a commit
to dnhatn/elasticsearch
that referenced
this pull request
Mar 3, 2025
A follow-up to elastic#123296 to address a potential block leak that may occur when a circuit-breaking exception is triggered while truncating the docs or scores blocks. Relates elastic#123296 (cherry picked from commit 7560e2e)
dnhatn
added a commit
to dnhatn/elasticsearch
that referenced
this pull request
Mar 3, 2025
A follow-up to elastic#123296 to address a potential block leak that may occur when a circuit-breaking exception is triggered while truncating the docs or scores blocks. Relates elastic#123296 (cherry picked from commit 7560e2e)
dnhatn
added a commit
that referenced
this pull request
Mar 3, 2025
dnhatn
added a commit
that referenced
this pull request
Mar 3, 2025
dnhatn
added a commit
that referenced
this pull request
Mar 3, 2025
idegtiarenko
reviewed
Mar 3, 2025
| /** | ||
| * A shared limiter used by multiple drivers to collect hits in parallel without exceeding the output limit. | ||
| * For example, if the query `FROM test-1,test-2 | LIMIT 100` is run with two drivers, and one driver (e.g., querying `test-1`) | ||
| * has collected 60 hits, then the other driver querying `test-2` should collect at most 40 hits. |
Contributor
There was a problem hiding this comment.
Nice idea!
I wonder if we should make it explicit that this works as long as test-1 and test-2 are on the same node?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, we rely on signal propagation for early termination. For example,
FROM index | LIMIT 10can be executed by multiple Drivers: several Drivers to read document IDs and extract fields, and the final Driver to select at most 10 rows. In this scenario, each Lucene Driver can independently collect up to 10 rows until the final Driver has enough rows and signals them to stop collecting. In most cases, this model works fine, but when extracting fields from indices in the warm/cold tier, it can impact performance. This change introduces a Limiter used between LimitOperator and LuceneSourceOperator to avoid over-collecting. We will also need a follow-up to ensure that we do not over-collect between multiple stages of query execution.