Skip to content

Commit 5ef4a27

Browse files
authored
Use search_coordination threadpool in field caps (#79378)
Relates #79212
1 parent 8901a99 commit 5ef4a27

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

server/src/main/java/org/elasticsearch/action/fieldcaps/TransportFieldCapabilitiesAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public TransportFieldCapabilitiesAction(TransportService transportService,
7171
this.fieldCapabilitiesFetcher = new FieldCapabilitiesFetcher(indicesService);
7272
final Set<String> metadataFields = indicesService.getAllMetadataFields();
7373
this.metadataFieldPred = metadataFields::contains;
74-
transportService.registerRequestHandler(ACTION_NODE_NAME, ThreadPool.Names.MANAGEMENT,
74+
transportService.registerRequestHandler(ACTION_NODE_NAME, ThreadPool.Names.SEARCH_COORDINATION,
7575
FieldCapabilitiesNodeRequest::new, new NodeTransportHandler());
7676
}
7777

@@ -111,7 +111,7 @@ protected void doExecute(Task task, FieldCapabilitiesRequest request, final Acti
111111
localIndices,
112112
nowInMillis,
113113
concreteIndices,
114-
threadPool.executor(ThreadPool.Names.MANAGEMENT),
114+
threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION),
115115
indexResponse -> indexResponses.putIfAbsent(indexResponse.getIndexName(), indexResponse),
116116
indexFailures::collect,
117117
countDown
@@ -163,7 +163,7 @@ private Runnable createResponseMerger(FieldCapabilitiesRequest request,
163163
if (request.isMergeResults()) {
164164
// fork off to the management pool for merging the responses as the operation can run for longer than is acceptable
165165
// on a transport thread in case of large numbers of indices and/or fields
166-
threadPool.executor(ThreadPool.Names.MANAGEMENT).submit(
166+
threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION).submit(
167167
ActionRunnable.supply(
168168
listener,
169169
() -> merge(indexResponses, request.includeUnmapped(), new ArrayList<>(failures)))

server/src/test/java/org/elasticsearch/action/fieldcaps/RequestDispatcherTests.java

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import org.elasticsearch.threadpool.TestThreadPool;
5656
import org.elasticsearch.threadpool.ThreadPool;
5757
import org.elasticsearch.transport.Transport;
58-
import org.elasticsearch.transport.TransportException;
5958
import org.elasticsearch.transport.TransportInterceptor;
6059
import org.elasticsearch.transport.TransportRequest;
6160
import org.elasticsearch.transport.TransportRequestOptions;
@@ -133,7 +132,7 @@ public void testHappyCluster() throws Exception {
133132
OriginalIndices.NONE,
134133
randomNonNegativeLong(),
135134
indices.toArray(new String[0]),
136-
transportService.threadPool.executor(ThreadPool.Names.MANAGEMENT),
135+
transportService.threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION),
137136
responseCollector::addIndexResponse,
138137
responseCollector::addIndexFailure,
139138
responseCollector::onComplete);
@@ -199,7 +198,7 @@ public void testRetryThenOk() throws Exception {
199198
OriginalIndices.NONE,
200199
randomNonNegativeLong(),
201200
indices.toArray(new String[0]),
202-
transportService.threadPool.executor(ThreadPool.Names.MANAGEMENT),
201+
transportService.threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION),
203202
responseCollector::addIndexResponse,
204203
responseCollector::addIndexFailure,
205204
responseCollector::onComplete
@@ -317,7 +316,7 @@ public void testRetryButFails() throws Exception {
317316
OriginalIndices.NONE,
318317
randomNonNegativeLong(),
319318
indices.toArray(new String[0]),
320-
transportService.threadPool.executor(ThreadPool.Names.MANAGEMENT),
319+
transportService.threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION),
321320
responseCollector::addIndexResponse,
322321
responseCollector::addIndexFailure,
323322
responseCollector::onComplete);
@@ -435,7 +434,7 @@ public void testSuccessWithAnyMatch() throws Exception {
435434
OriginalIndices.NONE,
436435
randomNonNegativeLong(),
437436
indices.toArray(new String[0]),
438-
transportService.threadPool.executor(ThreadPool.Names.MANAGEMENT),
437+
transportService.threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION),
439438
responseCollector::addIndexResponse,
440439
responseCollector::addIndexFailure,
441440
responseCollector::onComplete);
@@ -524,7 +523,7 @@ public void testStopAfterAllShardsUnmatched() throws Exception {
524523
OriginalIndices.NONE,
525524
randomNonNegativeLong(),
526525
indices.toArray(new String[0]),
527-
transportService.threadPool.executor(ThreadPool.Names.MANAGEMENT),
526+
transportService.threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION),
528527
responseCollector::addIndexResponse,
529528
responseCollector::addIndexFailure,
530529
responseCollector::onComplete
@@ -753,7 +752,7 @@ protected void doClose() throws IOException {
753752

754753
@SuppressWarnings("unchecked")
755754
<T extends TransportResponse> void sendResponse(TransportResponseHandler<T> handler, TransportResponse resp) {
756-
threadPool.executor(ThreadPool.Names.MANAGEMENT).submit(new AbstractRunnable() {
755+
threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION).submit(new AbstractRunnable() {
757756
@Override
758757
public void onFailure(Exception e) {
759758
throw new AssertionError(e);
@@ -765,20 +764,6 @@ protected void doRun() {
765764
}
766765
});
767766
}
768-
769-
<T extends TransportResponse> void sendFailure(TransportResponseHandler<T> handler, Exception e) {
770-
threadPool.executor(ThreadPool.Names.MANAGEMENT).submit(new AbstractRunnable() {
771-
@Override
772-
public void onFailure(Exception e) {
773-
throw new AssertionError(e);
774-
}
775-
776-
@Override
777-
protected void doRun() {
778-
handler.handleException(new TransportException(e));
779-
}
780-
});
781-
}
782767
}
783768

784769
static FieldCapabilitiesRequest randomFieldCapRequest(boolean withFilter) {

0 commit comments

Comments
 (0)