Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,6 @@ tests:
- class: org.elasticsearch.ingest.geoip.GeoIpDownloaderCliIT
method: testGeoIpDatabasesDownloadNoGeoipProcessors
issue: https://github.com/elastic/elasticsearch/issues/122683
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
method: testStopQueryLocal
issue: https://github.com/elastic/elasticsearch/issues/121672
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=snapshot/10_basic/Create a source only snapshot and then restore it}
issue: https://github.com/elastic/elasticsearch/issues/122755
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.elasticsearch.Build;
import org.elasticsearch.action.ActionFuture;
import org.elasticsearch.core.Tuple;
import org.elasticsearch.logging.LogManager;
import org.elasticsearch.logging.Logger;
import org.elasticsearch.tasks.TaskInfo;
import org.elasticsearch.xpack.core.async.AsyncStopRequest;

Expand All @@ -34,6 +36,8 @@

public class CrossClusterAsyncQueryStopIT extends AbstractCrossClusterTestCase {

private static final Logger LOGGER = LogManager.getLogger(CrossClusterAsyncQueryStopIT.class);

public void testStopQuery() throws Exception {
assumeTrue("Pragma does not work in release builds", Build.current().isSnapshot());
Map<String, Object> testClusterInfo = setupClusters(3);
Expand Down Expand Up @@ -136,8 +140,8 @@ public void testStopQueryLocal() throws Exception {
);

try {
// wait until we know that the query against 'remote-b:blocking' has started
SimplePauseFieldPlugin.startEmitting.await(30, TimeUnit.SECONDS);
// wait until we know that the local query against 'blocking' has started
assertTrue(SimplePauseFieldPlugin.startEmitting.await(30, TimeUnit.SECONDS));

// wait until the remotes are done
waitForCluster(client(), REMOTE_CLUSTER_1, asyncExecutionId);
Expand All @@ -147,20 +151,22 @@ public void testStopQueryLocal() throws Exception {
* the query against remotes should be finished
* the query against the local cluster should be running because it's blocked
*/

// run the stop query
AsyncStopRequest stopRequest = new AsyncStopRequest(asyncExecutionId);
LOGGER.info("Launching stop for {}", asyncExecutionId);
ActionFuture<EsqlQueryResponse> stopAction = client().execute(EsqlAsyncStopAction.INSTANCE, stopRequest);
// ensure stop operation is running
assertBusy(() -> {
try (EsqlQueryResponse asyncResponse = getAsyncResponse(client(), asyncExecutionId)) {
EsqlExecutionInfo executionInfo = asyncResponse.getExecutionInfo();
LOGGER.info("Waiting for stop operation to start, current status: {}", executionInfo);
assertNotNull(executionInfo);
assertThat(executionInfo.isStopped(), is(true));
}
});
// allow local query to proceed
SimplePauseFieldPlugin.allowEmitting.countDown();
LOGGER.info("Collecting results for {}", asyncExecutionId);

// Since part of the query has not been stopped, we expect some result to emerge here
try (EsqlQueryResponse asyncResponse = stopAction.actionGet(30, TimeUnit.SECONDS)) {
Expand Down Expand Up @@ -204,7 +210,6 @@ public void testStopQueryLocalNoRemotes() throws Exception {
populateRuntimeIndex(LOCAL_CLUSTER, "pause", INDEX_WITH_BLOCKING_MAPPING);

Tuple<Boolean, Boolean> includeCCSMetadata = randomIncludeCCSMetadata();
boolean responseExpectMeta = includeCCSMetadata.v2();

final String asyncExecutionId = startAsyncQuery(
client(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,16 @@ public int getClusterStateCount(Cluster.Status status) {

@Override
public String toString() {
return "EsqlExecutionInfo{" + "overallTook=" + overallTook + ", clusterInfo=" + clusterInfo + '}';
return "EsqlExecutionInfo{"
+ "overallTook="
+ overallTook
+ ", isPartial="
+ isPartial
+ ", isStopped="
+ isStopped
+ ", clusterInfo="
+ clusterInfo
+ '}';
}

@Override
Expand Down