Skip to content

[9.0] Cancel expired async search task when a remote returns its results (#126583) #126915

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

Merged
merged 1 commit into from
Apr 16, 2025
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
5 changes: 5 additions & 0 deletions docs/changelog/126583.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 126583
summary: Cancel expired async search task when a remote returns its results
area: CCS
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void resetSearchListenerPlugin() {
}

private SubmitAsyncSearchRequest makeSearchRequest(String... indices) {
CrossClusterAsyncSearchIT.SearchListenerPlugin.blockQueryPhase();
CrossClusterAsyncSearchIT.SearchListenerPlugin.blockLocalQueryPhase();

SubmitAsyncSearchRequest request = new SubmitAsyncSearchRequest(indices);
request.setCcsMinimizeRoundtrips(randomBoolean());
Expand Down Expand Up @@ -220,7 +220,8 @@ public void testCancelledSearch() throws Exception {
String remoteIndex = (String) testClusterInfo.get("remote.index");

SubmitAsyncSearchRequest searchRequest = makeSearchRequest(localIndex, REMOTE1 + ":" + remoteIndex);
CrossClusterAsyncSearchIT.SearchListenerPlugin.blockQueryPhase();
CrossClusterAsyncSearchIT.SearchListenerPlugin.blockLocalQueryPhase();
CrossClusterAsyncSearchIT.SearchListenerPlugin.blockRemoteQueryPhase();

String nodeName = cluster(LOCAL_CLUSTER).getRandomNodeName();
final AsyncSearchResponse response = cluster(LOCAL_CLUSTER).client(nodeName)
Expand All @@ -232,7 +233,8 @@ public void testCancelledSearch() throws Exception {
response.decRef();
assertTrue(response.isRunning());
}
CrossClusterAsyncSearchIT.SearchListenerPlugin.waitSearchStarted();
CrossClusterAsyncSearchIT.SearchListenerPlugin.waitLocalSearchStarted();
CrossClusterAsyncSearchIT.SearchListenerPlugin.waitRemoteSearchStarted();

ActionFuture<ListTasksResponse> cancelFuture;
try {
Expand Down Expand Up @@ -290,7 +292,8 @@ public void testCancelledSearch() throws Exception {
assertTrue(taskInfo.description(), taskInfo.cancelled());
}
} finally {
CrossClusterAsyncSearchIT.SearchListenerPlugin.allowQueryPhase();
CrossClusterAsyncSearchIT.SearchListenerPlugin.allowLocalQueryPhase();
CrossClusterAsyncSearchIT.SearchListenerPlugin.allowRemoteQueryPhase();
}

assertBusy(() -> assertTrue(cancelFuture.isDone()));
Expand All @@ -314,7 +317,7 @@ private CCSTelemetrySnapshot getTelemetrySnapshot(String nodeName) {
}

private Map<String, Object> setupClusters() {
String localIndex = "demo";
String localIndex = "local";
int numShardsLocal = randomIntBetween(2, 10);
Settings localSettings = indexSettings(numShardsLocal, randomIntBetween(0, 1)).build();
assertAcked(
Expand All @@ -326,7 +329,7 @@ private Map<String, Object> setupClusters() {
);
indexDocs(client(LOCAL_CLUSTER), localIndex);

String remoteIndex = "prod";
String remoteIndex = "remote";
int numShardsRemote = randomIntBetween(2, 10);
for (String clusterAlias : remoteClusterAlias()) {
final InternalTestCluster remoteCluster = cluster(clusterAlias);
Expand Down
Loading