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

Avoid execute ESQL planning on refresh thread #104591

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented Jan 21, 2024

Thread 'elasticsearch[sre01][refresh][T#2]' with ID = 260
	java.util.HashMap.putVal(HashMap.java:661)
	java.util.HashMap.put(HashMap.java:610)
	org.elasticsearch.xpack.esql.planner.Layout$Builder.build(Layout.java:113)
	org.elasticsearch.xpack.esql.planner.EsPhysicalOperationProviders.fieldExtractPhysicalOperation(EsPhysicalOperationProviders.java:91)
	org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.planFieldExtractNode(LocalExecutionPlanner.java:273)
	org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:184)
	org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.planProject(LocalExecutionPlanner.java:571)
	org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:196)
	org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.planExchangeSink(LocalExecutionPlanner.java:377)
	org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:226)
	org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:168)
	org.elasticsearch.xpack.esql.plugin.ComputeService.runCompute(ComputeService.java:260)
	org.elasticsearch.xpack.esql.plugin.ComputeService$DataNodeRequestHandler.lambda$messageReceived$5(ComputeService.java:432)
	org.elasticsearch.xpack.esql.plugin.ComputeService$DataNodeRequestHandler$$Lambda$12661+0x00007f1991b58220.accept(Native method)

A recent report shows that we can perform ESQL planning on the refresh thread pool after waiting for refreshes from search-idle shards. While the planning process is generally lightweight, it may become expensive at times. Therefore, we should fork off the refresh thread pool immediately upon resuming ESQL execution. Another place where we should fork off is after field_caps. I will look into that later.

@elasticsearchmachine
Copy link
Collaborator

Hi @dnhatn, I've created a changelog YAML for you.

@@ -585,6 +594,7 @@ public void messageReceived(DataNodeRequest request, TransportChannel channel, T
configuration,
request.aliasFilters(),
ActionListener.wrap(searchContexts -> {
assert ThreadPool.assertCurrentThreadPool(ESQL_THREAD_POOL_NAME);
Copy link
Member Author

Choose a reason for hiding this comment

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

Without the fix, the test EsqlActionIT#testRefreshSearchIdleShards trips this assertion .

Copy link
Member

Choose a reason for hiding this comment

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

👍

@dnhatn dnhatn marked this pull request as ready for review January 21, 2024 16:06
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 21, 2024
@@ -585,6 +594,7 @@ public void messageReceived(DataNodeRequest request, TransportChannel channel, T
configuration,
request.aliasFilters(),
ActionListener.wrap(searchContexts -> {
assert ThreadPool.assertCurrentThreadPool(ESQL_THREAD_POOL_NAME);
Copy link
Member

Choose a reason for hiding this comment

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

👍

@dnhatn
Copy link
Member Author

dnhatn commented Jan 25, 2024

Thanks, Nik!

@dnhatn dnhatn merged commit 3fb2893 into elastic:main Jan 25, 2024
15 checks passed
@dnhatn dnhatn deleted the esql-await-refresh branch January 25, 2024 15:37
@elasticsearchmachine
Copy link
Collaborator

elasticsearchmachine commented Jan 25, 2024

Backported to 8.12 in #104773

dnhatn added a commit to dnhatn/elasticsearch that referenced this pull request Jan 25, 2024
A recent report shows that we can perform ESQL planning on the refresh
thread pool after waiting for refreshes from search-idle shards. While
the planning process is generally lightweight, it may become expensive
at times. Therefore, we should fork off the refresh thread pool
immediately upon resuming ESQL execution. Another place where we should
fork off is after field_caps. I will look into that later.
henningandersen pushed a commit to henningandersen/elasticsearch that referenced this pull request Jan 25, 2024
A recent report shows that we can perform ESQL planning on the refresh 
thread pool after waiting for refreshes from search-idle shards. While
the planning process is generally lightweight, it may become expensive
at times. Therefore, we should fork off the refresh thread pool
immediately upon resuming ESQL execution. Another place where we should
fork off is after field_caps. I will look into that later.
dnhatn added a commit that referenced this pull request Jan 26, 2024
A recent report shows that we can perform ESQL planning on the refresh
thread pool after waiting for refreshes from search-idle shards. While
the planning process is generally lightweight, it may become expensive
at times. Therefore, we should fork off the refresh thread pool
immediately upon resuming ESQL execution. Another place where we should
fork off is after field_caps. I will look into that later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.12.1 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants