Skip to content

Commit d8477e9

Browse files
committed
iter
1 parent 68c78f2 commit d8477e9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

server/src/main/java/org/elasticsearch/node/NodeConstruction.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,10 @@ private void construct(
712712
ClusterService clusterService = createClusterService(settingsModule, threadPool, taskManager);
713713
clusterService.addStateApplier(scriptService);
714714

715-
var executor = (TaskExecutionTimeTrackingPerIndexEsThreadPoolExecutor) threadPool.executor(ThreadPool.Names.SEARCH);
716-
clusterService.addListener(new SearchIndexTimeTrackingCleanupService(executor));
717-
715+
var executor = threadPool.executor(ThreadPool.Names.SEARCH);
716+
if (executor instanceof TaskExecutionTimeTrackingPerIndexEsThreadPoolExecutor perIndexExecutor) {
717+
clusterService.addListener(new SearchIndexTimeTrackingCleanupService(perIndexExecutor));
718+
}
718719
modules.bindToInstance(DocumentParsingProvider.class, documentParsingProvider);
719720

720721
FailureStoreMetrics failureStoreMetrics = new FailureStoreMetrics(telemetryProvider.getMeterRegistry());

server/src/main/java/org/elasticsearch/search/query/QueryPhase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static void addCollectorsAndSearch(SearchContext searchContext) throws QueryPhas
226226
queryResult.terminatedEarly(queryPhaseResult.terminatedAfter());
227227
}
228228
ExecutorService executor = searchContext.indexShard().getThreadPool().executor(ThreadPool.Names.SEARCH);
229-
assert executor instanceof TaskExecutionTimeTrackingEsThreadPoolExecutor // TODO MP check this
229+
assert executor instanceof TaskExecutionTimeTrackingEsThreadPoolExecutor
230230
|| (executor instanceof EsThreadPoolExecutor == false /* in case thread pool is mocked out in tests */)
231231
: "SEARCH threadpool should have an executor that exposes EWMA metrics, but is of type " + executor.getClass();
232232
if (executor instanceof TaskExecutionTimeTrackingEsThreadPoolExecutor rExecutor) {

0 commit comments

Comments
 (0)