From 55c1026bb6ccb847e790503d26ca17164d7a525e Mon Sep 17 00:00:00 2001 From: Sorabh Date: Tue, 17 Aug 2021 13:23:55 -0700 Subject: [PATCH] Fix failure in SearchCancellationIT.testMSearchChildReqCancellationWithHybridTimeout (#1105) In some cases as one shared with issue #1099, the maxConcurrentSearchRequests was chosen as 0 which will compute the final value during execution of the request based on processor counts. When this computed value is less than number of search request in msearch request, it will execute all the requests in multiple iterations causing the failure since test will only wait for one such iteration. Hence setting the maxConcurrentSearchRequests explicitly to number of search requests being added in the test to ensure correct behavior Signed-off-by: Sorabh Hamirwasia --- .../java/org/opensearch/search/SearchCancellationIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/search/SearchCancellationIT.java b/server/src/internalClusterTest/java/org/opensearch/search/SearchCancellationIT.java index 0dfa9e1cf96..47ed98230c2 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/SearchCancellationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/SearchCancellationIT.java @@ -509,7 +509,7 @@ public class SearchCancellationIT extends OpenSearchIntegTestCase { client().admin().cluster().prepareUpdateSettings().setPersistentSettings(Settings.builder() .put(SEARCH_CANCEL_AFTER_TIME_INTERVAL_SETTING_KEY, cancellationTimeout) .build()).get(); - ActionFuture mSearchResponse = client().prepareMultiSearch() + ActionFuture mSearchResponse = client().prepareMultiSearch().setMaxConcurrentSearchRequests(2) .add(client().prepareSearch("test").setAllowPartialSearchResults(randomBoolean()) .setQuery(scriptQuery(new Script(ScriptType.INLINE, "mockscript", ScriptedBlockPlugin.SCRIPT_NAME, Collections.emptyMap())))) @@ -541,7 +541,7 @@ public class SearchCancellationIT extends OpenSearchIntegTestCase { client().admin().cluster().prepareUpdateSettings().setPersistentSettings(Settings.builder() .put(SEARCH_CANCEL_AFTER_TIME_INTERVAL_SETTING_KEY, clusterCancellationTimeout) .build()).get(); - ActionFuture mSearchResponse = client().prepareMultiSearch() + ActionFuture mSearchResponse = client().prepareMultiSearch().setMaxConcurrentSearchRequests(3) .add(client().prepareSearch("test").setAllowPartialSearchResults(randomBoolean()) .setCancelAfterTimeInterval(reqCancellationTimeout) .setQuery(scriptQuery(new Script(ScriptType.INLINE, "mockscript", ScriptedBlockPlugin.SCRIPT_NAME,