Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: stabilize SqlSearchPageTimeoutIT #79928

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.elasticsearch.search.SearchService;

import java.util.Arrays;
import java.util.concurrent.TimeUnit;

import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.contains;
Expand All @@ -28,7 +27,7 @@ public class SqlSearchPageTimeoutIT extends AbstractSqlIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
Settings.Builder settings = Settings.builder().put(super.nodeSettings(nodeOrdinal, otherSettings));
// use static low keepAlive interval to ensure obsolete search contexts are pruned soon enough
settings.put(SearchService.KEEPALIVE_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(200));
settings.put(SearchService.KEEPALIVE_INTERVAL_SETTING.getKey(), TimeValue.timeValueMillis(100));
return settings.build();
}

Expand All @@ -37,14 +36,13 @@ public void testSearchContextIsCleanedUpAfterPageTimeoutForHitsQueries() throws

SqlQueryResponse response = new SqlQueryRequestBuilder(client(), SqlQueryAction.INSTANCE).query("SELECT field FROM test")
.fetchSize(1)
.pageTimeout(TimeValue.timeValueMillis(100))
.pageTimeout(TimeValue.timeValueMillis(500))
.get();

assertEquals(1, response.size());
assertTrue(response.hasCursor());
assertEquals(1, getNumberOfSearchContexts());

assertBusy(() -> assertEquals(0, getNumberOfSearchContexts()), 3, TimeUnit.SECONDS);
assertBusy(() -> assertEquals(0, getNumberOfSearchContexts()));

SearchPhaseExecutionException exception = expectThrows(
SearchPhaseExecutionException.class,
Expand All @@ -59,7 +57,7 @@ public void testNoSearchContextForAggregationQueries() throws InterruptedExcepti

SqlQueryResponse response = new SqlQueryRequestBuilder(client(), SqlQueryAction.INSTANCE).query(
"SELECT COUNT(*) FROM test GROUP BY field"
).fetchSize(1).pageTimeout(TimeValue.timeValueMillis(100)).get();
).fetchSize(1).pageTimeout(TimeValue.timeValueMillis(500)).get();

assertEquals(1, response.size());
assertTrue(response.hasCursor());
Expand Down