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 @@ -239,9 +239,6 @@ tests:
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
method: testEnrichExplosionManyMatches
issue: https://github.com/elastic/elasticsearch/issues/122913
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
method: testStopQueryLocal
issue: https://github.com/elastic/elasticsearch/issues/121672
- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT
method: testRestoredIndexManagedByLocalPolicySkipsIllegalActions
issue: https://github.com/elastic/elasticsearch/issues/123202
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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason?

Copy link
Contributor Author

@smalyshev smalyshev Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's never actually used. I just noticed it now.


final String asyncExecutionId = startAsyncQuery(
client(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,16 @@ public Stream<Cluster> getClusterStates(Cluster.Status status) {

@Override
public String toString() {
return "EsqlExecutionInfo{" + "overallTook=" + overallTook + ", clusterInfo=" + clusterInfo + '}';
return "EsqlExecutionInfo{"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this doesn't have any unintended side-effects (it shouldn't, TBH).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't rely on these in tests - or anywhere more important - but if something will pop up I'll fix it. We added some stuff to EsqlExecutionInfo but never updated this, and now I need it for logging.

+ "overallTook="
+ overallTook
+ ", isPartial="
+ isPartial
+ ", isStopped="
+ isStopped
+ ", clusterInfo="
+ clusterInfo
+ '}';
}

@Override
Expand Down