-
Notifications
You must be signed in to change notification settings - Fork 215
feat: complex query thread pool #5628
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
Open
Swiddis
wants to merge
22
commits into
opensearch-project:main
Choose a base branch
from
Swiddis:feat/slow-query-pool
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a391bd9
feat: slow query thread pool
Swiddis 311f751
handle slow query detection when optimization runs in execution step
Swiddis 49e41df
fixes: assorted context propagation issues
Swiddis 657657c
fix remaining integ tests
Swiddis 5b0d7b2
add some more thread & security tests
Swiddis 46c3cbe
code self-review, round 1
Swiddis 6fdd82e
Merge remote-tracking branch 'upstream/main' into feat/slow-query-pool
Swiddis 434021f
use 2x background threads to account for 2x pools
Swiddis 169375f
rename slow -> complex, add pool indication header
Swiddis 9c57cd7
add a failure log for slow pool requests
Swiddis 7da8807
fix profile, add thread pool as part of profile object
Swiddis 559a2d0
remove leftover build.gradle changes from another branch
Swiddis 3ab3b4b
add cancelation polling so ppl cancelation is faster to apply
Swiddis 73c68cf
Add thread pool profile details to doc
Swiddis 21dd714
Move analyze call measurement
Swiddis 9ba8eef
add complex pool IT
Swiddis 009300a
Move calcite context thread copies to dedicated method
Swiddis cc02907
add attach_pid to gitignore
Swiddis aaaa8e4
register timeout handler to complex pool on these requests
Swiddis 1053561
fix units
Swiddis ba6046c
Merge remote-tracking branch 'upstream/main' into feat/slow-query-pool
Swiddis 737d413
remove redundant optimize call from execution engine during execution
Swiddis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
26 changes: 26 additions & 0 deletions
26
core/src/main/java/org/opensearch/sql/executor/DirectExecutionDispatcher.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.executor; | ||
|
|
||
| import org.apache.calcite.rel.RelNode; | ||
| import org.opensearch.sql.calcite.CalcitePlanContext; | ||
| import org.opensearch.sql.common.response.ResponseListener; | ||
|
|
||
| /** | ||
| * Default no-op dispatcher that executes inline on the current thread. Used when complex-pool | ||
| * routing is disabled or as a fallback. | ||
| */ | ||
| public class DirectExecutionDispatcher implements ExecutionDispatcher { | ||
|
|
||
| @Override | ||
| public void dispatch( | ||
| RelNode plan, | ||
| CalcitePlanContext context, | ||
| ResponseListener<ExecutionEngine.QueryResponse> listener, | ||
| ExecutionEngine engine) { | ||
| engine.execute(plan, context, listener); | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
core/src/main/java/org/opensearch/sql/executor/ExecutionDispatcher.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.executor; | ||
|
|
||
| import org.apache.calcite.rel.RelNode; | ||
| import org.opensearch.sql.calcite.CalcitePlanContext; | ||
| import org.opensearch.sql.common.response.ResponseListener; | ||
|
|
||
| /** | ||
| * Dispatches query execution to an appropriate thread pool based on plan characteristics. After | ||
| * query analysis and optimization, the dispatcher inspects the plan and routes execution to either | ||
| * the fast worker pool (for queries fully pushed to OpenSearch) or the complex worker pool (for | ||
| * queries requiring scripts/table scans). | ||
| */ | ||
| public interface ExecutionDispatcher { | ||
|
|
||
| /** | ||
| * Dispatch execution of the given plan via the standard ExecutionEngine. | ||
| * | ||
| * @param plan the optimized Calcite plan | ||
| * @param context the plan context | ||
| * @param listener response listener for query results | ||
| * @param engine the execution engine to invoke | ||
| */ | ||
| void dispatch( | ||
| RelNode plan, | ||
| CalcitePlanContext context, | ||
| ResponseListener<ExecutionEngine.QueryResponse> listener, | ||
| ExecutionEngine engine); | ||
|
|
||
| /** | ||
| * Dispatch a task to the appropriate thread pool based on plan characteristics. Use this when the | ||
| * execution path differs from the standard ExecutionEngine interface (e.g., analytics engine). | ||
| * | ||
| * @param plan the optimized Calcite plan used for routing decisions | ||
| * @param context the plan context | ||
| * @param task the execution task to run | ||
| */ | ||
| default void dispatchTask(RelNode plan, CalcitePlanContext context, Runnable task) { | ||
| task.run(); | ||
| } | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.