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] Add UpdateDataObject interface, Client, and Connector Implementations #2520

Merged

Conversation

dbwiddis
Copy link
Member

@dbwiddis dbwiddis commented Jun 7, 2024

Description

  • Adds update method to SdkClient interface (full document update, does not do scripts)
  • Implements update method on Local and Remote clients
  • Migrates Connector Update action to use SdkClient for the updates

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

  • 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.

Comment on lines 123 to 132
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);
}
Copy link
Collaborator

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?

Copy link
Member Author

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. 🤷

@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 16:19 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 16:19 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 16:19 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 16:19 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 16:19 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 16:19 — with GitHub Actions Inactive
Comment on lines +17 to +18
private final ShardId shardId;
private final ShardInfo shardInfo;
Copy link
Contributor

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?

Copy link
Member Author

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) {
Copy link
Contributor

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?

Copy link
Member Author

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) {
Copy link
Contributor

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

Copy link
Member Author

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.

@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 17:11 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 17:11 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 17:11 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 19:34 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 19:34 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 19:34 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 19:34 — with GitHub Actions Error
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 22:17 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 22:17 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 22:17 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 22:18 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 22:18 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 14, 2024 22:18 — with GitHub Actions Inactive
throw notFound;
} catch (Exception e) {
throw new OpenSearchException(e);
} catch (IOException e) {
Copy link
Collaborator

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?

Copy link
Member Author

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.

@dhrubo-os dhrubo-os merged commit 4d0fbdc into opensearch-project:feature/multi_tenancy Jun 14, 2024
9 checks passed
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 23:10 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 23:10 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 14, 2024 23:10 — with GitHub Actions Error
arjunkumargiri pushed a commit to arjunkumargiri/ml-commons that referenced this pull request Jun 17, 2024
…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]>
dhrubo-os added a commit that referenced this pull request Jun 18, 2024
* 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]>
dhrubo-os added a commit that referenced this pull request Jul 11, 2024
* 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]>
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