Skip to content
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

Backwards compatibility tests for async search #95

Merged
merged 7 commits into from
Mar 11, 2022

Conversation

bharath-techie
Copy link
Collaborator

@bharath-techie bharath-techie commented Feb 22, 2022

Description

Description of changes:

Added Async search backwards compatibility tests for mixed cluster, rolling upgrade and full restart scenarios
Updates DEVELOPER_GUIDE to add instructions for running bwc tests

Issues Resolved

[List any issues this PR will resolve]
#33

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@3e2e50c). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #95   +/-   ##
=======================================
  Coverage        ?   83.38%           
  Complexity      ?      554           
=======================================
  Files           ?       61           
  Lines           ?     2058           
  Branches        ?      146           
=======================================
  Hits            ?     1716           
  Misses          ?      236           
  Partials        ?      106           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e2e50c...ab0bdb1. Read the comment docs.

README.md Outdated
@@ -73,7 +73,10 @@ The project in this package uses the [Gradle](https://docs.gradle.org/current/us
5. `./gradlew integTest -PnumNodes=3` launches a multi-node cluster with the asynchronous search plugin installed and runs all integ tests.
6. `./gradlew integTest -Dtests.class=*AsynchronousSearchRestIT` runs a single integ class
7. `./gradlew integTest -Dtests.class=*AsynchronousSearchRestIT -Dtests.method="testSubmitWithRetainedResponse"` runs a single integ test method (remember to quote the test method name if it contains spaces)

8. `./gradlew asynSearchCluster#mixedClusterTask -Dtests.security.manager=false` launches a cluster of three nodes of bwc version of OpenSearch with async search plugin and tests backwards compatibility by performing rolling upgrade of each node with the current version of OpenSearch with async search plugin.
Copy link
Member

Choose a reason for hiding this comment

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

8. mixedClusterTask and 9. rollingUpgradeClusterTask have the same description?

build.gradle Outdated
buildscript {
ext {
distribution = 'oss-zip'
opensearch_group = "org.opensearch"
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
opensearch_version = System.getProperty("opensearch.version", "1.3.0-SNAPSHOT")
// 1.0.0 -> 1.0.0.0, and 1.0.0-SNAPSHOT -> 1.0.0.0-SNAPSHOT
os_as_bwc_version = System.getProperty("bwc.version", "1.13.0.1")
Copy link
Member

Choose a reason for hiding this comment

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

os_as_bwc_version sounds confusing. Is this just the opendistro_version

@@ -86,15 +86,29 @@ public void indexDocuments() throws IOException {
client().performRequest(new Request(HttpPost.METHOD_NAME, "/_refresh"));
}

AsynchronousSearchResponse executeGetAsynchronousSearch(GetAsynchronousSearchRequest getAsynchronousSearchRequest) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Can we revert this if it's an unintended indentation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no the code has changed a bit as i've overloaded this method

Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
@bharath-techie
Copy link
Collaborator Author

@dblock @ohltyler can any of you please review this PR ?

build.gradle Outdated
}
systemProperty 'tests.rest.bwcsuite_cluster', 'old_cluster'
systemProperty 'tests.rest.bwcsuite_round', 'old'
systemProperty 'tests.plugin_bwc_version', opendistro_plugin_version
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this system property being used anywhere. Do you still need this?

List<Map<String, Object>> plugins = (List<Map<String, Object>>) response.get("plugins");
Set<Object> pluginNames =
plugins.stream().map(map -> map.get("name")).collect(Collectors.toSet());
switch (CLUSTER_TYPE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this switch case since we are calling testAsyncSearchAndSettingsApi(true) for all of them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i made changes to call with false for upgraded plugin.

case OLD:
case MIXED:
case UPGRADED:
testAsyncSearchAndSettingsApi(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is shouldUseLegacyApi true even for an upgraded cluster?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I initially wrote with a different case where legacy will be used only for old and mixed. But changed it to check if legacy APIs will work for all 3 cases.

Is there any recommendation for upgraded cluster ? should we use the current APIs for upgraded instead of legacy ?

(Map<String, Map<String, Object>>) getAsMap(uri).get("nodes");
for (Map<String, Object> response : responseMap.values()) {
List<Map<String, Object>> plugins = (List<Map<String, Object>>) response.get("plugins");
Set<Object> pluginNames =
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we verify the plugins installed for the nodes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -67,20 +79,42 @@ public static Request buildHttpRequest(SubmitAsynchronousSearchRequest submitAsy
return request;
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: you can remove these empty lines.

Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
Copy link
Contributor

@VachaShah VachaShah left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for adding this @bharath-techie!

@eirsep eirsep merged commit 229a84a into opensearch-project:main Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants