Skip to content

Commit bb0af40

Browse files
committed
Fix failure in SearchCancellationIT.testMSearchChildReqCancellationWithHybridTimeout
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 <[email protected]>
1 parent 8af1b91 commit bb0af40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/internalClusterTest/java/org/opensearch/search/SearchCancellationIT.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ public void testMSearchChildRequestCancellationWithClusterLevelTimeout() throws
509509
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(Settings.builder()
510510
.put(SEARCH_CANCEL_AFTER_TIME_INTERVAL_SETTING_KEY, cancellationTimeout)
511511
.build()).get();
512-
ActionFuture<MultiSearchResponse> mSearchResponse = client().prepareMultiSearch()
512+
ActionFuture<MultiSearchResponse> mSearchResponse = client().prepareMultiSearch().setMaxConcurrentSearchRequests(2)
513513
.add(client().prepareSearch("test").setAllowPartialSearchResults(randomBoolean())
514514
.setQuery(scriptQuery(new Script(ScriptType.INLINE, "mockscript", ScriptedBlockPlugin.SCRIPT_NAME,
515515
Collections.emptyMap()))))
@@ -541,7 +541,7 @@ public void testMSearchChildReqCancellationWithHybridTimeout() throws Exception
541541
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(Settings.builder()
542542
.put(SEARCH_CANCEL_AFTER_TIME_INTERVAL_SETTING_KEY, clusterCancellationTimeout)
543543
.build()).get();
544-
ActionFuture<MultiSearchResponse> mSearchResponse = client().prepareMultiSearch()
544+
ActionFuture<MultiSearchResponse> mSearchResponse = client().prepareMultiSearch().setMaxConcurrentSearchRequests(3)
545545
.add(client().prepareSearch("test").setAllowPartialSearchResults(randomBoolean())
546546
.setCancelAfterTimeInterval(reqCancellationTimeout)
547547
.setQuery(scriptQuery(new Script(ScriptType.INLINE, "mockscript", ScriptedBlockPlugin.SCRIPT_NAME,

0 commit comments

Comments
 (0)