Skip to content

Commit a2e7d75

Browse files
authored
Rename all query group references to workload group (#18711)
Signed-off-by: Ruirui Zhang <[email protected]>
1 parent 26ada7e commit a2e7d75

File tree

20 files changed

+55
-54
lines changed

20 files changed

+55
-54
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
99
- Add support for custom index name resolver from cluster plugin ([#18593](https://github.com/opensearch-project/OpenSearch/pull/18593))
1010
- Disallow resize for Warm Index, add Parameterized ITs for close in remote store ([#18686](https://github.com/opensearch-project/OpenSearch/pull/18686))
1111
- Ability to run Code Coverage with Gradle and produce the jacoco reports locally ([#18509](https://github.com/opensearch-project/OpenSearch/issues/18509))
12+
- [Workload Management] Update logging and Javadoc, rename QueryGroup to WorkloadGroup ([#18711](https://github.com/opensearch-project/OpenSearch/issues/18711))
1213
- Add NodeResourceUsageStats to ClusterInfo ([#18480](https://github.com/opensearch-project/OpenSearch/issues/18472))
1314
- Introduce SecureHttpTransportParameters experimental API (to complement SecureTransportParameters counterpart) ([#18572](https://github.com/opensearch-project/OpenSearch/issues/18572))
1415
- Create equivalents of JSM's AccessController in the java agent ([#18346](https://github.com/opensearch-project/OpenSearch/issues/18346))

modules/autotagging-commons/common/src/main/java/org/opensearch/rule/autotagging/Rule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* of a rule. The indexed view may differ in representation.
3232
* {
3333
* "id": "fwehf8302582mglfio349==",
34-
* "description": "Assign Query Group for Index Logs123"
34+
* "description": "Assign Workload Group for Index Logs123"
3535
* "index_pattern": ["logs123"],
3636
* "workload_group": "dev_workload_group_id",
3737
* "updated_at": "01-10-2025T21:23:21.456Z"

plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/action/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
*/
88

99
/**
10-
* Package for the action classes related to query groups in WorkloadManagementPlugin
10+
* Package for the action classes related to workload groups in WorkloadManagementPlugin
1111
*/
1212
package org.opensearch.plugin.wlm.action;

plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/rest/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
*/
88

99
/**
10-
* Package for the rest classes related to query groups in WorkloadManagementPlugin
10+
* Package for the rest classes related to workload groups in WorkloadManagementPlugin
1111
*/
1212
package org.opensearch.plugin.wlm.rest;

plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/service/WorkloadGroupPersistenceService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class WorkloadGroupPersistenceService {
5454
/**
5555
* max WorkloadGroup count setting name
5656
*/
57-
public static final String QUERY_GROUP_COUNT_SETTING_NAME = "node.workload_group.max_count";
57+
public static final String WORKLOAD_GROUP_COUNT_SETTING_NAME = "node.workload_group.max_count";
5858
/**
5959
* default max workloadGroup count on any node at any given point in time
6060
*/
@@ -67,7 +67,7 @@ public class WorkloadGroupPersistenceService {
6767
* max WorkloadGroup count setting
6868
*/
6969
public static final Setting<Integer> MAX_QUERY_GROUP_COUNT = Setting.intSetting(
70-
QUERY_GROUP_COUNT_SETTING_NAME,
70+
WORKLOAD_GROUP_COUNT_SETTING_NAME,
7171
DEFAULT_MAX_QUERY_GROUP_COUNT_VALUE,
7272
0,
7373
WorkloadGroupPersistenceService::validateMaxWorkloadGroupCount,
@@ -116,7 +116,7 @@ public void setMaxWorkloadGroupCount(int newMaxWorkloadGroupCount) {
116116
*/
117117
private static void validateMaxWorkloadGroupCount(int maxWorkloadGroupCount) {
118118
if (maxWorkloadGroupCount > DEFAULT_MAX_QUERY_GROUP_COUNT_VALUE || maxWorkloadGroupCount < MIN_QUERY_GROUP_COUNT_VALUE) {
119-
throw new IllegalArgumentException(QUERY_GROUP_COUNT_SETTING_NAME + " should be in range [1-100].");
119+
throw new IllegalArgumentException(WORKLOAD_GROUP_COUNT_SETTING_NAME + " should be in range [1-100].");
120120
}
121121
}
122122

@@ -162,7 +162,7 @@ ClusterState saveWorkloadGroupInClusterState(final WorkloadGroup workloadGroup,
162162

163163
// check if maxWorkloadGroupCount will breach
164164
if (existingWorkloadGroups.size() == maxWorkloadGroupCount) {
165-
logger.warn("{} value exceeded its assigned limit of {}.", QUERY_GROUP_COUNT_SETTING_NAME, maxWorkloadGroupCount);
165+
logger.warn("{} value exceeded its assigned limit of {}.", WORKLOAD_GROUP_COUNT_SETTING_NAME, maxWorkloadGroupCount);
166166
throw new IllegalStateException("Can't create more than " + maxWorkloadGroupCount + " WorkloadGroups in the system.");
167167
}
168168

plugins/workload-management/src/main/java/org/opensearch/plugin/wlm/service/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
*/
88

99
/**
10-
* Package for the service classes related to query groups in WorkloadManagementPlugin
10+
* Package for the service classes related to workload groups in WorkloadManagementPlugin
1111
*/
1212
package org.opensearch.plugin.wlm.service;

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/WorkloadManagementPluginTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void testGetFeatureTypeReturnsWorkloadGroupFeatureType() {
138138
assertEquals("workload_group", featureType.getName());
139139
}
140140

141-
public void testGetSettingsIncludesMaxQueryGroupCount() {
141+
public void testGetSettingsIncludesMaxWorkloadGroupCount() {
142142
List<?> settings = plugin.getSettings();
143143
assertTrue(settings.contains(WorkloadGroupPersistenceService.MAX_QUERY_GROUP_COUNT));
144144
}

plugins/workload-management/src/test/java/org/opensearch/plugin/wlm/service/WorkloadGroupPersistenceServiceTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.workloadGroupPersistenceService;
6060
import static org.opensearch.plugin.wlm.WorkloadGroupTestUtils.workloadGroupTwo;
6161
import static org.opensearch.plugin.wlm.action.WorkloadGroupActionTestUtils.updateWorkloadGroupRequest;
62-
import static org.opensearch.plugin.wlm.service.WorkloadGroupPersistenceService.QUERY_GROUP_COUNT_SETTING_NAME;
6362
import static org.opensearch.plugin.wlm.service.WorkloadGroupPersistenceService.SOURCE;
63+
import static org.opensearch.plugin.wlm.service.WorkloadGroupPersistenceService.WORKLOAD_GROUP_COUNT_SETTING_NAME;
6464
import static org.mockito.ArgumentMatchers.any;
6565
import static org.mockito.ArgumentMatchers.eq;
6666
import static org.mockito.Mockito.anyString;
@@ -155,7 +155,7 @@ public void testCreateWorkloadGroupOverflowCount() {
155155
.updatedAt(1690934400000L)
156156
.build();
157157
Metadata metadata = Metadata.builder().workloadGroups(Map.of(_ID_ONE, workloadGroupOne, _ID_TWO, workloadGroupTwo)).build();
158-
Settings settings = Settings.builder().put(QUERY_GROUP_COUNT_SETTING_NAME, 2).build();
158+
Settings settings = Settings.builder().put(WORKLOAD_GROUP_COUNT_SETTING_NAME, 2).build();
159159
ClusterSettings clusterSettings = new ClusterSettings(settings, clusterSettingsSet());
160160
ClusterService clusterService = new ClusterService(settings, clusterSettings, mock(ThreadPool.class));
161161
ClusterState clusterState = ClusterState.builder(new ClusterName("_name")).metadata(metadata).build();
@@ -174,7 +174,7 @@ public void testCreateWorkloadGroupOverflowCount() {
174174
* Tests the invalid value of {@code node.workload_group.max_count}
175175
*/
176176
public void testInvalidMaxWorkloadGroupCount() {
177-
Settings settings = Settings.builder().put(QUERY_GROUP_COUNT_SETTING_NAME, 2).build();
177+
Settings settings = Settings.builder().put(WORKLOAD_GROUP_COUNT_SETTING_NAME, 2).build();
178178
ClusterSettings clusterSettings = new ClusterSettings(settings, clusterSettingsSet());
179179
ClusterService clusterService = new ClusterService(settings, clusterSettings, mock(ThreadPool.class));
180180
WorkloadGroupPersistenceService workloadGroupPersistenceService = new WorkloadGroupPersistenceService(
@@ -189,7 +189,7 @@ public void testInvalidMaxWorkloadGroupCount() {
189189
* Tests the valid value of {@code node.workload_group.max_count}
190190
*/
191191
public void testValidMaxSandboxCountSetting() {
192-
Settings settings = Settings.builder().put(QUERY_GROUP_COUNT_SETTING_NAME, 100).build();
192+
Settings settings = Settings.builder().put(WORKLOAD_GROUP_COUNT_SETTING_NAME, 100).build();
193193
ClusterService clusterService = new ClusterService(settings, clusterSettings(), mock(ThreadPool.class));
194194
WorkloadGroupPersistenceService workloadGroupPersistenceService = new WorkloadGroupPersistenceService(
195195
clusterService,

server/src/main/java/org/opensearch/wlm/MutableWorkloadGroupFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public Map<ResourceType, Double> getResourceLimits() {
185185

186186
/**
187187
* This enum models the different WorkloadGroup resiliency modes
188-
* SOFT - means that this query group can consume more than query group resource limits if node is not in duress
188+
* SOFT - means that this workload group can consume more than workload group resource limits if node is not in duress
189189
* ENFORCED - means that it will never breach the assigned limits and will cancel as soon as the limits are breached
190190
* MONITOR - it will not cause any cancellation but just log the eligible task cancellations
191191
*/

server/src/main/java/org/opensearch/wlm/WorkloadGroupService.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected void doStart() {
139139
try {
140140
doRun();
141141
} catch (Exception e) {
142-
logger.debug("Exception occurred in Query Sandbox service", e);
142+
logger.debug("Exception occurred in Workload Group service", e);
143143
}
144144
}, this.workloadManagementSettings.getWorkloadGroupServiceRunInterval(), ThreadPool.Names.GENERIC);
145145
}
@@ -160,26 +160,26 @@ public void clusterChanged(ClusterChangedEvent event) {
160160
Metadata previousMetadata = event.previousState().metadata();
161161
Metadata currentMetadata = event.state().metadata();
162162

163-
// Extract the query groups from both the current and previous cluster states
163+
// Extract the workload groups from both the current and previous cluster states
164164
Map<String, WorkloadGroup> previousWorkloadGroups = previousMetadata.workloadGroups();
165165
Map<String, WorkloadGroup> currentWorkloadGroups = currentMetadata.workloadGroups();
166166

167-
// Detect new query groups added in the current cluster state
167+
// Detect new workload groups added in the current cluster state
168168
for (String workloadGroupName : currentWorkloadGroups.keySet()) {
169169
if (!previousWorkloadGroups.containsKey(workloadGroupName)) {
170-
// New query group detected
170+
// New workload group detected
171171
WorkloadGroup newWorkloadGroup = currentWorkloadGroups.get(workloadGroupName);
172-
// Perform any necessary actions with the new query group
172+
// Perform any necessary actions with the new workload group
173173
workloadGroupsStateAccessor.addNewWorkloadGroup(newWorkloadGroup.get_id());
174174
}
175175
}
176176

177-
// Detect query groups deleted in the current cluster state
177+
// Detect workload groups deleted in the current cluster state
178178
for (String workloadGroupName : previousWorkloadGroups.keySet()) {
179179
if (!currentWorkloadGroups.containsKey(workloadGroupName)) {
180-
// Query group deleted
180+
// Workload group deleted
181181
WorkloadGroup deletedWorkloadGroup = previousWorkloadGroups.get(workloadGroupName);
182-
// Perform any necessary actions with the deleted query group
182+
// Perform any necessary actions with the deleted workload group
183183
this.deletedWorkloadGroups.add(deletedWorkloadGroup);
184184
workloadGroupsStateAccessor.removeWorkloadGroup(deletedWorkloadGroup.get_id());
185185
}
@@ -188,13 +188,13 @@ public void clusterChanged(ClusterChangedEvent event) {
188188
}
189189

190190
/**
191-
* updates the failure stats for the query group
191+
* updates the failure stats for the workload group
192192
*
193-
* @param workloadGroupId query group identifier
193+
* @param workloadGroupId workload group identifier
194194
*/
195195
public void incrementFailuresFor(final String workloadGroupId) {
196196
WorkloadGroupState workloadGroupState = workloadGroupsStateAccessor.getWorkloadGroupState(workloadGroupId);
197-
// This can happen if the request failed for a deleted query group
197+
// This can happen if the request failed for a deleted workload group
198198
// or new workloadGroup is being created and has not been acknowledged yet
199199
if (workloadGroupState == null) {
200200
return;
@@ -203,7 +203,7 @@ public void incrementFailuresFor(final String workloadGroupId) {
203203
}
204204

205205
/**
206-
* @return node level query group stats
206+
* @return node level workload group stats
207207
*/
208208
public WorkloadGroupStats nodeStats(Set<String> workloadGroupIds, Boolean requestedBreached) {
209209
final Map<String, WorkloadGroupStatsHolder> statsHolderMap = new HashMap<>();
@@ -250,7 +250,7 @@ public boolean resourceLimitBreached(String id, WorkloadGroupState currentState)
250250
}
251251

252252
/**
253-
* @param workloadGroupId query group identifier
253+
* @param workloadGroupId workload group identifier
254254
*/
255255
public void rejectIfNeeded(String workloadGroupId) {
256256
if (workloadManagementSettings.getWlmMode() != WlmMode.ENABLED) {
@@ -260,8 +260,8 @@ public void rejectIfNeeded(String workloadGroupId) {
260260
if (workloadGroupId == null || workloadGroupId.equals(WorkloadGroupTask.DEFAULT_WORKLOAD_GROUP_ID_SUPPLIER.get())) return;
261261
WorkloadGroupState workloadGroupState = workloadGroupsStateAccessor.getWorkloadGroupState(workloadGroupId);
262262

263-
// This can happen if the request failed for a deleted query group
264-
// or new workloadGroup is being created and has not been acknowledged yet or invalid query group id
263+
// This can happen if the request failed for a deleted workload group
264+
// or new workloadGroup is being created and has not been acknowledged yet or invalid workload group id
265265
if (workloadGroupState == null) {
266266
return;
267267
}
@@ -348,7 +348,7 @@ public void onTaskCompleted(Task task) {
348348
final WorkloadGroupTask workloadGroupTask = (WorkloadGroupTask) task;
349349
String workloadGroupId = workloadGroupTask.getWorkloadGroupId();
350350

351-
// set the default workloadGroupId if not existing in the active query groups
351+
// set the default workloadGroupId if not existing in the active workload groups
352352
String finalWorkloadGroupId = workloadGroupId;
353353
boolean exists = activeWorkloadGroups.stream().anyMatch(workloadGroup -> workloadGroup.get_id().equals(finalWorkloadGroupId));
354354

0 commit comments

Comments
 (0)