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

Support OpenSearch 2.0 in .net client #51

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

Yury-Fridlyand
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand commented Jun 16, 2022

Description

  • Fixes in integration tests for OpenSearch 2.0 (OpenSearch 1.x is not affected):
    • Remove check of deprecated search.remote settings.
    • Remove tests for _type validation in mapping APIs as it was removed from OpenSearch.
    • Remove validation for indices segments stats.
    • Rename all master references to cluster_manager comply with OpenSearch 2.0
    • Mark indices.exists_type/TypeExists APIs as deprecated
    • Add deprecation notice to all references of include_type_name/IncludeTypeName
    • Rename master_timeout to cluster_manager_timeout
  • Added renamed API:
    • Rename master node role to cluster_manager as it was done in OpenSearch.
    • CatMaster* API was duplicated into CatClusterManager*, but CatMaster* wasn't deleted. This provide backward compatibility. No new functionality added.

Issues Resolved

#34

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.

acarbonetto
acarbonetto previously approved these changes Jul 12, 2022
@Yury-Fridlyand Yury-Fridlyand marked this pull request as ready for review August 3, 2022 17:50
@Yury-Fridlyand Yury-Fridlyand requested a review from a team as a code owner August 3, 2022 17:50
@Yury-Fridlyand Yury-Fridlyand changed the title Essential support OpenSearch 2.0 in .net client Support OpenSearch 2.0 in .net client Aug 3, 2022
anirudha
anirudha previously approved these changes Aug 5, 2022
joshuali925
joshuali925 previously approved these changes Aug 5, 2022
joshuali925
joshuali925 previously approved these changes Aug 5, 2022
acarbonetto
acarbonetto previously approved these changes Aug 8, 2022
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

The master/cluster manager change looks suspicious. The external API should not have changed without a major version bump and a prior deprecation, so any time we removed "master" in this code, we probably needed to mark it deprecated and call into its manager version. Then we have different enums and state values where renaming one into the other is probably similarly broken (we probably shouldn't keep the state of both master and cluster_manager, but I am not sure).

@@ -69,10 +69,10 @@ public VirtualCluster PublishAddress(string publishHost)
return this;
}

public VirtualCluster MasterEligible(params int[] ports)
Copy link
Member

Choose a reason for hiding this comment

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

This would be a breaking change, I think you need both Master and ClusterManager versions, and tests to ensure we catch such. There's probably other similar instances.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. VirtualizedCluster is used by unit tests only, but users re-use code from it or from tests in their application.
Proposed fix - recover MasterEligible and call ClusterManagerEligible inside; add deprecation notice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dblock,
please see fix in Bit-Quill#38.

Copy link
Member

Choose a reason for hiding this comment

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

Looking good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Merged in 2d6cff5.

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

There are more instances where I think the obsolete method should be calling the non-obsolete one and be marked as such. I am not 100% sure though, I think it does work without one calling the other.

public ClusterGetSettingsDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout);
///<summary>Explicit operation timeout for connection to cluster_manager node</summary>
///<remarks>Introduced in OpenSearch 2.0 instead of <see cref="MasterTimeout"/></remarks>
public ClusterGetSettingsDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout);
Copy link
Member

Choose a reason for hiding this comment

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

Should MasterTimeout call ClusterManagerTimeout and be deprecated with @Obsolete?

Copy link
Collaborator Author

@Yury-Fridlyand Yury-Fridlyand Aug 9, 2022

Choose a reason for hiding this comment

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

I didn't use here Obsolete attribute, because this is not obsolete for OpenSearch 1.x. This could fail build for users.

I don't call MasterTimeout in ClusterManagerTimeout, because these methods set different parameters. Imaging you are working with OpenSearch 1.2 and setting MasterTimeout. If it sets cluster_manager_timeout under the hood, server won't recognize it.
We can call MasterTimeout in ClusterManagerTimeout in addition to setting cluster_manager_timeout, but I think it is odd.

This is applicable for all instances of ClusterManagerTimeout (a lots of them).

Copy link
Member

Choose a reason for hiding this comment

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

Ok, you're absolutely right.

src/OpenSearch.Client/Descriptors.Cluster.cs Show resolved Hide resolved
src/OpenSearch.Client/OpenSearchClient.Cat.cs Show resolved Hide resolved
src/OpenSearch.Client/Requests.Cluster.cs Show resolved Hide resolved
joshuali925
joshuali925 previously approved these changes Aug 15, 2022
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

This is great! I think the one thing missing is incrementing the client version to 1.1. If I am not mistaken, semantically this version has a new feature (support for OpenSearch 2.x) and doesn't contain any breaking changes, so it shouldn't be 2.0, but 1.1.

COMPATIBILITY.md Outdated
| 1.3.2 | 1.0.0 |
| 1.3.3 | 1.0.0 |
| 2.0.0 | 1.0.0 |
| 2.0.1 | 1.0.0 |
Copy link
Member

Choose a reason for hiding this comment

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

I think we should update the compatibility matrix to say that client 1.0 is compatible with OpenSearch 1.x, and client 1.1 is compatible with OpenSearch 1.x and 2.x.

Copy link
Member

@joshuali925 joshuali925 Aug 17, 2022

Choose a reason for hiding this comment

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

Agree, if 1.x means literally 1.x. I asked in inital PR to use 1.x/2.x instead of listing out all versions, it's easier to read.

The next client version should be 1.1 since there are no breaking changes, so maybe this? Users are likely to be already using some version of OpenSearch. They can lookup what are the compatible client versions, instead of the other way around.

| OpenSearch Version | Client Version |
|--------------------|----------------|
| 1.x                | 1.0.0, 1.1.0   |
| 2.x                | 1.1.0          |

Copy link
Member

Choose a reason for hiding this comment

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

You could reverse the columns making it easier to grok ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, updated in 0d58b5b.

COMPATIBILITY.md Outdated Show resolved Hide resolved
@MaxKsyunz
Copy link
Collaborator

MaxKsyunz commented Aug 29, 2022

@dblock do you mind having a look at this again? Rebasing dismissed existing reviews.

Copy link

@wbeckler wbeckler left a comment

Choose a reason for hiding this comment

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

LGTM given there were two reviewers okay already.

@wbeckler wbeckler merged commit 835c266 into opensearch-project:main Aug 31, 2022
@Yury-Fridlyand Yury-Fridlyand deleted the dev-os-2.0-integ branch September 9, 2022 21:13
This was referenced Sep 15, 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.

7 participants