Skip to content

Commit

Permalink
add wlm support for scroll API
Browse files Browse the repository at this point in the history
Signed-off-by: Kaushal Kumar <[email protected]>
  • Loading branch information
kaushalmahi12 committed Jan 8, 2025
1 parent e7e19f7 commit 3c4992e
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
import org.opensearch.core.action.ActionListener;
import org.opensearch.core.common.io.stream.Writeable;
import org.opensearch.tasks.Task;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;
import org.opensearch.wlm.QueryGroupTask;

/**
* Perform the search scroll
Expand All @@ -51,24 +53,32 @@ public class TransportSearchScrollAction extends HandledTransportAction<SearchSc
private final ClusterService clusterService;
private final SearchTransportService searchTransportService;
private final SearchPhaseController searchPhaseController;
private final ThreadPool threadPool;

@Inject
public TransportSearchScrollAction(
TransportService transportService,
ClusterService clusterService,
ActionFilters actionFilters,
SearchTransportService searchTransportService,
SearchPhaseController searchPhaseController
SearchPhaseController searchPhaseController,
ThreadPool threadPool
) {
super(SearchScrollAction.NAME, transportService, actionFilters, (Writeable.Reader<SearchScrollRequest>) SearchScrollRequest::new);
this.clusterService = clusterService;
this.searchTransportService = searchTransportService;
this.searchPhaseController = searchPhaseController;
this.threadPool = threadPool;
}

@Override
protected void doExecute(Task task, SearchScrollRequest request, ActionListener<SearchResponse> listener) {
try {

if (task instanceof QueryGroupTask) {
((QueryGroupTask) task).setQueryGroupId(threadPool.getThreadContext());
}

ParsedScrollId scrollId = TransportSearchHelper.parseScrollId(request.scrollId());
Runnable action;
switch (scrollId.getType()) {
Expand Down

0 comments on commit 3c4992e

Please sign in to comment.