From 058b6e019c5b981cb8c638b9d77047b02ebfd151 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Fri, 11 Nov 2016 16:24:22 -0500 Subject: [PATCH] Tests: clean search scroll at the end of SearchCancellationIT Under some rare conditions search cancellation response might not fully clean scroll context. For now this commit adds the cleaning operation to the test, and we will address the root cause in https://github.com/elastic/elasticsearch/issues/21511 --- .../org/elasticsearch/search/SearchCancellationIT.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/search/SearchCancellationIT.java b/core/src/test/java/org/elasticsearch/search/SearchCancellationIT.java index b90adf34bad..840cdc8af6c 100644 --- a/core/src/test/java/org/elasticsearch/search/SearchCancellationIT.java +++ b/core/src/test/java/org/elasticsearch/search/SearchCancellationIT.java @@ -193,7 +193,12 @@ public class SearchCancellationIT extends ESIntegTestCase { awaitForBlock(plugins); cancelSearch(SearchAction.NAME); disableBlocks(plugins); - ensureSearchWasCancelled(searchResponse); + SearchResponse response = ensureSearchWasCancelled(searchResponse); + if (response != null) { + // The response might not have failed on all shards - we need to clean scroll + logger.info("Cleaning scroll with id {}", response.getScrollId()); + client().prepareClearScroll().addScrollId(response.getScrollId()).get(); + } }