Skip to content

Commit 7832b8c

Browse files
committed
Assert current thread in ESQL
This change adds more assertions for current thread in ESQL
1 parent 9e23c7e commit 7832b8c

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
@@ -365,6 +365,7 @@ public void analyzedPlan(
365365
QueryBuilder requestFilter,
366366
ActionListener<LogicalPlan> logicalPlanListener
367367
) {
368+
assert ThreadPool.assertCurrentThreadPool(ThreadPool.Names.SEARCH);
368369
if (parsed.analyzed()) {
369370
logicalPlanListener.onResponse(parsed);
370371
return;
@@ -448,6 +449,11 @@ private void preAnalyzeLookupIndex(
448449
String localPattern = lookupIndexPattern.indexPattern();
449450
assert RemoteClusterAware.isRemoteIndexName(localPattern) == false
450451
: "Lookup index name should not include remote, but got: " + localPattern;
452+
assert ThreadPool.assertCurrentThreadPool(
453+
ThreadPool.Names.SEARCH,
454+
ThreadPool.Names.SEARCH_COORDINATION,
455+
ThreadPool.Names.SYSTEM_READ
456+
);
451457
Set<String> fieldNames = result.wildcardJoinIndices().contains(localPattern) ? IndexResolver.ALL_FIELDS : result.fieldNames;
452458

453459
String patternWithRemotes;
@@ -633,6 +639,11 @@ private void preAnalyzeMainIndices(
633639
QueryBuilder requestFilter,
634640
ActionListener<PreAnalysisResult> listener
635641
) {
642+
assert ThreadPool.assertCurrentThreadPool(
643+
ThreadPool.Names.SEARCH,
644+
ThreadPool.Names.SEARCH_COORDINATION,
645+
ThreadPool.Names.SYSTEM_READ
646+
);
636647
// TODO we plan to support joins in the future when possible, but for now we'll just fail early if we see one
637648
List<IndexPattern> indices = preAnalysis.indices;
638649
if (indices.size() > 1) {

0 commit comments

Comments
 (0)