-
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] Add UpdateDataObject interface, Client, and Connector Implementations #2520
[Feature/multi_tenancy] Add UpdateDataObject interface, Client, and Connector Implementations #2520
Conversation
Throwable cause = e.getCause(); | ||
if (cause instanceof InterruptedException) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
// Rethrow unchecked Exceptions | ||
if (cause instanceof RuntimeException) { | ||
throw (RuntimeException) cause; | ||
} else { | ||
throw new OpenSearchException(cause); | ||
} |
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.
if all these are same for every methods, may be we can put that in a method to reuse?
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.
ExceptionsHelper.convertToRuntime()
would be perfect for this but takes an Exception as an argument... guess I have to copy it. 🤷
private final ShardId shardId; | ||
private final ShardInfo shardInfo; |
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.
Why is this information required? Can this be null for non-OpenSearch data stores?
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.
No, it can not be null, you have asked this same question before and it was answered here: #2459 (comment)
Thread.currentThread().interrupt(); | ||
} | ||
// Rethrow unchecked Exceptions | ||
if (cause instanceof RuntimeException) { |
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.
Given that CompletionException
extends RuntimeException
wouldn't this condition always be true?
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.
Cause is already unwrapped from CompletionException here.
log.error("Failed to get ML connector {}", connectorId, cause); | ||
actionListener.onFailure(new RuntimeException(cause)); | ||
log.error("Failed to get ML connector " + connectorId, cause); | ||
if (cause instanceof Exception) { |
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.
Same as above, wouldn't all exceptions be instance of Exception
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.
Cause is of type Throwable
so yes this should probably almost always be true, unless someone decides to throw an Error
sometime in the future but this check is needed for safe type casting.
Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: Daniel Widdis <[email protected]>
throw notFound; | ||
} catch (Exception e) { | ||
throw new OpenSearchException(e); | ||
} catch (IOException e) { |
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.
so for other unchecked exceptions, it will automatically throw the exception what we have in SdkClient?
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.
@dhrubo-os Correct, any other exception will be a non-null Throwable
supplied to the completable future. It's tested in LocalClusterIndicesClientTests.testGetDataObject_Exception()
passing an UnsupportedOperationException
that would bypass this catch block.
4d0fbdc
into
opensearch-project:feature/multi_tenancy
…onnector Implementations (opensearch-project#2520) * Restore original exception handling expectations Signed-off-by: Daniel Widdis <[email protected]> * Add UpdateDataObject to interface and implementations Signed-off-by: Daniel Widdis <[email protected]> * Implement UpdateConnector action Signed-off-by: Daniel Widdis <[email protected]> * Move CompletionException handling to a common method Signed-off-by: Daniel Widdis <[email protected]> * Add tests for SDKClient exceptions refactored from Transport Action Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> Signed-off-by: Arjun kumar Giri <[email protected]>
* AWS DDB SDK client support for remote data store Signed-off-by: Arjun kumar Giri <[email protected]> * AWS DDB SDK client support for remote data store Signed-off-by: Arjun kumar Giri <[email protected]> * multi-tenancy for models (create, get, delete, update) + update connector (#2546) * multi-tenancy for models (create, get, delete) Signed-off-by: Dhrubo Saha <[email protected]> * added update connector + update model Signed-off-by: Dhrubo Saha <[email protected]> --------- Signed-off-by: Dhrubo Saha <[email protected]> Signed-off-by: Arjun kumar Giri <[email protected]> * [Feature/multi_tenancy] Add source map to GetDataObjectResponse (#2489) * Add source map to GetDataObjectResponse Signed-off-by: Daniel Widdis <[email protected]> * Add test for map getter in clients Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> Signed-off-by: Arjun kumar Giri <[email protected]> * [Feature/multi_tenancy] Add UpdateDataObject interface, Client, and Connector Implementations (#2520) * Restore original exception handling expectations Signed-off-by: Daniel Widdis <[email protected]> * Add UpdateDataObject to interface and implementations Signed-off-by: Daniel Widdis <[email protected]> * Implement UpdateConnector action Signed-off-by: Daniel Widdis <[email protected]> * Move CompletionException handling to a common method Signed-off-by: Daniel Widdis <[email protected]> * Add tests for SDKClient exceptions refactored from Transport Action Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> Signed-off-by: Arjun kumar Giri <[email protected]> * Addressed CR comment Signed-off-by: Arjun kumar Giri <[email protected]> * Added javadoc based on feedback Signed-off-by: Arjun kumar Giri <[email protected]> --------- Signed-off-by: Arjun kumar Giri <[email protected]> Signed-off-by: Dhrubo Saha <[email protected]> Signed-off-by: Daniel Widdis <[email protected]> Signed-off-by: arjunkumargiri <[email protected]> Co-authored-by: Dhrubo Saha <[email protected]> Co-authored-by: Daniel Widdis <[email protected]>
* AWS DDB SDK client support for remote data store Signed-off-by: Arjun kumar Giri <[email protected]> * AWS DDB SDK client support for remote data store Signed-off-by: Arjun kumar Giri <[email protected]> * multi-tenancy for models (create, get, delete, update) + update connector (#2546) * multi-tenancy for models (create, get, delete) Signed-off-by: Dhrubo Saha <[email protected]> * added update connector + update model Signed-off-by: Dhrubo Saha <[email protected]> --------- Signed-off-by: Dhrubo Saha <[email protected]> Signed-off-by: Arjun kumar Giri <[email protected]> * [Feature/multi_tenancy] Add source map to GetDataObjectResponse (#2489) * Add source map to GetDataObjectResponse Signed-off-by: Daniel Widdis <[email protected]> * Add test for map getter in clients Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> Signed-off-by: Arjun kumar Giri <[email protected]> * [Feature/multi_tenancy] Add UpdateDataObject interface, Client, and Connector Implementations (#2520) * Restore original exception handling expectations Signed-off-by: Daniel Widdis <[email protected]> * Add UpdateDataObject to interface and implementations Signed-off-by: Daniel Widdis <[email protected]> * Implement UpdateConnector action Signed-off-by: Daniel Widdis <[email protected]> * Move CompletionException handling to a common method Signed-off-by: Daniel Widdis <[email protected]> * Add tests for SDKClient exceptions refactored from Transport Action Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> Signed-off-by: Arjun kumar Giri <[email protected]> * Addressed CR comment Signed-off-by: Arjun kumar Giri <[email protected]> * Added javadoc based on feedback Signed-off-by: Arjun kumar Giri <[email protected]> * Set tenant ID for predict request Signed-off-by: Arjun kumar Giri <[email protected]> * Simplify instantiating Data Object Request/Response builders (#2608) Signed-off-by: Daniel Widdis <[email protected]> * Addressed comments Signed-off-by: Arjun kumar Giri <[email protected]> --------- Signed-off-by: Arjun kumar Giri <[email protected]> Signed-off-by: Dhrubo Saha <[email protected]> Signed-off-by: Daniel Widdis <[email protected]> Signed-off-by: arjunkumargiri <[email protected]> Co-authored-by: Dhrubo Saha <[email protected]> Co-authored-by: Daniel Widdis <[email protected]>
Description
NOTE: this PR builds on commit 22a0ce5 which represents PR #2507 . Reviewers may want to focus attention on commits 100d71a and e90b553
Will rebase this PR against the branch when #2507 is merged.
Issues Resolved
Continuation of PR #2459
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.