-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Adding Cluster Endpoints for search failures and refactoring document status counters #19115
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
Open
ajleong623
wants to merge
37
commits into
opensearch-project:main
Choose a base branch
from
ajleong623:upgrade-cluster-endpoints
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+971
−77
Open
Changes from 28 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ab74705
add first changes
ajleong623 ad9e107
test for breaking detection
ajleong623 9e3af03
test for breaking detection
ajleong623 7e9374a
add changes
ajleong623 fe21417
fix compile issues
ajleong623 a345b21
fix breaking changes
ajleong623 ae2c661
fix breaking changes
ajleong623 ad95bff
added integration tests
ajleong623 c9ad00b
fix null pointer and breaking changes
ajleong623 32a2fae
test runner not found
ajleong623 8589524
test compilation
ajleong623 3bcb07b
spotless
ajleong623 c0755e4
spotless
ajleong623 f77335c
it should pass
ajleong623 49e6d5e
refactor doc status
ajleong623 50b5682
refactor doc status
ajleong623 20a7a41
refactor doc status
ajleong623 dcacf86
rerun
ajleong623 b9e2dcc
skip old versions without status counter
ajleong623 aea2644
updated license
ajleong623 7f6d8f5
retry for flaky
ajleong623 d16acf5
retry for flaky
ajleong623 5e8d8e5
retry for flaky
ajleong623 7e81293
retry for flaky
ajleong623 ac7ffc3
Merge branch 'opensearch-project:main' into upgrade-cluster-endpoints
ajleong623 ad026c2
keystore test timed out
ajleong623 9bd2985
Merge branch 'upgrade-cluster-endpoints' of https://github.com/ajleon…
ajleong623 9e84290
keystore test timed out
ajleong623 b544e35
Merge branch 'opensearch-project:main' into upgrade-cluster-endpoints
ajleong623 dc043dd
refactor enum and stat holders
ajleong623 3455efb
Merge branch 'upgrade-cluster-endpoints' of https://github.com/ajleon…
ajleong623 a2aa335
applied suggestions
ajleong623 93f508f
retry for flaky
ajleong623 eb19367
Merge branch 'opensearch-project:main' into upgrade-cluster-endpoints
ajleong623 536c20b
retry for flaky
ajleong623 de8b27d
retry for flaky
ajleong623 917722c
Merge branch 'main' into upgrade-cluster-endpoints
ajleong623 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
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
87 changes: 87 additions & 0 deletions
87
server/src/internalClusterTest/java/org/opensearch/search/msearch/MultiSearchStatsIT.java
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 |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.search.msearch; | ||
|
|
||
| import org.opensearch.ExceptionsHelper; | ||
| import org.opensearch.action.admin.indices.stats.SearchResponseStatusStats; | ||
| import org.opensearch.action.search.MultiSearchRequestBuilder; | ||
| import org.opensearch.action.search.MultiSearchResponse; | ||
| import org.opensearch.action.search.SearchResponse; | ||
| import org.opensearch.index.query.QueryBuilders; | ||
| import org.opensearch.test.OpenSearchIntegTestCase; | ||
| import org.opensearch.test.OpenSearchIntegTestCase.ClusterScope; | ||
| import org.opensearch.test.OpenSearchIntegTestCase.Scope; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.Comparator; | ||
| import java.util.concurrent.atomic.LongAdder; | ||
|
|
||
| @ClusterScope(scope = Scope.TEST, numDataNodes = 1, numClientNodes = 0, supportsDedicatedMasters = false) | ||
| public class MultiSearchStatsIT extends OpenSearchIntegTestCase { | ||
| private final SearchResponseStatusStats expectedSearchResponseStatusStats = new SearchResponseStatusStats(); | ||
|
|
||
| public void testNodeIndicesStatsDocStatusStatsIndexBulk() { | ||
| createIndex("test"); | ||
| ensureGreen(); | ||
| client().prepareIndex("test").setId("1").setSource("field", "xxx").get(); | ||
| client().prepareIndex("test").setId("2").setSource("field", "yyy").get(); | ||
| refresh(); | ||
|
|
||
| int failureCount = randomIntBetween(0, 50); | ||
| int successCount = randomIntBetween(0, 50); | ||
|
|
||
| MultiSearchRequestBuilder multiSearchRequestBuilder = client().prepareMultiSearch(); | ||
|
|
||
| for (int i = 0; i < failureCount; i++) { | ||
| multiSearchRequestBuilder.add(client().prepareSearch("noIndex").setQuery(QueryBuilders.termQuery("field", "yyy"))); | ||
| } | ||
|
|
||
| for (int i = 0; i < successCount; i++) { | ||
| multiSearchRequestBuilder.add(client().prepareSearch("test").setQuery(QueryBuilders.matchAllQuery())); | ||
| } | ||
|
|
||
| MultiSearchResponse response = multiSearchRequestBuilder.get(); | ||
|
|
||
| for (MultiSearchResponse.Item item : response) { | ||
| if (item.isFailure()) { | ||
| updateExpectedDocStatusCounter(expectedSearchResponseStatusStats, item.getFailure()); | ||
| } else { | ||
| updateExpectedDocStatusCounter(expectedSearchResponseStatusStats, item.getResponse()); | ||
| } | ||
| } | ||
| assertSearchResponseStatusStats(); | ||
| } | ||
|
|
||
| private void assertSearchResponseStatusStats() { | ||
| SearchResponseStatusStats searchResponseStatusStats = client().admin() | ||
| .cluster() | ||
| .prepareNodesStats() | ||
| .execute() | ||
| .actionGet() | ||
| .getNodes() | ||
| .get(0) | ||
| .getIndices() | ||
| .getStatusCounterStats() | ||
| .getSearchResponseStatusStats(); | ||
|
|
||
| Arrays.equals( | ||
| searchResponseStatusStats.getSearchResponseStatusCounter(), | ||
| expectedSearchResponseStatusStats.getSearchResponseStatusCounter(), | ||
| Comparator.comparingLong(LongAdder::longValue) | ||
| ); | ||
| } | ||
|
|
||
| private void updateExpectedDocStatusCounter(SearchResponseStatusStats expectedSearchResponseStatusStats, SearchResponse r) { | ||
| expectedSearchResponseStatusStats.inc(r.status()); | ||
| } | ||
|
|
||
| private void updateExpectedDocStatusCounter(SearchResponseStatusStats expectedSearchResponseStatusStats, Exception e) { | ||
| expectedSearchResponseStatusStats.inc(ExceptionsHelper.status(e)); | ||
| } | ||
| } |
Oops, something went wrong.
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.
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.
Lets move the numeric values into well defined constants/Enums then directly use,
StatusCode.from(getStatusFamilyCode)