Skip to content

Commit d58d6e6

Browse files
committed
We can not eliminate some filtered runtime calls since there could be missing indices
So we have to drop FILTERED status for now
1 parent a51bf2a commit d58d6e6

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/CrossClusterQueryWithFiltersIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public void testTimestampFilterFromQuery() {
157157
assertClusterMetadataSuccess(localCluster, localShards, overallTookMillis, "logs-1");
158158

159159
EsqlExecutionInfo.Cluster remoteCluster = executionInfo.getCluster(REMOTE_CLUSTER_1);
160-
assertClusterMetadataNoShards(remoteCluster, remoteShards, overallTookMillis, "logs-2");
160+
assertClusterMetadataSkippedShards(remoteCluster, remoteShards, overallTookMillis, "logs-2");
161161
}
162162

163163
// Only remote is included
@@ -221,7 +221,7 @@ public void testTimestampFilterFromQuery() {
221221

222222
EsqlExecutionInfo.Cluster remoteCluster = executionInfo.getCluster(REMOTE_CLUSTER_1);
223223
// Remote has no shards due to filter
224-
assertClusterMetadataNoShards(remoteCluster, remoteShards, overallTookMillis, "logs-2");
224+
assertClusterMetadataSkippedShards(remoteCluster, remoteShards, overallTookMillis, "logs-2");
225225

226226
EsqlExecutionInfo.Cluster localCluster = executionInfo.getCluster(LOCAL_CLUSTER);
227227
// Local cluster can not be filtered out for now
@@ -245,7 +245,7 @@ public void testTimestampFilterFromQuery() {
245245

246246
EsqlExecutionInfo.Cluster remoteCluster = executionInfo.getCluster(REMOTE_CLUSTER_1);
247247
// Remote has no shards due to filter
248-
assertClusterMetadataNoShards(remoteCluster, remoteShards, overallTookMillis, "logs-*");
248+
assertClusterMetadataSkippedShards(remoteCluster, remoteShards, overallTookMillis, "logs-*");
249249

250250
EsqlExecutionInfo.Cluster localCluster = executionInfo.getCluster(LOCAL_CLUSTER);
251251
// Local cluster can not be filtered out for now

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfo.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ public static class Cluster implements ToXContentFragment, Writeable {
394394
public enum Status {
395395
RUNNING, // still running
396396
SUCCESSFUL, // all shards completed search
397-
FILTERED, // all shards were filtered out, temporary status for planning
398397
PARTIAL, // only some shards completed the search, partial results from cluster
399398
SKIPPED, // entire cluster was skipped
400399
FAILED; // search was failed due to errors on this cluster

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlCCSUtils.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ static void updateExecutionInfoWithClustersWithNoMatchingIndices(
208208
* Mark it as SKIPPED with 0 shards searched and took=0.
209209
*/
210210
for (String c : clustersWithNoMatchingIndices) {
211-
if (executionInfo.getCluster(c).getStatus() != Cluster.Status.RUNNING
212-
&& executionInfo.getCluster(c).getStatus() != Cluster.Status.FILTERED) {
211+
if (executionInfo.getCluster(c).getStatus() != Cluster.Status.RUNNING) {
213212
// if cluster was already in the terminal state and not filtered, do not overwrite
214213
continue;
215214
}
@@ -224,21 +223,14 @@ static void updateExecutionInfoWithClustersWithNoMatchingIndices(
224223
} else {
225224
fatalErrorMessage += "; " + error;
226225
}
227-
if (filter != null) {
228-
// Use filtered status here because we still need to check it on the second lookup without the filter
229-
// to ensure this index is real.
230-
markClusterWithFinalStateAndNoShards(executionInfo, c, Cluster.Status.FILTERED, null);
231-
} else {
226+
if (filter == null) {
232227
markClusterWithFinalStateAndNoShards(executionInfo, c, Cluster.Status.FAILED, new VerificationException(error));
233228
}
234229
} else {
235230
// no matching indices and no concrete index requested - just mark it as done, no error
236-
markClusterWithFinalStateAndNoShards(
237-
executionInfo,
238-
c,
239-
filter != null ? Cluster.Status.FILTERED : Cluster.Status.SUCCESSFUL,
240-
null
241-
);
231+
if (indexResolution.isValid()) {
232+
markClusterWithFinalStateAndNoShards(executionInfo, c, Cluster.Status.SUCCESSFUL, null);
233+
}
242234
}
243235
}
244236
if (fatalErrorMessage != null) {
@@ -286,9 +278,6 @@ static void updateExecutionInfoAtEndOfPlanning(EsqlExecutionInfo execInfo) {
286278
.build()
287279
);
288280
}
289-
if (cluster.getStatus() == Cluster.Status.FILTERED) {
290-
markClusterWithFinalStateAndNoShards(execInfo, clusterAlias, Cluster.Status.SUCCESSFUL, null);
291-
}
292281
}
293282
}
294283
}

0 commit comments

Comments
 (0)