diff --git a/server/src/main/java/org/opensearch/action/search/SearchContextIdForNode.java b/server/src/main/java/org/opensearch/action/search/SearchContextIdForNode.java index df655c39f845d..7f218a3b1a17e 100644 --- a/server/src/main/java/org/opensearch/action/search/SearchContextIdForNode.java +++ b/server/src/main/java/org/opensearch/action/search/SearchContextIdForNode.java @@ -45,12 +45,12 @@ * * @opensearch.internal */ -final class SearchContextIdForNode implements Writeable { +public final class SearchContextIdForNode implements Writeable { private final String node; private final ShardSearchContextId searchContextId; private final String clusterAlias; - SearchContextIdForNode(@Nullable String clusterAlias, String node, ShardSearchContextId searchContextId) { + public SearchContextIdForNode(@Nullable String clusterAlias, String node, ShardSearchContextId searchContextId) { this.node = node; this.clusterAlias = clusterAlias; this.searchContextId = searchContextId; diff --git a/server/src/main/java/org/opensearch/action/search/SearchUtils.java b/server/src/main/java/org/opensearch/action/search/SearchUtils.java index 96fcda0d491c9..148d1645568b1 100644 --- a/server/src/main/java/org/opensearch/action/search/SearchUtils.java +++ b/server/src/main/java/org/opensearch/action/search/SearchUtils.java @@ -8,7 +8,6 @@ package org.opensearch.action.search; -import org.opensearch.action.ActionListener; import org.opensearch.action.StepListener; import org.opensearch.cluster.ClusterState; import org.opensearch.cluster.node.DiscoveryNode; @@ -27,7 +26,7 @@ public SearchUtils() {} /** * Get connection lookup listener for list of clusters passed */ - public static ActionListener> getConnectionLookupListener( + public static StepListener> getConnectionLookupListener( RemoteClusterService remoteClusterService, ClusterState state, Set clusters diff --git a/server/src/main/java/org/opensearch/action/search/TransportCreatePitAction.java b/server/src/main/java/org/opensearch/action/search/TransportCreatePitAction.java index a393e0e36a092..6a7d0d614b41c 100644 --- a/server/src/main/java/org/opensearch/action/search/TransportCreatePitAction.java +++ b/server/src/main/java/org/opensearch/action/search/TransportCreatePitAction.java @@ -51,8 +51,7 @@ public TransportCreatePitAction( ClusterService clusterService, TransportSearchAction transportSearchAction, NamedWriteableRegistry namedWriteableRegistry, - PitService pitService - NamedWriteableRegistry namedWriteableRegistry, + PitService pitService, CreatePitController createPitController ) { super(CreatePitAction.NAME, transportService, actionFilters, in -> new CreatePitRequest(in)); @@ -68,13 +67,10 @@ public TransportCreatePitAction( @Override protected void doExecute(Task task, CreatePitRequest request, ActionListener listener) { CreatePitController controller = new CreatePitController( - request, searchTransportService, clusterService, transportSearchAction, namedWriteableRegistry, - task, - listener, pitService ); final StepListener createPitListener = new StepListener<>(); diff --git a/server/src/main/java/org/opensearch/search/DefaultSearchContext.java b/server/src/main/java/org/opensearch/search/DefaultSearchContext.java index 4d1d774ceb817..4bc40610facf2 100644 --- a/server/src/main/java/org/opensearch/search/DefaultSearchContext.java +++ b/server/src/main/java/org/opensearch/search/DefaultSearchContext.java @@ -49,6 +49,7 @@ import org.opensearch.common.lucene.search.Queries; import org.opensearch.common.unit.TimeValue; import org.opensearch.common.util.BigArrays; +import org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException; import org.opensearch.index.IndexService; import org.opensearch.index.IndexSettings; import org.opensearch.index.cache.bitset.BitsetFilterCache; @@ -309,7 +310,7 @@ public void preProcess(boolean rewrite) { int sliceLimit = indexService.getIndexSettings().getMaxSlicesPerPit(); int numSlices = sliceBuilder.getMax(); if (numSlices > sliceLimit) { - throw new IllegalArgumentException( + throw new OpenSearchRejectedExecutionException( "The number of slices [" + numSlices + "] is too large. It must " diff --git a/server/src/test/java/org/opensearch/search/DefaultSearchContextTests.java b/server/src/test/java/org/opensearch/search/DefaultSearchContextTests.java index 367257aaad5c6..98a5d34364632 100644 --- a/server/src/test/java/org/opensearch/search/DefaultSearchContextTests.java +++ b/server/src/test/java/org/opensearch/search/DefaultSearchContextTests.java @@ -52,6 +52,7 @@ import org.opensearch.common.util.BigArrays; import org.opensearch.common.util.MockBigArrays; import org.opensearch.common.util.MockPageCacheRecycler; +import org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException; import org.opensearch.index.IndexService; import org.opensearch.index.IndexSettings; import org.opensearch.index.cache.IndexCache; @@ -434,9 +435,9 @@ protected Engine.Searcher acquireSearcherInternal(String source) { when(sliceBuilder.getMax()).thenReturn(numSlicesForPit); context5.sliceBuilder(sliceBuilder); - exception = expectThrows(IllegalArgumentException.class, () -> context5.preProcess(false)); + OpenSearchRejectedExecutionException exception1 = expectThrows(OpenSearchRejectedExecutionException.class, () -> context5.preProcess(false)); assertThat( - exception.getMessage(), + exception1.getMessage(), equalTo( "The number of slices [" + numSlicesForPit