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

[Feature/multi_tenancy] Update GetDataObjectResponse to include full GetResponse parser #2587

Merged

Conversation

dbwiddis
Copy link
Member

Description

Some APIs (get model group) require the full GetResponse object from the API.

This changes the GetDataObjectResponse to use the full GetResponse as the parser. Since there will always be a response, there is no longer a need for Optional, and the isExists() checks are available again.

It retains the source map as-is.

This parallels the implementation in the SearchDataObjectResponse (and probably would have done it that way if I'd done search first).

This allows for even closer-to-original migration of code expecting a GetResponse.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • 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.

@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:50 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:50 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:50 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:50 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:50 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:50 — with GitHub Actions Inactive
@dbwiddis dbwiddis force-pushed the full-get-response branch from 9044be1 to bd42a46 Compare June 21, 2024 20:57
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 20:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 21, 2024 20:57 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 21, 2024 20:57 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 21, 2024 20:57 — with GitHub Actions Error
@dbwiddis dbwiddis force-pushed the full-get-response branch from bd42a46 to 6bec29f Compare June 21, 2024 21:16
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 21:16 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 21:16 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 21:16 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 21:16 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 21:16 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 21, 2024 21:18 — with GitHub Actions Inactive
Copy link

codecov bot commented Jun 21, 2024

Codecov Report

Attention: Patch coverage is 64.88550% with 46 lines in your changes missing coverage. Please review.

Please upload report for BASE (feature/multi_tenancy@25bdbb9). Learn more about missing BASE report.

Current head 9044be1 differs from pull request most recent head 2571725

Please upload reports for the commit 2571725 to get more accurate results.

Files Patch % Lines
...search/ml/action/tasks/GetTaskTransportAction.java 12.50% 13 Missing and 1 partial ⚠️
...rch/ml/action/tasks/DeleteTaskTransportAction.java 65.62% 9 Missing and 2 partials ⚠️
...search/ml/helper/ConnectorAccessControlHelper.java 50.00% 7 Missing and 1 partial ⚠️
...tion/model_group/GetModelGroupTransportAction.java 56.25% 5 Missing and 2 partials ⚠️
...n/model_group/TransportUpdateModelGroupAction.java 70.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##             feature/multi_tenancy    #2587   +/-   ##
========================================================
  Coverage                         ?   81.01%           
  Complexity                       ?     6134           
========================================================
  Files                            ?      582           
  Lines                            ?    25916           
  Branches                         ?     2691           
========================================================
  Hits                             ?    20997           
  Misses                           ?     3783           
  Partials                         ?     1136           
Flag Coverage Δ
ml-commons 81.01% <64.88%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 21, 2024 22:10 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 21, 2024 22:10 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 21, 2024 22:10 — with GitHub Actions Error
+ request.index()
+ "\",\"_id\":\""
+ request.id()
+ "\",\"_version\":1,\"_seq_no\":-2,\"_primary_term\":0,\"found\":"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are all these values constant for every cases? Like version will be 1 always?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably need @arjunkumargiri to chime in here; this falls into the same category as "shard" information in DDB which is irrelevant, but I haven't been interacting with the DDB implementation enough to know what (if any) is relevant.

Otherwise best I can do is add a TODO to revisit this later.

Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a concern if plugins depends upon versions for any operation. It is preferred if the SDKClient interface hides all opensearch specific details and provides a generic CRUD+search interface.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is preferred if the SDKClient interface hides all opensearch specific details

What do we do with OpenSearch customers who are expecting this information and may already have automation relying on the GetResponse API behavior that has been there for years?

I need a really strong argument for taking away information here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are all these values constant for every cases? Like version will be 1 always?

Looking more deeply I can just omit these from the strings and it will go with the defaults, which match what was there except version is -1.

/**
* Instantiate this object with an OpenSearch Java client.
* @param openSearchClient The client to wrap
*/
public RemoteClusterIndicesClient(OpenSearchClient openSearchClient) {
this.openSearchClient = openSearchClient;
this.mapper = openSearchClient._transport().jsonpMapper();
Copy link
Contributor

Choose a reason for hiding this comment

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

is _trasport() internal method? JsonMapper should rather be passed in as part of constructor

Copy link
Member Author

Choose a reason for hiding this comment

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

}

String source = getItemResponse.item().get(SOURCE).s();
String simulatedGetResponse = "{\"_index\":\""
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach tightly couples SDKClient to the opensearch specific schema. This is resulting in non-opensearch clients building mimicking opensearch response which will not be flexible.

Rather than modifying SDKClient can model group action fetch required field from parser?

Copy link
Member Author

@dbwiddis dbwiddis Jun 24, 2024

Choose a reason for hiding this comment

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

Rather than modifying SDKClient can model group action fetch required field from parser?

When the GET request is on OpenSearch, we want to keep the same data that already exists in the response. (We're on round 4 of this conversation.). So yes, we will aways be in the situation of having to mimic an OpenSearch response. We have to either pretend there are shards/shard stats on non-OpenSearch implementations, or we have to take away information in a response that existing OpenSearch users are expecting to see. I strongly believe the former is the correct response.

If you strongly feel otherwise, let's have that conversation.

For the specifics of a GetResponse there are exactly two required fields, _index and _id. These can be recreated from the request, as I have done here.

The found field is also "required" due to a bug. That can also be recreated by a test whether DDB returned an item, which I have done.

The remaining fields (version, seq_no, primary term) are exactly the defaults if they are not included, except I see version should be -1.

        long version = -1;
        long seqNo = UNASSIGNED_SEQ_NO;
        long primaryTerm = UNASSIGNED_PRIMARY_TERM;

Seeing this I'll just remove those fields from the String.

@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 24, 2024 19:15 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 24, 2024 19:15 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 24, 2024 19:15 — with GitHub Actions Error
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 24, 2024 19:15 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 24, 2024 19:15 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 24, 2024 19:15 — with GitHub Actions Inactive
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 24, 2024 20:07 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 24, 2024 20:07 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 24, 2024 20:07 — with GitHub Actions Failure
@dbwiddis dbwiddis force-pushed the full-get-response branch from 18f1b99 to 2571725 Compare June 25, 2024 03:39
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 25, 2024 03:39 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 25, 2024 03:39 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 25, 2024 03:39 — with GitHub Actions Inactive
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 25, 2024 03:39 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 25, 2024 03:39 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 25, 2024 03:39 — with GitHub Actions Failure
@dhrubo-os dhrubo-os merged commit 8c3446c into opensearch-project:feature/multi_tenancy Jun 25, 2024
7 of 10 checks passed
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.

3 participants