-
Notifications
You must be signed in to change notification settings - Fork 138
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
[Feature/multi_tenancy] Update GetDataObjectResponse to include full GetResponse parser #2587
Conversation
9044be1
to
bd42a46
Compare
bd42a46
to
6bec29f
Compare
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
+ request.index() | ||
+ "\",\"_id\":\"" | ||
+ request.id() | ||
+ "\",\"_version\":1,\"_seq_no\":-2,\"_primary_term\":0,\"found\":" |
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.
Are all these values constant for every cases? Like version will be 1 always?
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.
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.
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.
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.
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.
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.
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.
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(); |
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.
is _trasport()
internal method? JsonMapper should rather be passed in as part of constructor
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.
It's a public
method on the ApiClient
class:
It's specifically listed exactly like this in the opensearch-java documentation:
https://github.com/opensearch-project/opensearch-java/blob/3af2d776903123c336686ffbfaafc5503f949b5b/guides/generic.md?plain=1#L81
} | ||
|
||
String source = getItemResponse.item().get(SOURCE).s(); | ||
String simulatedGetResponse = "{\"_index\":\"" |
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.
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?
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.
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.
Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: Daniel Widdis <[email protected]>
18f1b99
to
2571725
Compare
8c3446c
into
opensearch-project:feature/multi_tenancy
Description
Some APIs (get model group) require the full
GetResponse
object from the API.This changes the GetDataObjectResponse to use the full
GetResponse
as theparser
. Since there will always be a response, there is no longer a need forOptional
, and theisExists()
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
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.