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/QueryGroup Add Create API in plugin #14459

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

ruai0511
Copy link
Contributor

Description

This change introduces the Create QueryGroup API which we will use to enforce node level resiliency as part of this RFC: #12342.

The Create QueryGroup API schema is:

curl -XPUT "localhost:9200/_query_group/" -H 'Content-Type: application/json' -d ' 
{
     "name": "analytics",
     "jvm":0.4,
     "mode": "monitor"
}'

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • Public documentation issue/PR created

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.

kaushalmahi12 and others added 17 commits April 11, 2024 21:15
Signed-off-by: Kaushal Kumar <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
Signed-off-by: Ruirui Zhang <[email protected]>
Signed-off-by: Ruirui Zhang <[email protected]>
Signed-off-by: Ruirui Zhang <[email protected]>
Signed-off-by: Ruirui Zhang <[email protected]>
Signed-off-by: Ruirui Zhang <[email protected]>
Copy link
Contributor

❌ Gradle check result for a2bd381: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 5b53934: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

✅ Gradle check result for cb836d7: SUCCESS

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 55.65032% with 208 lines in your changes missing coverage. Please review.

Project coverage is 71.63%. Comparing base (b15cb0c) to head (cb836d7).
Report is 454 commits behind head on main.

Files Patch % Lines
...opensearch/plugin/wlm/CreateQueryGroupRequest.java 57.65% 42 Missing and 5 partials ⚠️
...ugin/wlm/service/QueryGroupPersistenceService.java 51.28% 36 Missing and 2 partials ⚠️
.../search/query_group/QueryGroupServiceSettings.java 25.58% 31 Missing and 1 partial ⚠️
...pensearch/cluster/metadata/QueryGroupMetadata.java 42.22% 26 Missing ⚠️
...ch/plugin/wlm/rest/RestCreateQueryGroupAction.java 0.00% 15 Missing ⚠️
...va/org/opensearch/cluster/metadata/QueryGroup.java 86.84% 6 Missing and 9 partials ⚠️
...ch/plugin/wlm/TransportCreateQueryGroupAction.java 0.00% 12 Missing ⚠️
...pensearch/plugin/wlm/CreateQueryGroupResponse.java 65.00% 7 Missing ⚠️
...java/org/opensearch/cluster/metadata/Metadata.java 73.68% 5 Missing ⚠️
...pensearch/plugin/wlm/WorkloadManagementPlugin.java 0.00% 4 Missing ⚠️
... and 2 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14459      +/-   ##
============================================
+ Coverage     71.42%   71.63%   +0.21%     
- Complexity    59978    62190    +2212     
============================================
  Files          4985     5129     +144     
  Lines        282275   292298   +10023     
  Branches      40946    42234    +1288     
============================================
+ Hits         201603   209385    +7782     
- Misses        63999    65635    +1636     
- Partials      16673    17278     +605     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrross
Copy link
Member

A couple high level comments:

@ruai0511
Copy link
Contributor Author

A couple high level comments:

Thanks for the info! I'll look into it

@kaushalmahi12
Copy link
Contributor

Thanks @andrross for going through the PR and provide useful insights. I have updated the RFC for the reasoning behind moving this into a plugin. We had also discussed this with @msfroh.

Comment on lines +27 to +28
- [QueryGroup] Add QueryGroup CRUD APIs ([#13315](https://github.com/opensearch-project/OpenSearch/pull/13315))
- [QueryGroup] Add QueryGroup Create API ([#14459](https://github.com/opensearch-project/OpenSearch/pull/14459))
Copy link
Contributor

Choose a reason for hiding this comment

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

Merge issue?

* compatible open source license.
*/

package org.opensearch.plugin.wlm;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should package be plugin.wlm.action? That would be consistent with the structure in core, I guess.

/**
* Name for CreateQueryGroupAction
*/
public static final String NAME = "cluster:admin/opensearch/query_group/wlm/_create";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have wlm prior to query_group in the action path?

Comment on lines +13 to +15
/**
* Rest action to create QueryGroup
*
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this logic is for Rest Action. Probably Transport layer action

Comment on lines +33 to +34
* @param queryGroup - The QueryGroup to be created
* @param restStatus - The resStatus for the response
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The QueryGroup created. Since, by the time of response, it is already created, so to be is incorrect
nit: typo in resStatus

Comment on lines +58 to +63
builder.startObject();
builder.field("name", queryGroup.getName());
builder.field("mode", queryGroup.getMode().getName());
builder.field("updatedAt", queryGroup.getUpdatedAtInMillis());
builder.mapContents(queryGroup.getResourceLimits());
builder.endObject();
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic should be delegated to QueryGroup class

Comment on lines +28 to +29
private final QueryGroup queryGroup;
private RestStatus restStatus;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any other class example that follows this data object, restStatus response object model?

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.

None yet

4 participants