-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Handle failures that occur during field-caps #130840
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
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d7f257d
Handle failures that occur during field-caps
dnhatn a1d64a8
Restore isPartial
dnhatn 3eedd02
restore no matching
dnhatn 352ce2b
Merge remote-tracking branch 'elastic/main' into resolution-errors
dnhatn 67e0fec
Merge remote-tracking branch 'elastic/main' into resolution-errors
dnhatn 9b19452
Add docs
dnhatn 406f8b2
Add target shard
dnhatn 2c1b04f
unwrap once
dnhatn 723a07f
Merge branch 'main' into resolution-errors
dnhatn 2e18273
Merge remote-tracking branch 'elastic/main' into resolution-errors
dnhatn 23a2f9b
More detailed error
dnhatn 586f4b4
Add comment
dnhatn 77aacf2
no matching indices
dnhatn 300567b
Revert "no matching indices"
dnhatn 5c5e77e
Merge remote-tracking branch 'elastic/main' into resolution-errors
dnhatn 7aa9f59
Merge remote-tracking branch 'elastic/main' into resolution-errors
dnhatn 57ac10f
Merge remote-tracking branch 'elastic/main' into resolution-errors
dnhatn 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 hidden or 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 |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
import org.elasticsearch.ExceptionsHelper; | ||
import org.elasticsearch.action.search.ShardSearchFailure; | ||
import org.elasticsearch.action.support.ActiveShardCount; | ||
import org.elasticsearch.client.internal.Client; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.common.util.set.Sets; | ||
|
@@ -37,6 +38,7 @@ | |
import static org.hamcrest.Matchers.empty; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.greaterThan; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.Matchers.in; | ||
import static org.hamcrest.Matchers.instanceOf; | ||
import static org.hamcrest.Matchers.is; | ||
|
@@ -58,12 +60,15 @@ private static class ClusterSetup { | |
void populateIndices() throws Exception { | ||
local.okIds = populateIndex(LOCAL_CLUSTER, "ok-local", local.okShards, between(1, 100)); | ||
populateIndexWithFailingFields(LOCAL_CLUSTER, "fail-local", local.failingShards); | ||
createUnavailableIndex(LOCAL_CLUSTER, "unavailable-local"); | ||
|
||
remote1.okIds = populateIndex(REMOTE_CLUSTER_1, "ok-cluster1", remote1.okShards, between(1, 100)); | ||
populateIndexWithFailingFields(REMOTE_CLUSTER_1, "fail-cluster1", remote1.failingShards); | ||
createUnavailableIndex(REMOTE_CLUSTER_1, "unavailable-cluster1"); | ||
|
||
remote2.okIds = populateIndex(REMOTE_CLUSTER_2, "ok-cluster2", remote2.okShards, between(1, 100)); | ||
populateIndexWithFailingFields(REMOTE_CLUSTER_2, "fail-cluster2", remote2.failingShards); | ||
createUnavailableIndex(REMOTE_CLUSTER_2, "unavailable-cluster2"); | ||
} | ||
|
||
private void assertClusterPartial(EsqlQueryResponse resp, String clusterAlias, ClusterSetup cluster) { | ||
|
@@ -342,6 +347,42 @@ public void testFailSearchShardsOnLocalCluster() throws Exception { | |
} | ||
} | ||
|
||
public void testResolutionFailures() throws Exception { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check out also #129957 - I've made some tests for things that weren't handled properly. |
||
populateIndices(); | ||
EsqlQueryRequest request = new EsqlQueryRequest(); | ||
request.allowPartialResults(true); | ||
request.query("FROM ok*,unavailable* | LIMIT 1000"); | ||
try (var resp = runQuery(request)) { | ||
assertThat(EsqlTestUtils.getValuesList(resp), hasSize(local.okIds.size())); | ||
assertTrue(resp.isPartial()); | ||
smalyshev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EsqlExecutionInfo executionInfo = resp.getExecutionInfo(); | ||
var localCluster = executionInfo.getCluster(LOCAL_CLUSTER); | ||
assertThat(localCluster.getFailures(), not(empty())); | ||
assertThat(localCluster.getFailures().get(0).reason(), containsString("index [unavailable-local] has no active shard copy")); | ||
} | ||
request.query("FROM *:ok*,unavailable* | LIMIT 1000"); | ||
try (var resp = runQuery(request)) { | ||
assertThat(EsqlTestUtils.getValuesList(resp), hasSize(remote1.okIds.size() + remote2.okIds.size())); | ||
assertTrue(resp.isPartial()); | ||
var executionInfo = resp.getExecutionInfo(); | ||
var localCluster = executionInfo.getCluster(LOCAL_CLUSTER); | ||
assertThat(localCluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SKIPPED)); | ||
assertThat(localCluster.getFailures(), not(empty())); | ||
assertThat(localCluster.getFailures().get(0).reason(), containsString("index [unavailable-local] has no active shard copy")); | ||
assertThat(executionInfo.getCluster(REMOTE_CLUSTER_1).getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL)); | ||
assertThat(executionInfo.getCluster(REMOTE_CLUSTER_2).getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL)); | ||
} | ||
request.query("FROM ok*,cluster-a:unavailable* | LIMIT 1000"); | ||
try (var resp = runQuery(request)) { | ||
assertThat(EsqlTestUtils.getValuesList(resp), hasSize(local.okIds.size())); | ||
assertTrue(resp.isPartial()); | ||
var remote1 = resp.getExecutionInfo().getCluster(REMOTE_CLUSTER_1); | ||
assertThat(remote1.getFailures(), not(empty())); | ||
assertThat(remote1.getFailures().get(0).reason(), containsString("index [unavailable-cluster1] has no active shard copy")); | ||
assertThat(resp.getExecutionInfo().getCluster(LOCAL_CLUSTER).getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL)); | ||
} | ||
} | ||
|
||
private Set<String> populateIndexWithFailingFields(String clusterAlias, String indexName, int numShards) throws IOException { | ||
Client client = client(clusterAlias); | ||
XContentBuilder mapping = JsonXContent.contentBuilder().startObject(); | ||
|
@@ -384,4 +425,15 @@ private Set<String> populateIndexWithFailingFields(String clusterAlias, String i | |
} | ||
return ids; | ||
} | ||
|
||
private void createUnavailableIndex(String clusterAlias, String indexName) throws IOException { | ||
Client client = client(clusterAlias); | ||
assertAcked( | ||
client.admin() | ||
.indices() | ||
.prepareCreate(indexName) | ||
.setSettings(Settings.builder().put("index.routing.allocation.include._name", "no_such_node")) | ||
.setWaitForActiveShards(ActiveShardCount.NONE) | ||
); | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.