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
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void testSearchesAgainstNonMatchingIndices() throws Exception {
List.of(
// local cluster is never marked as SKIPPED even when no matching indices - just marked as 0 shards searched
new ExpectedCluster(LOCAL_CLUSTER, indexLoc, EsqlExecutionInfo.Cluster.Status.SUCCESSFUL, localNumShards),
new ExpectedCluster(REMOTE_CLUSTER_1, "nomatch*", EsqlExecutionInfo.Cluster.Status.SKIPPED, 0)
new ExpectedCluster(REMOTE_CLUSTER_1, "nomatch*", EsqlExecutionInfo.Cluster.Status.SUCCESSFUL, 0)
)
);
}
Expand All @@ -358,7 +358,7 @@ public void testSearchesAgainstNonMatchingIndices() throws Exception {
List.of(
// LIMIT 0 searches always have total shards = 0
new ExpectedCluster(LOCAL_CLUSTER, indexLoc, EsqlExecutionInfo.Cluster.Status.SUCCESSFUL, 0),
new ExpectedCluster(REMOTE_CLUSTER_1, "nomatch*", EsqlExecutionInfo.Cluster.Status.SKIPPED, 0)
new ExpectedCluster(REMOTE_CLUSTER_1, "nomatch*", EsqlExecutionInfo.Cluster.Status.SUCCESSFUL, 0)
)
);
}
Expand Down Expand Up @@ -506,13 +506,13 @@ public void testSearchesWhereNonExistentClusterIsSpecifiedWithWildcards() throws
assertThat(executionInfo.isCrossClusterSearch(), is(true));
assertThat(executionInfo.overallTook().millis(), greaterThanOrEqualTo(0L));
assertThat(executionInfo.includeCCSMetadata(), equalTo(responseExpectMeta));
assertThat(executionInfo.isPartial(), equalTo(true));
assertThat(executionInfo.isPartial(), equalTo(false));

assertThat(executionInfo.clusterAliases(), equalTo(Set.of(REMOTE_CLUSTER_1, LOCAL_CLUSTER)));

EsqlExecutionInfo.Cluster remoteCluster = executionInfo.getCluster(REMOTE_CLUSTER_1);
assertThat(remoteCluster.getIndexExpression(), equalTo("no_such_index*"));
assertThat(remoteCluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SKIPPED));
assertThat(remoteCluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
assertThat(remoteCluster.getTook().millis(), greaterThanOrEqualTo(0L));
assertThat(remoteCluster.getTotalShards(), equalTo(0));
assertThat(remoteCluster.getSuccessfulShards(), equalTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.indices.IndicesExpressionGrouper;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.transport.ConnectTransportException;
Expand Down Expand Up @@ -219,29 +218,8 @@ static void updateExecutionInfoWithClustersWithNoMatchingIndices(EsqlExecutionIn
fatalErrorMessage += "; " + error;
}
} else {
// no matching indices and no concrete index requested - just skip it, no error
EsqlExecutionInfo.Cluster.Status status;
ShardSearchFailure failure;
if (c.equals(RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY)) {
// never mark local cluster as SKIPPED
status = EsqlExecutionInfo.Cluster.Status.SUCCESSFUL;
failure = null;
} else {
status = EsqlExecutionInfo.Cluster.Status.SKIPPED;
failure = new ShardSearchFailure(new VerificationException("Unknown index [" + indexExpression + "]"));
}
executionInfo.swapCluster(c, (k, v) -> {
var builder = new EsqlExecutionInfo.Cluster.Builder(v).setStatus(status)
.setTook(new TimeValue(0))
.setTotalShards(0)
.setSuccessfulShards(0)
.setSkippedShards(0)
.setFailedShards(0);
if (failure != null) {
builder.setFailures(List.of(failure));
}
return builder.build();
});
// no matching indices and no concrete index requested - just mark it as done, no error
markClusterWithFinalStateAndNoShards(executionInfo, c, Cluster.Status.SUCCESSFUL, null);
}
}
if (fatalErrorMessage != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ public void testUpdateExecutionInfoWithClustersWithNoMatchingIndices() {

EsqlExecutionInfo.Cluster remote1Cluster = executionInfo.getCluster(REMOTE1_ALIAS);
assertThat(remote1Cluster.getIndexExpression(), equalTo("*"));
assertThat(remote1Cluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SKIPPED));
assertThat(remote1Cluster.getTook().millis(), equalTo(0L));
assertThat(remote1Cluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
assertThat(remote1Cluster.getTook().millis(), greaterThanOrEqualTo(0L));
assertThat(remote1Cluster.getTotalShards(), equalTo(0));
assertThat(remote1Cluster.getSuccessfulShards(), equalTo(0));
assertThat(remote1Cluster.getSkippedShards(), equalTo(0));
Expand Down Expand Up @@ -356,8 +356,8 @@ public void testUpdateExecutionInfoWithClustersWithNoMatchingIndices() {

EsqlExecutionInfo.Cluster remote2Cluster = executionInfo.getCluster(REMOTE2_ALIAS);
assertThat(remote2Cluster.getIndexExpression(), equalTo("mylogs1*,mylogs2*,logs*"));
assertThat(remote2Cluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SKIPPED));
assertThat(remote2Cluster.getTook().millis(), equalTo(0L));
assertThat(remote2Cluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
assertThat(remote2Cluster.getTook().millis(), greaterThanOrEqualTo(0L));
assertThat(remote2Cluster.getTotalShards(), equalTo(0));
assertThat(remote2Cluster.getSuccessfulShards(), equalTo(0));
assertThat(remote2Cluster.getSkippedShards(), equalTo(0));
Expand Down