Skip to content

Commit

Permalink
Fix failure in SearchCancellationIT.testMSearchChildReqCancellationWi…
Browse files Browse the repository at this point in the history
…thHybridTimeout (opensearch-project#1105)

In some cases as one shared with issue opensearch-project#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>
  • Loading branch information
sohami authored Aug 17, 2021
1 parent 8af1b91 commit 55c1026
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public void testMSearchChildRequestCancellationWithClusterLevelTimeout() throws
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()))))
Expand Down Expand Up @@ -541,7 +541,7 @@ public void testMSearchChildReqCancellationWithHybridTimeout() throws Exception
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,
Expand Down

0 comments on commit 55c1026

Please sign in to comment.