Skip to content

Commit

Permalink
Merge branch 'createpitservice' of github.com:bharath-techie/OpenSear…
Browse files Browse the repository at this point in the history
…ch into deletepitservice
  • Loading branch information
bharath-techie committed Jul 19, 2022
2 parents 9497923 + 8fcc25c commit ab3f0d4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,7 +26,7 @@ public SearchUtils() {}
/**
* Get connection lookup listener for list of clusters passed
*/
public static ActionListener<BiFunction<String, String, DiscoveryNode>> getConnectionLookupListener(
public static StepListener<BiFunction<String, String, DiscoveryNode>> getConnectionLookupListener(
RemoteClusterService remoteClusterService,
ClusterState state,
Set<String> clusters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -68,13 +67,10 @@ public TransportCreatePitAction(
@Override
protected void doExecute(Task task, CreatePitRequest request, ActionListener<CreatePitResponse> listener) {
CreatePitController controller = new CreatePitController(
request,
searchTransportService,
clusterService,
transportSearchAction,
namedWriteableRegistry,
task,
listener,
pitService
);
final StepListener<SearchResponse> createPitListener = new StepListener<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ab3f0d4

Please sign in to comment.