-
Notifications
You must be signed in to change notification settings - Fork 141
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
[Main ]Create datasource API #1458
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1458 +/- ##
=========================================
Coverage 98.46% 98.46%
- Complexity 3846 3869 +23
=========================================
Files 345 345
Lines 9553 9603 +50
Branches 613 616 +3
=========================================
+ Hits 9406 9456 +50
Misses 142 142
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
99e6fdf
to
b98edbb
Compare
I will add all the required issues.
It should work for queries on default Opensearch Connector even in case of red
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** |
prometheus/src/main/java/org/opensearch/sql/prometheus/storage/PrometheusStorageFactory.java
Show resolved
Hide resolved
plugin/src/main/java/org/opensearch/sql/plugin/rest/RestDataSourceQueryAction.java
Show resolved
Hide resolved
plugin/src/main/java/org/opensearch/sql/plugin/utils/XContentParserUtils.java
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/datasource/DataSourceServiceImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/datasource/DataSourceServiceImpl.java
Show resolved
Hide resolved
@Override | ||
public List<DataSourceMetadata> getDataSourceMetadata() { | ||
if (!this.clusterService.state().routingTable().hasIndex(DATASOURCE_INDEX_NAME)) { | ||
createDataSourcesIndex(); |
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.
in which condition .ql-datasources index is created? plugin load time? client call create datasource API?
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.
client call create datasource API.
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.
check other plugins when they are creating an 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.
https://github.com/opensearch-project/ml-commons/blob/main/plugin/src/main/java/org/opensearch/ml/indices/MLIndicesHandler.java#L62
https://github.com/opensearch-project/observability/blob/main/src/main/kotlin/org/opensearch/observability/index/ObservabilityIndex.kt#L90
Both of these plugins uses similar patterns. Going ahead with this approach. Will create a fix , fi we uncover any bugs.
.../src/main/java/org/opensearch/sql/plugin/datasource/OpenSearchDataSourceMetadataStorage.java
Show resolved
Hide resolved
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.
High level comments,
- The CRUD operation on
.ql-datasource
could be rewrite as plan, then we can reuse existing query execution logic. - 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.
.../src/main/java/org/opensearch/sql/plugin/datasource/OpenSearchDataSourceMetadataStorage.java
Show resolved
Hide resolved
b98edbb
to
6196af5
Compare
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)
Need to look into other plugins when cluster writes are blocked.[Mostly apis stop working until we fix it.] |
6196af5
to
621ee4e
Compare
Signed-off-by: vamsi-amazon <[email protected]>
621ee4e
to
e12087a
Compare
.../src/main/java/org/opensearch/sql/plugin/datasource/OpenSearchDataSourceMetadataStorage.java
Show resolved
Hide resolved
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1458-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 12bc2b4b51828d2fbcdcbf7d316dd06551f5f26e
# Push it to GitHub
git push --set-upstream origin backport/backport-1458-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
Signed-off-by: vamsi-amazon <[email protected]> (cherry picked from commit 12bc2b4)
Signed-off-by: vamsi-amazon <[email protected]>
Signed-off-by: vamsi-amazon <[email protected]>
Signed-off-by: vamsi-amazon <[email protected]>
Description
Earlier PR on 2.x branch: #1427
This PR covers Create datasource REST API.
Create datasource [REST API]
Get datasource along with storage engine and other artifacts [Internal use case only]
Issues Resolved
#1454
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.