1010import org .elasticsearch .Build ;
1111import org .elasticsearch .action .ActionFuture ;
1212import org .elasticsearch .core .Tuple ;
13+ import org .elasticsearch .logging .LogManager ;
14+ import org .elasticsearch .logging .Logger ;
1315import org .elasticsearch .tasks .TaskInfo ;
1416import org .elasticsearch .xpack .core .async .AsyncStopRequest ;
1517
3436
3537public class CrossClusterAsyncQueryStopIT extends AbstractCrossClusterTestCase {
3638
39+ private static final Logger LOGGER = LogManager .getLogger (CrossClusterAsyncQueryStopIT .class );
40+
3741 public void testStopQuery () throws Exception {
3842 assumeTrue ("Pragma does not work in release builds" , Build .current ().isSnapshot ());
3943 Map <String , Object > testClusterInfo = setupClusters (3 );
@@ -136,8 +140,8 @@ public void testStopQueryLocal() throws Exception {
136140 );
137141
138142 try {
139- // wait until we know that the query against 'remote-b: blocking' has started
140- SimplePauseFieldPlugin .startEmitting .await (30 , TimeUnit .SECONDS );
143+ // wait until we know that the local query against 'blocking' has started
144+ assertTrue ( SimplePauseFieldPlugin .startEmitting .await (30 , TimeUnit .SECONDS ) );
141145
142146 // wait until the remotes are done
143147 waitForCluster (client (), REMOTE_CLUSTER_1 , asyncExecutionId );
@@ -147,20 +151,22 @@ public void testStopQueryLocal() throws Exception {
147151 * the query against remotes should be finished
148152 * the query against the local cluster should be running because it's blocked
149153 */
150-
151154 // run the stop query
152155 AsyncStopRequest stopRequest = new AsyncStopRequest (asyncExecutionId );
156+ LOGGER .info ("Launching stop for {}" , asyncExecutionId );
153157 ActionFuture <EsqlQueryResponse > stopAction = client ().execute (EsqlAsyncStopAction .INSTANCE , stopRequest );
154158 // ensure stop operation is running
155159 assertBusy (() -> {
156160 try (EsqlQueryResponse asyncResponse = getAsyncResponse (client (), asyncExecutionId )) {
157161 EsqlExecutionInfo executionInfo = asyncResponse .getExecutionInfo ();
162+ LOGGER .info ("Waiting for stop operation to start, current status: {}" , executionInfo );
158163 assertNotNull (executionInfo );
159164 assertThat (executionInfo .isStopped (), is (true ));
160165 }
161166 });
162167 // allow local query to proceed
163168 SimplePauseFieldPlugin .allowEmitting .countDown ();
169+ LOGGER .info ("Collecting results for {}" , asyncExecutionId );
164170
165171 // Since part of the query has not been stopped, we expect some result to emerge here
166172 try (EsqlQueryResponse asyncResponse = stopAction .actionGet (30 , TimeUnit .SECONDS )) {
@@ -204,7 +210,6 @@ public void testStopQueryLocalNoRemotes() throws Exception {
204210 populateRuntimeIndex (LOCAL_CLUSTER , "pause" , INDEX_WITH_BLOCKING_MAPPING );
205211
206212 Tuple <Boolean , Boolean > includeCCSMetadata = randomIncludeCCSMetadata ();
207- boolean responseExpectMeta = includeCCSMetadata .v2 ();
208213
209214 final String asyncExecutionId = startAsyncQuery (
210215 client (),
0 commit comments