-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Report failures on partial results #124823
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d14c837
Report failures on partial results
smalyshev 963abac
Update docs/changelog/124823.yaml
smalyshev ae9cbb8
Merge branch 'main' into partial-fail-results
smalyshev f16f28f
Tests
smalyshev 627d24f
Update 124823.yaml
smalyshev 155b45a
[CI] Auto commit changes from spotless
elasticsearchmachine b70c57b
Improve test
smalyshev c1f569a
Check that iterator is not empty
smalyshev 61f635e
Merge branch 'main' into partial-fail-results
smalyshev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 124823 | ||
summary: Report failures on partial results | ||
area: "ES|QL" | ||
type: enhancement | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...plugin/esql/src/test/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfoTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.action; | ||
|
||
import org.elasticsearch.action.search.ShardSearchFailure; | ||
import org.elasticsearch.test.ESTestCase; | ||
import org.elasticsearch.transport.RemoteClusterService; | ||
|
||
import java.util.List; | ||
|
||
public class EsqlExecutionInfoTests extends ESTestCase { | ||
|
||
static final EsqlExecutionInfo.Cluster localCluster = new EsqlExecutionInfo.Cluster( | ||
RemoteClusterService.LOCAL_CLUSTER_GROUP_KEY, | ||
"test" | ||
); | ||
static final EsqlExecutionInfo.Cluster remoteCluster = new EsqlExecutionInfo.Cluster("remote", "test"); | ||
|
||
public void testHasMetadataInclude() { | ||
// includeCCSMetadata + non-local clusters will produce true | ||
EsqlExecutionInfo info = new EsqlExecutionInfo(true); | ||
assertFalse(info.hasMetadataToReport()); | ||
info.swapCluster(RemoteClusterService.LOCAL_CLUSTER_GROUP_KEY, (k, v) -> localCluster); | ||
assertFalse(info.hasMetadataToReport()); | ||
info.swapCluster("remote", (k, v) -> remoteCluster); | ||
assertTrue(info.hasMetadataToReport()); | ||
// Only remote is enough | ||
info = new EsqlExecutionInfo(true); | ||
info.swapCluster("remote", (k, v) -> remoteCluster); | ||
assertTrue(info.hasMetadataToReport()); | ||
} | ||
|
||
public void testHasMetadataIncludeFalse() { | ||
// If includeCCSMetadata is false, then it should always return false | ||
EsqlExecutionInfo info = new EsqlExecutionInfo(false); | ||
assertFalse(info.hasMetadataToReport()); | ||
assertFalse(info.hasMetadataToReport()); | ||
info.swapCluster(RemoteClusterService.LOCAL_CLUSTER_GROUP_KEY, (k, v) -> localCluster); | ||
assertFalse(info.hasMetadataToReport()); | ||
info.swapCluster("remote", (k, v) -> remoteCluster); | ||
assertFalse(info.hasMetadataToReport()); | ||
} | ||
|
||
public void testHasMetadataPartial() { | ||
EsqlExecutionInfo info = new EsqlExecutionInfo(false); | ||
String key = randomFrom(RemoteClusterService.LOCAL_CLUSTER_GROUP_KEY, "remote"); | ||
info.swapCluster(key, (k, v) -> new EsqlExecutionInfo.Cluster(k, "test", false, EsqlExecutionInfo.Cluster.Status.SUCCESSFUL)); | ||
assertFalse(info.isPartial()); | ||
assertFalse(info.hasMetadataToReport()); | ||
info.swapCluster(key, (k, v) -> new EsqlExecutionInfo.Cluster(k, "test", false, EsqlExecutionInfo.Cluster.Status.PARTIAL)); | ||
assertTrue(info.isPartial()); | ||
assertFalse(info.hasMetadataToReport()); | ||
info.swapCluster(key, (k, v) -> { | ||
EsqlExecutionInfo.Cluster.Builder builder = new EsqlExecutionInfo.Cluster.Builder(v); | ||
builder.setFailures(List.of(new ShardSearchFailure(new IllegalStateException("shard failure")))); | ||
return builder.build(); | ||
}); | ||
assertTrue(info.hasMetadataToReport()); | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any tests that exercise this new assertion path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipped is partial too, so all results with skipped clusters would go this route.