Skip to content

Conversation

@quux00
Copy link
Contributor

@quux00 quux00 commented Jan 15, 2025

For ES|QL, we are moving to limit the scope of the skip_unavailable setting for remote clusters.
Going forward, skip_unavailable will be considered for two scenarios:

  1. inability to connect to a remote cluster ("unavailable")
  2. whether to fail on execution time errors or not (inline with the upcoming allow_partial_search_results work for ES|QL)

This PR reverses the special plan-time handling for skip_unavailable=true clusters that was added in #116348. Remote clusters, regardless of their skip_unavailable setting, will now use the same logic as the local cluster for index expression analysis at plan time, namely:

  1. If any concrete index specified is missing from the cluster, a VerificationException will be thrown
  2. If no matching index/alias/datastream was found on any cluster (even if all were specified with a wildcard), a VerificationException will be thrown

Thus, we no longer require at least one matching index expression for skip_unavailable=false clusters either, as was done in the previous PR referenced above.

@quux00 quux00 added >non-issue auto-backport Automatically create backport pull requests when merged v9.0.0 v8.18.0 labels Jan 15, 2025
@quux00 quux00 force-pushed the esql-ccs/skip-unavailable-plan-time-removal branch 2 times, most recently from 9008195 to 93f6d26 Compare January 16, 2025 17:38
@quux00 quux00 force-pushed the esql-ccs/skip-unavailable-plan-time-removal branch from 002d89c to d5aea8c Compare January 16, 2025 20:21
@quux00 quux00 marked this pull request as ready for review January 16, 2025 20:21
@quux00 quux00 added Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL labels Jan 16, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

{
String q = "FROM nomatch*,cluster-a:nomatch*";
VerificationException e = expectThrows(VerificationException.class, () -> runQuery(q, requestIncludeMeta));
assertThat(e.getDetailedMessage(), containsString("Unknown index [cluster-a:nomatch*,nomatch*]"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting note here: why is the order not kept? User specified nomatch*,cluster-a:nomatch*.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ordering seems to happen in RemoteClusterAware#groupClusterIndices().

e = expectThrows(VerificationException.class, () -> runQuery(limit0, requestIncludeMeta));
assertThat(e.getDetailedMessage(), containsString("Unknown index [cluster-a:nomatch,nomatch*]"));
}
// an error is thrown if there is a concrete index that does not match
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could simplify a bit the entire series of VerificationExceptions here and extract a method with common functionality. For example:

    private void expectVerificationExceptionForQuery(String q, String error, Boolean requestIncludeMeta) {
        VerificationException e = expectThrows(VerificationException.class, () -> runQuery(q, requestIncludeMeta));
        assertThat(e.getDetailedMessage(), containsString(error));

        String limit0 = q + " | LIMIT 0";
        e = expectThrows(VerificationException.class, () -> runQuery(limit0, requestIncludeMeta));
        assertThat(e.getDetailedMessage(), containsString(error));
    }

IntelliJ tells me I could use the method above in 12 places in this test method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Changed in latest push.

String remote2Index = (String) testClusterInfo.get("remote2.index");

createIndexAliases(numClusters);
setSkipUnavailable(REMOTE_CLUSTER_1, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding (from the documentation) is that skip_unavailable is false by default, if not explicitly set.

Likely I am missing something, but shouldn't skip_unvailable value not matter in this test method? Meaning, it can either be un-set, set to false or set to true, the VerificationException should be thrown no matter what, when an inexistent index is specified (concrete or as part of a wildcarded expression when 0 indices are found).

Copy link
Contributor Author

@quux00 quux00 Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding (from the documentation) is that skip_unavailable is false by default, if not explicitly set

That used to be the case but was changed to default to true in 8.15: #105792

shouldn't skip_unvailable value not matter in this test method? Meaning, it can either be un-set, set to false or set to true

That is correct, which is why I removed the explicit setting of skip_unavailable here (since it used to matter). Now it gets set to a random setting by this part of the test setup. It is randomized a test case set up for all tests unless a specific test needs to specifically override it and set a specific value which is what this test used to do. Now it just allows the random value.

Copy link
Contributor

@astefan astefan Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... I was slightly mislead by our docs on this, grabbing the first piece of info on the default value I found. We might have a small inconsistency here, even though in other places it is specifically mentioned that the default changed from false to true.
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened a small PR for this #120592

@quux00 quux00 requested a review from astefan January 21, 2025 20:58
Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@quux00 quux00 merged commit 0de4b92 into elastic:main Jan 22, 2025
16 checks passed
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

quux00 added a commit to quux00/elasticsearch that referenced this pull request Jan 22, 2025
…time other than disconnected exceptions (elastic#120236)

For ES|QL, we are moving to limit the scope of the skip_unavailable setting for remote clusters.
Going forward, skip_unavailable will be considered for two scenarios:

1) inability to connect to a remote cluster ("unavailable")
2) whether to fail on execution time errors or not (inline with the upcoming 
allow_partial_search_results work for ES|QL).

This PR reverses the special plan-time handling for skip_unavailable=true clusters
that was added in elastic#116348. Remote clusters, regardless of their skip_unavailable setting, 
will now use the same logic as the local cluster for index expression analysis at plan time, namely:

1) If any concrete index specified is missing from the cluster, a VerificationException will be thrown
2) If no matching index/alias/datastream was found on any cluster (even if all were specified with a wildcard), 
a VerificationException will be thrown

Thus, we no longer require at least one matching index expression for skip_unavailable=false 
clusters either, as was done in the previous PR referenced above.
elasticsearchmachine pushed a commit that referenced this pull request Jan 22, 2025
…time other than disconnected exceptions (#120236) (#120628)

For ES|QL, we are moving to limit the scope of the skip_unavailable setting for remote clusters.
Going forward, skip_unavailable will be considered for two scenarios:

1) inability to connect to a remote cluster ("unavailable")
2) whether to fail on execution time errors or not (inline with the upcoming 
allow_partial_search_results work for ES|QL).

This PR reverses the special plan-time handling for skip_unavailable=true clusters
that was added in #116348. Remote clusters, regardless of their skip_unavailable setting, 
will now use the same logic as the local cluster for index expression analysis at plan time, namely:

1) If any concrete index specified is missing from the cluster, a VerificationException will be thrown
2) If no matching index/alias/datastream was found on any cluster (even if all were specified with a wildcard), 
a VerificationException will be thrown

Thus, we no longer require at least one matching index expression for skip_unavailable=false 
clusters either, as was done in the previous PR referenced above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.18.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants