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 <sohami.apache@gmail.com>
This commit is contained in:
Sorabh 2021-08-17 13:23:55 -07:00 committed by GitHub
parent 8af1b91b7b
commit 55c1026bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<MultiSearchResponse> mSearchResponse = client().prepareMultiSearch()
ActionFuture<MultiSearchResponse> 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<MultiSearchResponse> mSearchResponse = client().prepareMultiSearch()
ActionFuture<MultiSearchResponse> mSearchResponse = client().prepareMultiSearch().setMaxConcurrentSearchRequests(3)
.add(client().prepareSearch("test").setAllowPartialSearchResults(randomBoolean())
.setCancelAfterTimeInterval(reqCancellationTimeout)
.setQuery(scriptQuery(new Script(ScriptType.INLINE, "mockscript", ScriptedBlockPlugin.SCRIPT_NAME,