Skip to content

Commit

Permalink
fix spotlessapply
Browse files Browse the repository at this point in the history
Signed-off-by: Ruirui Zhang <[email protected]>
  • Loading branch information
ruai0511 committed Jul 18, 2024
1 parent c98c089 commit d2a16f7
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Transport action to get QueryGroup
*
* @opensearch.api
* @opensearch.experimental
*/
public class GetQueryGroupAction extends ActionType<GetQueryGroupResponse> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* A request for get QueryGroup
*
* @opensearch.internal
* @opensearch.experimental
*/
public class GetQueryGroupRequest extends ActionRequest implements Writeable.Reader<GetQueryGroupRequest> {
String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Response for the get API for QueryGroup
*
* @opensearch.internal
* @opensearch.experimental
*/
public class GetQueryGroupResponse extends ActionResponse implements ToXContent, ToXContentObject {
private final List<QueryGroup> queryGroups;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Transport action for get QueryGroup
*
* @opensearch.internal
* @opensearch.experimental
*/
public class TransportGetQueryGroupAction extends HandledTransportAction<GetQueryGroupRequest, GetQueryGroupResponse> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/**
* Rest action to get a QueryGroup0
*
* @opensearch.api
* @opensearch.experimental
*/
public class RestGetQueryGroupAction extends BaseRestHandler {

Expand All @@ -48,7 +48,7 @@ public String getName() {
*/
@Override
public List<Route> routes() {
return List.of(new Route(GET, "_query_group/{name}"), new Route(GET, "_query_group/"));
return List.of(new Route(GET, "_wlm/query_group/{name}"), new Route(GET, "_wlm/query_group/"));

Check warning on line 51 in plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/action/rest/RestGetQueryGroupAction.java

View check run for this annotation

Codecov / codecov/patch

plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/action/rest/RestGetQueryGroupAction.java#L51

Added line #L51 was not covered by tests
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
import org.opensearch.plugin.wlm.action.GetQueryGroupResponse;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.DoubleAdder;

import static org.opensearch.search.query_group.QueryGroupServiceSettings.MAX_QUERY_GROUP_COUNT;

Expand All @@ -40,8 +37,6 @@ public class QueryGroupPersistenceService implements Persistable<QueryGroup> {
private static final String CREATE_QUERY_GROUP_THROTTLING_KEY = "create-query-group";
private static final String UPDATE_QUERY_GROUP_THROTTLING_KEY = "update-query-group";
private static final String DELETE_QUERY_GROUP_THROTTLING_KEY = "delete-query-group";
private final AtomicInteger inflightCreateQueryGroupRequestCount;
private final Map<String, DoubleAdder> inflightResourceLimitValues;
private volatile int maxQueryGroupCount;
final ThrottlingKey createQueryGroupThrottlingKey;
final ThrottlingKey updateQueryGroupThrottlingKey;
Expand All @@ -66,8 +61,6 @@ public QueryGroupPersistenceService(
this.updateQueryGroupThrottlingKey = clusterService.registerClusterManagerTask(UPDATE_QUERY_GROUP_THROTTLING_KEY, true);
maxQueryGroupCount = MAX_QUERY_GROUP_COUNT.get(settings);
clusterSettings.addSettingsUpdateConsumer(MAX_QUERY_GROUP_COUNT, this::setMaxQueryGroupCount);
inflightCreateQueryGroupRequestCount = new AtomicInteger();
inflightResourceLimitValues = new HashMap<>();
}

/**
Expand Down Expand Up @@ -110,20 +103,6 @@ List<QueryGroup> getFromClusterStateMetadata(String name, ClusterState currentSt
return resultGroups;
}

/**
* inflightCreateQueryGroupRequestCount getter
*/
public AtomicInteger getInflightCreateQueryGroupRequestCount() {
return inflightCreateQueryGroupRequestCount;
}

/**
* inflightResourceLimitValues getter
*/
public Map<String, DoubleAdder> getInflightResourceLimitValues() {
return inflightResourceLimitValues;
}

/**
* maxQueryGroupCount getter
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.DoubleAdder;

import static org.opensearch.cluster.metadata.QueryGroup.builder;
import static org.opensearch.search.ResourceType.fromName;
Expand Down Expand Up @@ -127,14 +126,4 @@ public static void compareQueryGroups(List<QueryGroup> listOne, List<QueryGroup>
assertTrue(listOne.get(i).equals(listTwo.get(i)));
}
}

public static void assertInflightValuesAreZero(QueryGroupPersistenceService queryGroupPersistenceService) {
assertEquals(0, queryGroupPersistenceService.getInflightCreateQueryGroupRequestCount().get());
Map<String, DoubleAdder> inflightResourceMap = queryGroupPersistenceService.getInflightResourceLimitValues();
if (inflightResourceMap != null) {
for (String resourceName : inflightResourceMap.keySet()) {
assertEquals(0, inflightResourceMap.get(resourceName).intValue());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.opensearch.plugin.wlm.action.QueryGroupTestUtils.NAME_NONE_EXISTED;
import static org.opensearch.plugin.wlm.action.QueryGroupTestUtils.NAME_ONE;
import static org.opensearch.plugin.wlm.action.QueryGroupTestUtils.NAME_TWO;
import static org.opensearch.plugin.wlm.action.QueryGroupTestUtils.assertInflightValuesAreZero;
import static org.opensearch.plugin.wlm.action.QueryGroupTestUtils.clusterState;
import static org.opensearch.plugin.wlm.action.QueryGroupTestUtils.compareQueryGroups;
import static org.opensearch.plugin.wlm.action.QueryGroupTestUtils.queryGroupList;
Expand All @@ -43,7 +42,6 @@ public void testGetSingleQueryGroup() {
listOne.add(queryGroupOne);
listTwo.add(queryGroup);
compareQueryGroups(listOne, listTwo);
assertInflightValuesAreZero(queryGroupPersistenceService());
}

public void testGetAllQueryGroups() {
Expand All @@ -54,7 +52,6 @@ public void testGetAllQueryGroups() {
assertTrue(currentNAME.contains(NAME_ONE));
assertTrue(currentNAME.contains(NAME_TWO));
compareQueryGroups(queryGroupList(), res);
assertInflightValuesAreZero(queryGroupPersistenceService());
}

public void testGetZeroQueryGroups() {
Expand All @@ -67,13 +64,11 @@ public void testGetZeroQueryGroups() {
);
List<QueryGroup> res = queryGroupPersistenceService.getFromClusterStateMetadata(NAME_NONE_EXISTED, clusterState());
assertEquals(0, res.size());
assertInflightValuesAreZero(queryGroupPersistenceService());
}

public void testGetNonExistedQueryGroups() {
List<QueryGroup> groups = queryGroupPersistenceService().getFromClusterStateMetadata(NAME_NONE_EXISTED, clusterState());
assertEquals(0, groups.size());
assertInflightValuesAreZero(queryGroupPersistenceService());
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ public void apply(Settings value, Settings current, Settings previous) {
CompositeIndexSettings.STAR_TREE_INDEX_ENABLED_SETTING,

SystemTemplatesService.SETTING_APPLICATION_BASED_CONFIGURATION_TEMPLATES_ENABLED,

// QueryGroup settings
QueryGroupServiceSettings.MAX_QUERY_GROUP_COUNT,
QueryGroupServiceSettings.NODE_LEVEL_REJECTION_THRESHOLD,
Expand Down

0 comments on commit d2a16f7

Please sign in to comment.