Skip to content

Commit 5c5eb84

Browse files
Add some logging to CrossClusterIT#testCancel()
1 parent 49254b0 commit 5c5eb84

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ tests:
158158
- class: org.elasticsearch.xpack.ccr.FollowIndexSecurityIT
159159
method: testCleanShardFollowTaskAfterDeleteFollower
160160
issue: https://github.com/elastic/elasticsearch/issues/120339
161-
- class: org.elasticsearch.search.ccs.CrossClusterIT
162-
method: testCancel
163-
issue: https://github.com/elastic/elasticsearch/issues/108061
164161
- class: org.elasticsearch.reservedstate.service.FileSettingsServiceTests
165162
method: testInvalidJSON
166163
issue: https://github.com/elastic/elasticsearch/issues/120482

server/src/internalClusterTest/java/org/elasticsearch/search/ccs/CrossClusterIT.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,11 @@ public void testCancel() throws Exception {
240240
PlainActionFuture<SearchResponse> queryFuture = new PlainActionFuture<>();
241241
SearchRequest searchRequest = new SearchRequest("demo", "cluster_a:prod");
242242
searchRequest.allowPartialSearchResults(false);
243-
searchRequest.setCcsMinimizeRoundtrips(randomBoolean());
243+
boolean minimizeRoundTrips = randomBoolean();
244+
searchRequest.setCcsMinimizeRoundtrips(minimizeRoundTrips);
244245
searchRequest.source(new SearchSourceBuilder().query(new MatchAllQueryBuilder()).size(1000));
246+
logger.info("Beginning search with mrt=" + minimizeRoundTrips);
247+
245248
client(LOCAL_CLUSTER).search(searchRequest, queryFuture);
246249
SearchListenerPlugin.waitSearchStarted();
247250
// Get the search task and cancelled
@@ -271,18 +274,23 @@ public void testCancel() throws Exception {
271274
});
272275

273276
for (TaskInfo taskInfo : remoteClusterSearchTasks.get()) {
277+
logger.info("Checking for task's cancellation: " + taskInfo.taskId());
274278
assertFalse("taskInfo is cancelled: " + taskInfo, taskInfo.cancelled());
275279
}
276280

277281
final CancelTasksRequest cancelRequest = new CancelTasksRequest().setTargetTaskId(rootTask.taskId());
278-
cancelRequest.setWaitForCompletion(randomBoolean());
282+
boolean waitForCompletion = randomBoolean();
283+
cancelRequest.setWaitForCompletion(waitForCompletion);
284+
logger.info("Cancelling task with waitForCompletion=" + waitForCompletion);
285+
279286
final ActionFuture<ListTasksResponse> cancelFuture = client().admin().cluster().cancelTasks(cancelRequest);
280287
assertBusy(() -> {
281288
final Iterable<TransportService> transportServices = cluster("cluster_a").getInstances(TransportService.class);
282289
for (TransportService transportService : transportServices) {
283290
Collection<CancellableTask> cancellableTasks = transportService.getTaskManager().getCancellableTasks().values();
284291
for (CancellableTask cancellableTask : cancellableTasks) {
285292
if (cancellableTask.getAction().contains(TransportSearchAction.TYPE.name())) {
293+
logger.info("Cancelled task: " + cancellableTask);
286294
assertTrue(cancellableTask.getDescription(), cancellableTask.isCancelled());
287295
}
288296
}
@@ -296,12 +304,15 @@ public void testCancel() throws Exception {
296304
.getTasks()
297305
.stream()
298306
.filter(t -> t.action().startsWith("indices:data/read/search"))
299-
.collect(Collectors.toList());
307+
.toList();
308+
309+
logger.info("Remote search tasks after cancellation: " + remoteSearchTasksAfterCancellation.size());
300310
for (TaskInfo taskInfo : remoteSearchTasksAfterCancellation) {
301311
assertTrue(taskInfo.description(), taskInfo.cancelled());
302312
}
303313

304314
SearchListenerPlugin.allowQueryPhase();
315+
logger.info("Query phase resumed");
305316
try {
306317
queryFuture.get();
307318
fail("query should have failed");

0 commit comments

Comments
 (0)