Feature/QueryGroup Add Create API in plugin#14459
Feature/QueryGroup Add Create API in plugin#14459ruai0511 wants to merge 18 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
…odes Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
a2bd381 to
cb836d7
Compare
|
❌ 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? |
|
❌ 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? |
|
A couple high level comments:
|
Thanks for the info! I'll look into it |
| - [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)) |
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.plugin.wlm; |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
Should we have wlm prior to query_group in the action path?
There was a problem hiding this comment.
I think that is the right way since wlm is the umbrella under which these query groups come.
plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/CreateQueryGroupAction.java
Show resolved
Hide resolved
...ns/workload-management/src/main/java/org/opensearch/plugin/wlm/CreateQueryGroupResponse.java
Show resolved
Hide resolved
...ns/workload-management/src/main/java/org/opensearch/plugin/wlm/CreateQueryGroupResponse.java
Show resolved
Hide resolved
| private final QueryGroup queryGroup; | ||
| private RestStatus restStatus; |
There was a problem hiding this comment.
Is there any other class example that follows this data object, restStatus response object model?
There was a problem hiding this comment.
This one is NotSerializableExceptionWrapper. But I also see other classes that don't store reststatus and only store data.
plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/CreateQueryGroupAction.java
Show resolved
Hide resolved
| /** | ||
| * Name for CreateQueryGroupAction | ||
| */ | ||
| public static final String NAME = "cluster:admin/opensearch/query_group/wlm/_create"; |
There was a problem hiding this comment.
I think that is the right way since wlm is the umbrella under which these query groups come.
...ins/workload-management/src/main/java/org/opensearch/plugin/wlm/CreateQueryGroupRequest.java
Show resolved
Hide resolved
...ins/workload-management/src/main/java/org/opensearch/plugin/wlm/CreateQueryGroupRequest.java
Show resolved
Hide resolved
...ns/workload-management/src/main/java/org/opensearch/plugin/wlm/CreateQueryGroupResponse.java
Show resolved
Hide resolved
| for (String resourceName : resourceLimitMapOne.keySet()) { | ||
| assertTrue(resourceLimitMapTwo.containsKey(resourceName)); | ||
| assertEquals(resourceLimitMapOne.get(resourceName), resourceLimitMapTwo.get(resourceName)); |
There was a problem hiding this comment.
We can replace this with
| for (String resourceName : resourceLimitMapOne.keySet()) { | |
| assertTrue(resourceLimitMapTwo.containsKey(resourceName)); | |
| assertEquals(resourceLimitMapOne.get(resourceName), resourceLimitMapTwo.get(resourceName)); | |
| assertTrue(resourceLimitMapOne.keySet().containsAll(resourceLimitMapTwo.keySet())); | |
| assertTrue(resourceLimitMapOne.values().containsAll(resourceLimitMapTwo.values())); |
| for (QueryGroup groupOne : listOne) { | ||
| String groupOneName = groupOne.getName(); | ||
| List<QueryGroup> groupTwoList = listTwo.stream().filter(sb -> sb.getName().equals(groupOneName)).collect(Collectors.toList()); | ||
| assertEquals(1, groupTwoList.size()); | ||
| QueryGroup groupTwo = groupTwoList.get(0); | ||
| assertEquals(groupOne.getName(), groupTwo.getName()); | ||
| assertEquals(groupOne.get_id(), groupTwo.get_id()); | ||
| compareResourceLimits(groupOne.getResourceLimits(), groupTwo.getResourceLimits()); | ||
| assertEquals(groupOne.getMode(), groupTwo.getMode()); | ||
| assertEquals(groupOne.getUpdatedAtInMillis(), groupTwo.getUpdatedAtInMillis()); | ||
| } |
There was a problem hiding this comment.
How about sorting these two lists and then doing the index wise comparison I think that would be more efficient ?
If the query group already implements equalsTo method then we should leverage that.
...management/src/main/java/org/opensearch/plugin/wlm/service/QueryGroupPersistenceService.java
Show resolved
Hide resolved
|
Move this to #14680 and close this PR |
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:
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.