Skip to content

Commit 9099005

Browse files
authored
Assert current thread in ESQL (#132324)
This change adds more assertions for current thread in ESQL
1 parent 829fb56 commit 9099005

File tree

1 file changed

+11
-0
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session

1 file changed

+11
-0
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ public void analyzedPlan(
364364
QueryBuilder requestFilter,
365365
ActionListener<LogicalPlan> logicalPlanListener
366366
) {
367+
assert ThreadPool.assertCurrentThreadPool(ThreadPool.Names.SEARCH);
367368
if (parsed.analyzed()) {
368369
logicalPlanListener.onResponse(parsed);
369370
return;
@@ -440,6 +441,11 @@ private void preAnalyzeLookupIndex(
440441
String localPattern = lookupIndexPattern.indexPattern();
441442
assert RemoteClusterAware.isRemoteIndexName(localPattern) == false
442443
: "Lookup index name should not include remote, but got: " + localPattern;
444+
assert ThreadPool.assertCurrentThreadPool(
445+
ThreadPool.Names.SEARCH,
446+
ThreadPool.Names.SEARCH_COORDINATION,
447+
ThreadPool.Names.SYSTEM_READ
448+
);
443449
Set<String> fieldNames = result.wildcardJoinIndices().contains(localPattern) ? IndexResolver.ALL_FIELDS : result.fieldNames;
444450

445451
String patternWithRemotes;
@@ -625,6 +631,11 @@ private void preAnalyzeMainIndices(
625631
QueryBuilder requestFilter,
626632
ActionListener<PreAnalysisResult> listener
627633
) {
634+
assert ThreadPool.assertCurrentThreadPool(
635+
ThreadPool.Names.SEARCH,
636+
ThreadPool.Names.SEARCH_COORDINATION,
637+
ThreadPool.Names.SYSTEM_READ
638+
);
628639
// TODO we plan to support joins in the future when possible, but for now we'll just fail early if we see one
629640
List<IndexPattern> indices = preAnalysis.indices;
630641
if (indices.size() > 1) {

0 commit comments

Comments
 (0)