[Main ]Create datasource API by vamsimanohar · Pull Request #1458 · opensearch-project/sql · GitHub
Skip to content

[Main ]Create datasource API#1458

Merged
vamsimanohar merged 1 commit into
opensearch-project:mainfrom
vamsimanohar:create-ds-main
Mar 27, 2023
Merged

[Main ]Create datasource API#1458
vamsimanohar merged 1 commit into
opensearch-project:mainfrom
vamsimanohar:create-ds-main

Conversation

@vamsimanohar

@vamsimanohar vamsimanohar commented Mar 21, 2023

Copy link
Copy Markdown
Member

Description

Earlier PR on 2.x branch: #1427
This PR covers Create datasource REST API.

Create datasource [REST API]

Screen Shot 2023-03-06 at 6 09 58 PM

Get datasource along with storage engine and other artifacts [Internal use case only]

Screen Shot 2023-03-06 at 6 13 39 PM

Issues Resolved

#1454

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc 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.

@codecov-commenter

codecov-commenter commented Mar 21, 2023

Copy link
Copy Markdown

@vamsimanohar vamsimanohar force-pushed the create-ds-main branch 3 times, most recently from 99e6fdf to b98edbb Compare March 21, 2023 23:24
@vamsimanohar

Copy link
Copy Markdown
Member Author

I have some high level questions because this PR seems have more influence than it looks:

  1. There is no issue related to this main feature. I think we should create something and put it to our 2.7 or roadmap

I will add all the required issues.

  1. The new .ql-data-sources index is shifting stateless SQL plugin to stateful? If the index is red for some reason, want to confirm if SQL plugin still work as before? At lease for query on default OpenSearch data source.

It should work for queries on default Opensearch Connector even in case of red .ql-datasources index. I will go through the code again and list if there are any scenarios where it breaks.

  1. Data source related code and dependencies keep growing, should we move all of them to a new datasource module. Because as I understand, core only depends on resolved DataSource or Table actually.

I was thinking on similar lines whether this code is really required in core or some other place. will discuss with you and try to move this.

** Captured important comments from other PR**

Comment thread docs/user/ppl/admin/datasources.rst
Comment thread docs/user/ppl/admin/datasources.rst
Comment thread docs/user/ppl/admin/datasources.rst Outdated
Comment thread docs/user/ppl/admin/datasources.rst Outdated
Comment thread docs/user/ppl/admin/datasources.rst
Comment thread docs/user/ppl/admin/datasources.rst Outdated
Comment thread plugin/build.gradle Outdated
Comment thread core/src/main/java/org/opensearch/sql/analysis/Analyzer.java Outdated
Comment thread core/src/main/java/org/opensearch/sql/datasource/DataSourceServiceImpl.java Outdated
@Override
public List<DataSourceMetadata> getDataSourceMetadata() {
if (!this.clusterService.state().routingTable().hasIndex(DATASOURCE_INDEX_NAME)) {
createDataSourcesIndex();

@penghuo penghuo Mar 22, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in which condition .ql-datasources index is created? plugin load time? client call create datasource API?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

client call create datasource API.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

check other plugins when they are creating an index.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@penghuo penghuo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

High level comments,

  1. The CRUD operation on .ql-datasource could be rewrite as plan, then we can reuse existing query execution logic.
  2. Failure cases we should consider. for example, (1) if cluster write blocked. then plugin can not create/write. (2) if the data in .ql-datasource lost.

@vamsimanohar

vamsimanohar commented Mar 23, 2023

Copy link
Copy Markdown
Member Author

High level comments,

  1. The CRUD operation on .ql-datasource could be rewrite as plan, then we can reuse existing query execution logic.

Any advantage in doing so and also I need to stash current context of thread to behave like an admin and make changes to system index. (.ql-datasources)

  1. Failure cases we should consider. for example, (1) if cluster write blocked. then plugin can not create/write. (2) if the data in .ql-datasource lost.

Need to look into other plugins when cluster writes are blocked.[Mostly apis stop working until we fix it.]
we need to enable snapshots for .ql-datasources for better resillience.

Signed-off-by: vamsi-amazon <reddyvam@amazon.com>
@vamsimanohar vamsimanohar merged commit 12bc2b4 into opensearch-project:main Mar 27, 2023
@opensearch-trigger-bot

Copy link
Copy Markdown
Contributor

vamsimanohar added a commit that referenced this pull request Mar 27, 2023
Signed-off-by: vamsi-amazon <reddyvam@amazon.com>
(cherry picked from commit 12bc2b4)
vamsimanohar added a commit to vamsimanohar/sql that referenced this pull request Mar 27, 2023
Signed-off-by: vamsi-amazon <reddyvam@amazon.com>
vamsimanohar added a commit to vamsimanohar/sql that referenced this pull request Mar 27, 2023
Signed-off-by: vamsi-amazon <reddyvam@amazon.com>
vamsimanohar added a commit that referenced this pull request Mar 28, 2023
Signed-off-by: vamsi-amazon <reddyvam@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Create Datasource API.

4 participants