Skip to content

Commit 3c4992e

Browse files
committed
add wlm support for scroll API
Signed-off-by: Kaushal Kumar <[email protected]>
1 parent e7e19f7 commit 3c4992e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

server/src/main/java/org/opensearch/action/search/TransportSearchScrollAction.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
import org.opensearch.core.action.ActionListener;
4040
import org.opensearch.core.common.io.stream.Writeable;
4141
import org.opensearch.tasks.Task;
42+
import org.opensearch.threadpool.ThreadPool;
4243
import org.opensearch.transport.TransportService;
44+
import org.opensearch.wlm.QueryGroupTask;
4345

4446
/**
4547
* Perform the search scroll
@@ -51,24 +53,32 @@ public class TransportSearchScrollAction extends HandledTransportAction<SearchSc
5153
private final ClusterService clusterService;
5254
private final SearchTransportService searchTransportService;
5355
private final SearchPhaseController searchPhaseController;
56+
private final ThreadPool threadPool;
5457

5558
@Inject
5659
public TransportSearchScrollAction(
5760
TransportService transportService,
5861
ClusterService clusterService,
5962
ActionFilters actionFilters,
6063
SearchTransportService searchTransportService,
61-
SearchPhaseController searchPhaseController
64+
SearchPhaseController searchPhaseController,
65+
ThreadPool threadPool
6266
) {
6367
super(SearchScrollAction.NAME, transportService, actionFilters, (Writeable.Reader<SearchScrollRequest>) SearchScrollRequest::new);
6468
this.clusterService = clusterService;
6569
this.searchTransportService = searchTransportService;
6670
this.searchPhaseController = searchPhaseController;
71+
this.threadPool = threadPool;
6772
}
6873

6974
@Override
7075
protected void doExecute(Task task, SearchScrollRequest request, ActionListener<SearchResponse> listener) {
7176
try {
77+
78+
if (task instanceof QueryGroupTask) {
79+
((QueryGroupTask) task).setQueryGroupId(threadPool.getThreadContext());
80+
}
81+
7282
ParsedScrollId scrollId = TransportSearchHelper.parseScrollId(request.scrollId());
7383
Runnable action;
7484
switch (scrollId.getType()) {

0 commit comments

Comments
 (0)