This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new faf4c404ce0 [doc](workload) document explicit compute group
requirement for workload DDLs (#3763)
faf4c404ce0 is described below
commit faf4c404ce08deda820af9a07504b92222323df1
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Mon May 25 02:06:44 2026 -0700
[doc](workload) document explicit compute group requirement for workload
DDLs (#3763)
## Summary
Documents the contract change introduced by apache/doris#63505,
cross-checked against the actual Java code and `DorisParser.g4` grammar
(not just the PR description):
- **Cloud mode (storage-compute decoupled)**:
- `CREATE / ALTER / DROP WORKLOAD GROUP` must explicitly carry the `FOR
<compute_group>` clause; omitting it now raises `Must specify compute
group via 'FOR <compute_group>' in cloud mode.`
- The `workload_group` property of `CREATE / ALTER WORKLOAD POLICY` must
use the fully qualified `<compute_group>.<workload_group>` form; bare
names, extra dots, and empty segments are rejected.
- **Non-cloud mode (storage-compute coupled)**:
- The `FOR` clause is optional; the value is a resource group (Tag),
with the grammar shared with cloud mode for consistency. Omitting it
falls back to `Tag.VALUE_DEFAULT_TAG`.
- The `workload_group` property accepts either `<workload_group>` or
`<resource_group>.<workload_group>`.
## Files updated (8 files × 4 locations = 32)
EN current + EN version-4.x + ZH current + ZH version-4.x of:
- `sql-manual/.../CREATE-WORKLOAD-GROUP.md`
- `sql-manual/.../ALTER-WORKLOAD-GROUP.md`
- `sql-manual/.../DROP-WORKLOAD-GROUP.md`
- `sql-manual/.../CREATE-WORKLOAD-POLICY.md` (the EN file was a stale
copy of CREATE WORKLOAD GROUP content; rewritten to the correct policy
structure as part of this change)
- `sql-manual/.../ALTER-WORKLOAD-POLICY.md`
-
`admin-manual/workload-management/workload-group-bind-compute-group.md`
- `admin-manual/workload-management/workload-group.md`
- `admin-manual/workload-management/sql-blocking.md`
## Test plan
- [ ] Render the updated pages locally and verify the new caution / note
blocks render correctly.
- [ ] Verify internal cross-links (no `.md` / `.mdx` extensions)
resolve.
- [ ] Verify EN current and EN version-4.x stay byte-identical for these
8 files.
- [ ] Verify ZH current and ZH version-4.x stay byte-identical for these
8 files.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
---
.../workload-management/sql-blocking.md | 4 ++
.../workload-group-bind-compute-group.md | 24 ++++++-
.../workload-management/workload-group.md | 6 ++
.../compute-management/ALTER-WORKLOAD-GROUP.md | 28 +++++++-
.../compute-management/ALTER-WORKLOAD-POLICY.md | 9 +++
.../compute-management/CREATE-WORKLOAD-GROUP.md | 24 ++++++-
.../compute-management/CREATE-WORKLOAD-POLICY.md | 75 ++++++++++++++--------
.../compute-management/DROP-WORKLOAD-GROUP.md | 19 +++++-
.../workload-management/sql-blocking.md | 4 ++
.../workload-group-bind-compute-group.md | 24 ++++++-
.../workload-management/workload-group.md | 6 ++
.../compute-management/ALTER-WORKLOAD-GROUP.md | 28 +++++++-
.../compute-management/ALTER-WORKLOAD-POLICY.md | 9 +++
.../compute-management/CREATE-WORKLOAD-GROUP.md | 24 ++++++-
.../compute-management/CREATE-WORKLOAD-POLICY.md | 15 +++++
.../compute-management/DROP-WORKLOAD-GROUP.md | 19 +++++-
.../workload-management/sql-blocking.md | 4 ++
.../workload-group-bind-compute-group.md | 24 ++++++-
.../workload-management/workload-group.md | 6 ++
.../compute-management/ALTER-WORKLOAD-GROUP.md | 28 +++++++-
.../compute-management/ALTER-WORKLOAD-POLICY.md | 9 +++
.../compute-management/CREATE-WORKLOAD-GROUP.md | 24 ++++++-
.../compute-management/CREATE-WORKLOAD-POLICY.md | 15 +++++
.../compute-management/DROP-WORKLOAD-GROUP.md | 19 +++++-
.../workload-management/sql-blocking.md | 4 ++
.../workload-group-bind-compute-group.md | 24 ++++++-
.../workload-management/workload-group.md | 6 ++
.../compute-management/ALTER-WORKLOAD-GROUP.md | 28 +++++++-
.../compute-management/ALTER-WORKLOAD-POLICY.md | 9 +++
.../compute-management/CREATE-WORKLOAD-GROUP.md | 24 ++++++-
.../compute-management/CREATE-WORKLOAD-POLICY.md | 75 ++++++++++++++--------
.../compute-management/DROP-WORKLOAD-GROUP.md | 19 +++++-
32 files changed, 536 insertions(+), 100 deletions(-)
diff --git a/docs/admin-manual/workload-management/sql-blocking.md
b/docs/admin-manual/workload-management/sql-blocking.md
index 0b3a4a218ac..c0f7a729c99 100644
--- a/docs/admin-manual/workload-management/sql-blocking.md
+++ b/docs/admin-manual/workload-management/sql-blocking.md
@@ -255,6 +255,10 @@ ACTIONS(cancel_query)
PROPERTIES('workload_group'='normal');
```
+:::caution Cloud mode requires the fully qualified form
+The `'workload_group'='normal'` form above is only valid in **non-cloud
(storage-compute coupled) mode**. **In cloud (storage-compute decoupled) mode,
the fully qualified `<compute_group>.<workload_group>` form is required**, e.g.
`'workload_group'='compute_group_a.normal'`; otherwise the statement fails
with: `workload_group must be '<compute_group>.<workload_group>' in cloud
mode`. See [CREATE WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE
[...]
+:::
+
### Examples
<!-- Knowledge type: procedure -->
diff --git
a/docs/admin-manual/workload-management/workload-group-bind-compute-group.md
b/docs/admin-manual/workload-management/workload-group-bind-compute-group.md
index ebe9c97f6fd..ecefa7e4686 100644
--- a/docs/admin-manual/workload-management/workload-group-bind-compute-group.md
+++ b/docs/admin-manual/workload-management/workload-group-bind-compute-group.md
@@ -69,6 +69,11 @@ Doris has a default Compute Group mechanism: when a new BE
node is added without
| Storage-compute integrated | `default` |
:::
+:::caution Behavior of the `FOR` clause differs between architectures
+- **Cloud (storage-compute decoupled) mode**: CREATE / ALTER / DROP WORKLOAD
GROUP **must** explicitly include the `FOR <compute_group>` clause. Omitting it
raises: `Must specify compute group via 'FOR <compute_group>' in cloud mode.`
+- **Non-cloud (storage-compute coupled) mode**: The `FOR <compute_group>`
clause is optional. The value here actually refers to a resource group (Tag)
rather than a real compute group — the grammar is shared with cloud mode purely
for consistency. When omitted, it defaults to the default resource group
(`default`).
+:::
+
### Create a Workload Group
**Bind to a specific Compute Group:**
@@ -77,7 +82,7 @@ Doris has a default Compute Group mechanism: when a new BE
node is added without
CREATE WORKLOAD GROUP group_a FOR compute_group_a PROPERTIES
('cpu_share'='1024');
```
-**Without specifying a Compute Group (bind to the default Compute Group):**
+**Without specifying a Compute Group (non-cloud mode only, binds to the
default resource group):**
```sql
CREATE WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='1024');
@@ -91,7 +96,7 @@ CREATE WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='1024');
DROP WORKLOAD GROUP group_a FOR compute_group_a;
```
-**Without specifying a Compute Group (drop from the default Compute Group):**
+**Without specifying a Compute Group (non-cloud mode only, drops from the
default resource group):**
```sql
DROP WORKLOAD GROUP group_a;
@@ -105,7 +110,7 @@ DROP WORKLOAD GROUP group_a;
ALTER WORKLOAD GROUP group_a FOR compute_group_a PROPERTIES
('cpu_share'='2048');
```
-**Without specifying a Compute Group (alter the Workload Group in the default
Compute Group):**
+**Without specifying a Compute Group (non-cloud mode only, alters the Workload
Group in the default resource group):**
```sql
ALTER WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='2048');
@@ -115,6 +120,19 @@ ALTER WORKLOAD GROUP group_a PROPERTIES
('cpu_share'='2048');
The `ALTER` statement is used only to modify the properties of a Workload
Group. **It cannot modify the binding relationship between a Workload Group and
a Compute Group.**
:::
+### Referencing a Workload Group from a Workload Policy
+
+In the `workload_group` property of [CREATE WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY)
/ [ALTER WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY),
because a workload group belongs to a compute group, the value must follow
these rules:
+
+- **Cloud (storage-compute decoupled) mode**: The fully qualified form
`<compute_group>.<workload_group>` is required, for example:
+
+ ```sql
+ CREATE WORKLOAD POLICY p1 CONDITIONS(query_time > 3000)
ACTIONS(cancel_query)
+ PROPERTIES('workload_group'='compute_group_a.wg1');
+ ```
+
+- **Non-cloud (storage-compute coupled) mode**: Both `<workload_group>`
(default resource group) and `<resource_group>.<workload_group>` are accepted.
+
## Notes
<!-- Knowledge type: Constraints and limitations -->
diff --git a/docs/admin-manual/workload-management/workload-group.md
b/docs/admin-manual/workload-management/workload-group.md
index a62af354215..35ba62161af 100644
--- a/docs/admin-manual/workload-management/workload-group.md
+++ b/docs/admin-manual/workload-management/workload-group.md
@@ -194,6 +194,12 @@ PROPERTIES (
The CPU limit configured here is a soft limit. Starting from version 2.1, the
system automatically creates a group named `normal`, which cannot be deleted.
+:::caution Cloud mode requires an explicit compute group
+All CREATE / ALTER / DROP WORKLOAD GROUP examples in this document omit the
`FOR <compute_group>` clause, and they only work as-is in **non-cloud
(storage-compute coupled) mode**, where they apply to the default resource
group.
+
+**In cloud (storage-compute decoupled) mode, the `FOR <compute_group>` clause
must be specified explicitly**; otherwise the statement fails with: `Must
specify compute group via 'FOR <compute_group>' in cloud mode.` See [Bind
Workload Group to Compute Group](./workload-group-bind-compute-group) for
details.
+:::
+
For the complete syntax, see:
[CREATE-WORKLOAD-GROUP](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP)
### Step 3: Grant permissions to a user and bind the Workload Group
diff --git
a/docs/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
b/docs/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
index c6f53c900b6..fcdb520f4b4 100644
---
a/docs/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
+++
b/docs/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
@@ -14,21 +14,33 @@ This statement is used to modify the workload group.
```sql
ALTER WORKLOAD GROUP "<rg_name>"
+[FOR <compute_group>]
PROPERTIES (
`<property>`
[ , ... ]
);
```
+:::note
+The `ALTER` statement only modifies the workload group's properties; it
**cannot change the binding between a workload group and a compute group**. The
`FOR <compute_group>` clause is used to locate which compute group's workload
group is being modified.
+:::
+
## Parameters
-1.`<property>`
+1. `<compute_group>`
+
+ Specifies the compute group that contains the workload group to modify.
+
+ - **Cloud (storage-compute decoupled) mode**: The `FOR <compute_group>`
clause **must be explicitly specified**. Omitting it raises: `Must specify
compute group via 'FOR <compute_group>' in cloud mode.`
+ - **Non-cloud (storage-compute coupled) mode**: The `FOR <compute_group>`
clause is optional. The value here actually refers to a resource group (Tag);
the grammar is shared with cloud mode purely for consistency. When omitted, it
defaults to the workload group with the same name under the default resource
group (`default`).
-`<property>` format is `<key>` = `<value>`, and `<key>`'s specific optional
values can be referred to [workload
group](../../../../admin-manual/workload-management/workload-group.md).
+2. `<property>`
+
+ `<property>` format is `<key>` = `<value>`, and `<key>`'s specific
optional values can be referred to [workload
group](../../../../admin-manual/workload-management/workload-group.md).
## Examples
-1. Modify the workload group named g1:
+1. Modify the workload group named g1 (non-cloud mode: acts on g1 under the
default resource group):
```sql
alter workload group g1
@@ -36,4 +48,14 @@ PROPERTIES (
"max_cpu_percent"="20%",
"max_memory_percent"="40%"
);
+ ```
+
+2. Modify the workload group named g1 under `compute_group_a` (the clause is
required in cloud mode):
+
+ ```sql
+ alter workload group g1 for compute_group_a
+ properties (
+ "max_cpu_percent"="20%",
+ "max_memory_percent"="40%"
+ );
```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
b/docs/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
index d38382fe5f4..bd69473f699 100644
---
a/docs/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
+++
b/docs/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
@@ -30,6 +30,15 @@ Workload Policy's Name
2. priority: A positive integer ranging from 0 to 100, with a default value of
0. This represents the priority of the policy. The higher the value, the higher
the priority. The main role of this property is to select the policy with the
highest priority when multiple policies match.
3. workload_group: Currently, a policy can be bound to one workload group,
which means that this policy is only effective for a specific workload group.
The default is empty, which means it is effective for all queries.
+ Because a workload group itself belongs to a compute group, the value of
this property must follow these rules:
+
+ - **Cloud (storage-compute decoupled) mode**: The fully qualified form
`<compute_group>.<workload_group>` is required, e.g.
`'workload_group'='compute_group_a.wg1'`. The bare `<workload_group>` form,
more than one `.`, or empty segments (such as `.wg1` or `wg1.`) are rejected
with: `workload_group must be '<compute_group>.<workload_group>' in cloud mode`.
+ - **Non-cloud (storage-compute coupled) mode**: Two forms are accepted:
+ - `<workload_group>`: defaults the binding to the workload group with
the same name under the default resource group (`default`).
+ - `<resource_group>.<workload_group>`: explicitly specifies the
resource group. The prefix here actually refers to a resource group (Tag); the
grammar is shared with cloud mode purely for consistency.
+
+ More than one `.` or empty segments are likewise rejected with:
`workload_group must be '<workload_group>' or
'<resource_group>.<workload_group>' in non-cloud mode`.
+
## Access Control Requirements
You must have at least ADMIN_PRIV permissions.
diff --git
a/docs/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
b/docs/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
index 9f8dbbebe4e..eef03db3d03 100644
---
a/docs/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
+++
b/docs/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
@@ -17,6 +17,7 @@ This statement is used to create a workload group. Workload
groups enable the is
```sql
CREATE WORKLOAD GROUP [IF NOT EXISTS] "rg_name"
+[FOR <compute_group>]
PROPERTIES (
`<property>`
[ , ... ]
@@ -25,14 +26,21 @@ PROPERTIES (
## Parameters
-1.`<property>`
+1. `<compute_group>`
-`<property>` format is `<key>` = `<value>`, and `<key>`'s specific optional
values can be referred to [workload
group](../../../../admin-manual/workload-management/workload-group.md).
+ Specifies the compute group that the workload group is bound to.
+
+ - **Cloud (storage-compute decoupled) mode**: The `FOR <compute_group>`
clause **must be explicitly specified**. Omitting it raises: `Must specify
compute group via 'FOR <compute_group>' in cloud mode.`
+ - **Non-cloud (storage-compute coupled) mode**: The `FOR <compute_group>`
clause is optional. The value here actually refers to a resource group (Tag)
rather than a real compute group — the grammar is shared with cloud mode purely
for consistency. When omitted, it defaults to the default resource group
(`default`).
+
+2. `<property>`
+
+ `<property>` format is `<key>` = `<value>`, and `<key>`'s specific
optional values can be referred to [workload
group](../../../../admin-manual/workload-management/workload-group.md).
## Examples
-1. Create a workload group named g1:
+1. Create a workload group named g1 (non-cloud mode: bound to the default
resource group):
```sql
create workload group if not exists g1
@@ -41,3 +49,13 @@ PROPERTIES (
"max_memory_percent"="30%"
);
```
+
+2. Create a workload group named g1 bound to `compute_group_a` (the clause is
required in cloud mode):
+
+ ```sql
+ create workload group if not exists g1 for compute_group_a
+ properties (
+ "max_cpu_percent"="10%",
+ "max_memory_percent"="30%"
+ );
+ ```
diff --git
a/docs/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
b/docs/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
index 72674d56f15..d32978c4d14 100644
---
a/docs/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
+++
b/docs/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
@@ -1,54 +1,73 @@
---
{
- "title": "CREATE WORKLOAD GROUP | Compute Management",
+ "title": "CREATE WORKLOAD POLICY",
"language": "en",
- "description": "This statement is used to create a workload group.
Workload groups enable the isolation of cpu resources and memory resources on a
single be.",
- "sidebar_label": "CREATE WORKLOAD GROUP"
+ "description": "Create a Workload Policy, which is used to execute the
corresponding action on a query when it satisfies certain conditions."
}
---
-# CREATE WORKLOAD GROUP
-
## Description
-This statement is used to create a workload group. Workload groups enable the
isolation of cpu resources and memory resources on a single be.
+Create a Workload Policy, which is used to execute the corresponding action on
a query when it satisfies certain conditions.
-grammar:
+## Syntax
```sql
-CREATE WORKLOAD GROUP [IF NOT EXISTS] "rg_name"
-PROPERTIES (
- property_list
-);
+CREATE WORKLOAD POLICY [ IF NOT EXISTS ] <workload_policy_name>
+CONDITIONS(<conditions>) ACTIONS(<actions>)
+[ PROPERTIES (<properties>) ]
```
-illustrate:
+## Required Parameters
+
+1. `<workload_policy_name>`: The name of the Workload Policy.
+
+2. `<conditions>`
+ - be_scan_rows: The number of rows scanned by a SQL within a single BE
process. If the SQL is executed with multiple concurrencies on the BE, this is
the cumulative value of the concurrent executions.
+ - be_scan_bytes: The number of bytes scanned by a SQL within a single BE
process. If the SQL is executed with multiple concurrencies on the BE, this is
the cumulative value of the concurrent executions, in bytes.
+ - query_time: The execution time of a SQL on a single BE process, in
milliseconds.
+ - query_be_memory_bytes: Supported since version 2.1.5. The memory usage
of a SQL within a single BE process. If the SQL is executed with multiple
concurrencies on the BE, this is the cumulative value of the concurrent
executions, in bytes.
+
+3. `<actions>`
+ - set_session_variable: This action executes a `set_session_variable`
statement. A single Policy may contain multiple `set_session_variable` actions,
allowing one Policy to execute multiple session-variable updates.
+ - cancel_query: Cancel the query.
-Properties supported by property_list:
+## Optional Parameters
-* cpu_share: Required, used to set how much cpu time the workload group can
acquire, which can achieve soft isolation of cpu resources. cpu_share is a
relative value indicating the weight of cpu resources available to the running
workload group. For example, if a user creates 3 workload groups rg-a, rg-b and
rg-c with cpu_share of 10, 30 and 40 respectively, and at a certain moment rg-a
and rg-b are running tasks while rg-c has no tasks, then rg-a can get (10 / (10
+ 30)) = 25% of the cp [...]
+1. `<properties>`
+ - enabled: Can be true or false; default is true. true means the policy is
enabled; false means it is disabled.
+ - priority: A positive integer in the range 0 to 100; default is 0. Higher
values mean higher priority. When multiple policies match a query, the one with
the highest priority is selected.
+ - workload_group: A policy can be bound to one workload group, meaning
that the policy only takes effect for that workload group. Defaults to empty,
which means it applies to all queries.
-* memory_limit: Required, set the percentage of be memory that can be used by
the workload group. The absolute value of the workload group memory limit is:
`physical_memory * mem_limit * memory_limit`, where mem_limit is a be
configuration item. The total memory_limit of all workload groups in the system
must not exceed 100%. Workload groups are guaranteed to use the memory_limit
for the tasks in the group in most cases. When the workload group memory usage
exceeds this limit, tasks in t [...]
+ Because a workload group itself belongs to a compute group, the value
of this property must follow these rules:
-* enable_memory_overcommit: Optional, enable soft memory isolation for the
workload group, default is false. if set to false, the workload group is hard
memory isolated and the tasks with the largest memory usage will be canceled
immediately after the workload group memory usage exceeds the limit to release
the excess memory. if set to true, the workload group is hard memory isolated
and the tasks with the largest memory usage will be canceled immediately after
the workload group memory [...]
+ - **Cloud (storage-compute decoupled) mode**: The fully qualified form
`<compute_group>.<workload_group>` is required, e.g.
`'workload_group'='compute_group_a.wg1'`. The bare `<workload_group>` form,
more than one `.`, or empty segments (such as `.wg1` or `wg1.`) are rejected
with: `workload_group must be '<compute_group>.<workload_group>' in cloud mode`.
+ - **Non-cloud (storage-compute coupled) mode**: Two forms are accepted:
+ - `<workload_group>`: defaults the binding to the workload group
with the same name under the default resource group (`default`).
+ - `<resource_group>.<workload_group>`: explicitly specifies the
resource group. The prefix here actually refers to a resource group (Tag); the
grammar is shared with cloud mode purely for consistency.
+
+ More than one `.` or empty segments are likewise rejected with:
`workload_group must be '<workload_group>' or
'<resource_group>.<workload_group>' in non-cloud mode`.
-## Example
+## Access Control Requirements
-1. Create a workload group named g1:
+You must have at least ADMIN_PRIV permissions.
- ```sql
- create workload group if not exists g1
- properties (
- "cpu_share"="10",
- "memory_limit"="30%",
- "enable_memory_overcommit"="true"
- );
- ```
+## Examples
-## Keywords
+1. Create a Workload Policy that cancels any query running longer than 3
seconds:
-CREATE, WORKLOAD, GROUP
+ ```sql
+ create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query)
+ ```
+2. Create a Workload Policy that is disabled by default:
+ ```sql
+ create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query) properties('enabled'='false')
+ ```
+3. Create a policy that only takes effect on workload group `wg1` under
compute group `compute_group_a` in cloud mode (note the fully qualified form):
+ ```sql
+ create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query) properties('workload_group'='compute_group_a.wg1')
+ ```
diff --git
a/docs/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
b/docs/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
index 0c5db60e5fa..9383dc74a50 100644
---
a/docs/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
+++
b/docs/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
@@ -13,13 +13,28 @@ This statement is used to delete a workload group.
## Syntax
```sql
-DROP WORKLOAD GROUP [IF EXISTS] '<rg_name>'
+DROP WORKLOAD GROUP [IF EXISTS] '<rg_name>' [FOR <compute_group>]
```
+## Parameters
+
+1. `<compute_group>`
+
+ Specifies the compute group that contains the workload group to delete.
+
+ - **Cloud (storage-compute decoupled) mode**: The `FOR <compute_group>`
clause **must be explicitly specified**. Omitting it raises: `Must specify
compute group via 'FOR <compute_group>' in cloud mode.`
+ - **Non-cloud (storage-compute coupled) mode**: The `FOR <compute_group>`
clause is optional. The value here actually refers to a resource group (Tag);
the grammar is shared with cloud mode purely for consistency. When omitted, the
workload group with the same name under the default resource group (`default`)
is deleted.
+
## Examples
-1. Delete the workload group named g1:
+1. Delete the workload group named g1 (non-cloud mode: deletes g1 from the
default resource group):
```sql
drop workload group if exists g1;
+ ```
+
+2. Delete the workload group named g1 from `compute_group_a` (the clause is
required in cloud mode):
+
+ ```sql
+ drop workload group if exists g1 for compute_group_a;
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/sql-blocking.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/sql-blocking.md
index 58ee9dd8272..08ba3258efc 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/sql-blocking.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/sql-blocking.md
@@ -255,6 +255,10 @@ ACTIONS(cancel_query)
PROPERTIES('workload_group'='normal');
```
+:::caution 存算分离模式必须使用完整限定形式
+上例中的 `'workload_group'='normal'` 仅适用于**存算一体模式**。**存算分离模式(Cloud 模式)下必须使用
`<compute_group>.<workload_group>` 完整限定形式**,例如
`'workload_group'='compute_group_a.normal'`,否则会报错:`workload_group must be
'<compute_group>.<workload_group>' in cloud mode`。详见 [CREATE WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY)。
+:::
+
### 使用示例
<!-- 知识类型: 操作步骤 -->
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/workload-group-bind-compute-group.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/workload-group-bind-compute-group.md
index e4f7a6f448f..5794aba3bbd 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/workload-group-bind-compute-group.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/workload-group-bind-compute-group.md
@@ -69,6 +69,11 @@ Doris 中存在默认 Compute Group 机制:新增 BE 节点未指定归属时
| 存算一体 | `default` |
:::
+:::caution `FOR` 子句在两种架构下的行为差异
+- **存算分离模式(Cloud 模式)**:CREATE / ALTER / DROP WORKLOAD GROUP 必须显式带上 `FOR
<compute_group>` 子句。省略该子句将报错:`Must specify compute group via 'FOR
<compute_group>' in cloud mode.`
+- **存算一体模式(非 Cloud 模式)**:`FOR <compute_group>` 子句可选。此处的取值实际指代 Resource
Group(Tag),并非真正的 Compute Group,语法与存算分离模式保持一致只是为了形式统一。省略时默认作用于默认 Resource
Group(`default`)。
+:::
+
### 创建 Workload Group
**绑定到指定 Compute Group:**
@@ -77,7 +82,7 @@ Doris 中存在默认 Compute Group 机制:新增 BE 节点未指定归属时
CREATE WORKLOAD GROUP group_a FOR compute_group_a PROPERTIES
('cpu_share'='1024');
```
-**不指定 Compute Group(绑定到默认 Compute Group):**
+**不指定 Compute Group(仅适用于存算一体模式,绑定到默认 Resource Group):**
```sql
CREATE WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='1024');
@@ -91,7 +96,7 @@ CREATE WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='1024');
DROP WORKLOAD GROUP group_a FOR compute_group_a;
```
-**不指定 Compute Group(从默认 Compute Group 中删除):**
+**不指定 Compute Group(仅适用于存算一体模式,从默认 Resource Group 中删除):**
```sql
DROP WORKLOAD GROUP group_a;
@@ -105,7 +110,7 @@ DROP WORKLOAD GROUP group_a;
ALTER WORKLOAD GROUP group_a FOR compute_group_a PROPERTIES
('cpu_share'='2048');
```
-**不指定 Compute Group(修改默认 Compute Group 中的 Workload Group):**
+**不指定 Compute Group(仅适用于存算一体模式,修改默认 Resource Group 中的 Workload Group):**
```sql
ALTER WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='2048');
@@ -115,6 +120,19 @@ ALTER WORKLOAD GROUP group_a PROPERTIES
('cpu_share'='2048');
`ALTER` 语句仅用于修改 Workload Group 的属性,**不能修改 Workload Group 与 Compute Group
之间的绑定关系**。
:::
+### Workload Policy 中引用 Workload Group
+
+在 [CREATE WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY)
/ [ALTER WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY)
的 `workload_group` 属性中,由于 Workload Group 归属于 Compute Group,需要按以下规则书写:
+
+- **存算分离模式(Cloud 模式)**:必须使用 `<compute_group>.<workload_group>` 完整限定形式,例如:
+
+ ```sql
+ CREATE WORKLOAD POLICY p1 CONDITIONS(query_time > 3000)
ACTIONS(cancel_query)
+ PROPERTIES('workload_group'='compute_group_a.wg1');
+ ```
+
+- **存算一体模式(非 Cloud 模式)**:支持 `<workload_group>`(默认 Resource Group)或
`<resource_group>.<workload_group>` 两种形式。
+
## 注意事项
<!-- 知识类型: 约束与限制 -->
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/workload-group.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/workload-group.md
index dc91cc3a068..a9b6d39f73a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/workload-group.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/workload-management/workload-group.md
@@ -194,6 +194,12 @@ PROPERTIES (
此时配置的 CPU 限制为软限。自 2.1 版本起,系统自动创建名为 `normal` 的分组,不可删除。
+:::caution 存算分离模式必须显式指定 Compute Group
+本文中所有 CREATE / ALTER / DROP WORKLOAD GROUP 示例均省略了 `FOR <compute_group>`
子句,仅在**存算一体模式**下可直接使用,此时将作用于默认 Resource Group。
+
+**存算分离模式(Cloud 模式)下必须显式带上 `FOR <compute_group>` 子句**,否则会报错:`Must specify
compute group via 'FOR <compute_group>' in cloud mode.` 详见 [Workload Group 绑定
Compute Group](./workload-group-bind-compute-group)。
+:::
+
完整语法参考:[CREATE-WORKLOAD-GROUP](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP)
### 第三步:为用户授权并绑定 Workload Group
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
index 3c14f55829a..e58d3c8a86c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
@@ -14,22 +14,34 @@
```sql
ALTER WORKLOAD GROUP "<rg_name>"
+[FOR <compute_group>]
PROPERTIES (
`<property>`
[ , ... ]
);
```
+:::note
+`ALTER` 语句仅用于修改 Workload Group 的属性,**不能修改 Workload Group 与 Compute Group
的绑定关系**。`FOR <compute_group>` 子句用于定位需要修改的 Workload Group 所归属的 Compute Group。
+:::
+
## 参数
-1.`<property>`
+1. `<compute_group>`
+
+ 指定要修改的 Workload Group 所归属的 Compute Group。
+
+ - **存算分离模式(Cloud 模式)**:`FOR <compute_group>` 子句**必须显式指定**。若省略,将报错:`Must
specify compute group via 'FOR <compute_group>' in cloud mode.`
+ - **存算一体模式(非 Cloud 模式)**:`FOR <compute_group>` 子句可选。此处取值实际指代 Resource
Group(Tag),语法与存算分离模式保持一致只是为了形式统一。若省略,则默认作用于默认 Resource Group(`default`)下同名的
Workload Group。
-`<property>` 格式为 `<key>` = `<value>`,`<key>`的具体可选值可以参考[workload
group](../../../../admin-manual/workload-management/workload-group.md).
+2. `<property>`
+
+ `<property>` 格式为 `<key>` = `<value>`,`<key>` 的具体可选值可以参考 [workload
group](../../../../admin-manual/workload-management/workload-group.md).
## 示例
-1. 修改名为 g1 的资源组:
+1. 修改名为 g1 的资源组(存算一体模式下,作用于默认 Resource Group 中的 g1):
```sql
alter workload group g1
@@ -37,4 +49,14 @@ PROPERTIES (
"max_cpu_percent"="20%",
"max_memory_percent"="40%"
);
+ ```
+
+2. 修改 `compute_group_a` 中名为 g1 的 Workload Group(存算分离模式下该子句必须指定):
+
+ ```sql
+ alter workload group g1 for compute_group_a
+ properties (
+ "max_cpu_percent"="20%",
+ "max_memory_percent"="40%"
+ );
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
index edb364684a5..edf4b93f2bf 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
@@ -26,6 +26,15 @@ ALTER WORKLOAD POLICY <workload_policy_name> PROPERTIES(
<properties> )
- priority,取值范围为 0 到 100 的正整数,默认值为 0,代表 Policy
的优先级,该值越大,优先级越高。这个属性的主要作用是,当匹配到多个 Policy 时,选择优先级最高的 Policy。
- workload_group,目前一个 Policy 可以绑定一个 Workload Group,代表这个 Policy 只对某个
Workload Group 生效。默认为空,代表对所有查询生效。
+ 由于 Workload Group 自身归属于 Compute Group,因此该属性的取值需要按以下规则书写:
+
+ - **存算分离模式(Cloud 模式)**:必须使用完整的 `<compute_group>.<workload_group>`
形式,例如 `'workload_group'='compute_group_a.wg1'`。如果使用裸的 `<workload_group>`
形式、出现多于一个的 `.`、或前后存在空段(如 `.wg1`、`wg1.`),都会被拒绝并抛出 `workload_group must be
'<compute_group>.<workload_group>' in cloud mode` 错误。
+ - **存算一体模式(非 Cloud 模式)**:支持以下两种形式:
+ - `<workload_group>`:默认绑定到默认 Resource Group(`default`)下的同名
Workload Group。
+ - `<resource_group>.<workload_group>`:显式指定 Resource
Group。此处的前缀实际指代 Resource Group(Tag),与存算分离模式共用语法只是为了形式统一。
+
+ 同样不允许多于一个的 `.` 或空段,违反将抛出 `workload_group must be
'<workload_group>' or '<resource_group>.<workload_group>' in non-cloud mode` 错误。
+
## 权限控制
至少具有`ADMIN_PRIV`权限
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
index b8b40fc4689..4439789f076 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
@@ -14,6 +14,7 @@
```sql
CREATE WORKLOAD GROUP [IF NOT EXISTS] "<rg_name>"
+[FOR <compute_group>]
PROPERTIES (
`<property>`
[ , ... ]
@@ -22,15 +23,22 @@ PROPERTIES (
## 参数
-1.`<property>`
+1. `<compute_group>`
-`<property>` 格式为 `<key>` = `<value>`,`<key>`的具体可选值可以参考[workload
group](../../../../admin-manual/workload-management/workload-group.md).
+ 指定 Workload Group 绑定的 Compute Group。
+
+ - **存算分离模式(Cloud 模式)**:`FOR <compute_group>` 子句**必须显式指定**,用于将 Workload
Group 绑定到具体的 Compute Group。若省略,将报错:`Must specify compute group via 'FOR
<compute_group>' in cloud mode.`
+ - **存算一体模式(非 Cloud 模式)**:`FOR <compute_group>` 子句可选。此处的取值实际指代 Resource
Group(Tag),并非真正的 Compute Group,语法与存算分离模式保持一致只是为了形式统一。若省略,则默认绑定到默认的 Resource
Group(`default`)。
+
+2. `<property>`
+
+ `<property>` 格式为 `<key>` = `<value>`,`<key>` 的具体可选值可以参考 [workload
group](../../../../admin-manual/workload-management/workload-group.md).
## 示例
-1. 创建名为 g1 的资源组:
+1. 创建名为 g1 的资源组(存算一体模式下,绑定到默认 Resource Group):
```sql
create workload group if not exists g1
@@ -38,4 +46,14 @@ PROPERTIES (
"max_cpu_percent"="10%",
"max_memory_percent"="30%"
);
+ ```
+
+2. 创建名为 g1 的 Workload Group,并绑定到 `compute_group_a`(存算分离模式下该子句必须指定):
+
+ ```sql
+ create workload group if not exists g1 for compute_group_a
+ properties (
+ "max_cpu_percent"="10%",
+ "max_memory_percent"="30%"
+ );
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
index c6cef5e5e81..71647b128f0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
@@ -39,6 +39,15 @@ CONDITIONS(<conditions>) ACTIONS(<actions>)
- priority,取值范围为 0 到 100 的正整数,默认值为 0,代表 Policy
的优先级,该值越大,优先级越高。这个属性的主要作用是,当匹配到多个 Policy 时,选择优先级最高的 Policy。
- workload_group,目前一个 Policy 可以绑定一个 Workload Group,代表这个 Policy 只对某个
Workload Group 生效。默认为空,代表对所有查询生效。
+ 由于 Workload Group 自身归属于 Compute Group,因此该属性的取值需要按以下规则书写:
+
+ - **存算分离模式(Cloud 模式)**:必须使用完整的 `<compute_group>.<workload_group>`
形式,例如 `'workload_group'='compute_group_a.wg1'`。如果使用裸的 `<workload_group>`
形式、出现多于一个的 `.`、或前后存在空段(如 `.wg1`、`wg1.`),都会被拒绝并抛出 `workload_group must be
'<compute_group>.<workload_group>' in cloud mode` 错误。
+ - **存算一体模式(非 Cloud 模式)**:支持以下两种形式:
+ - `<workload_group>`:默认绑定到默认 Resource Group(`default`)下的同名
Workload Group。
+ - `<resource_group>.<workload_group>`:显式指定 Resource
Group。此处的前缀实际指代 Resource Group(Tag),与存算分离模式共用语法只是为了形式统一。
+
+ 同样不允许多于一个的 `.` 或空段,违反将抛出 `workload_group must be
'<workload_group>' or '<resource_group>.<workload_group>' in non-cloud mode` 错误。
+
## 权限控制
至少具备`ADMIN_PRIV`权限
@@ -55,4 +64,10 @@ CONDITIONS(<conditions>) ACTIONS(<actions>)
```Java
create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query) properties('enabled'='false')
+ ```
+
+3. 新建一个只对存算分离模式下 `compute_group_a` 中的 Workload Group `wg1` 生效的 Policy(注意完整限定形式)
+
+ ```Java
+ create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query) properties('workload_group'='compute_group_a.wg1')
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
index cd3bc1cb8bf..58cb0bded10 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
@@ -14,13 +14,28 @@
## 语法
```sql
-DROP WORKLOAD GROUP [IF EXISTS] '<rg_name>'
+DROP WORKLOAD GROUP [IF EXISTS] '<rg_name>' [FOR <compute_group>]
```
+## 参数
+
+1. `<compute_group>`
+
+ 指定要删除的 Workload Group 所归属的 Compute Group。
+
+ - **存算分离模式(Cloud 模式)**:`FOR <compute_group>` 子句**必须显式指定**。若省略,将报错:`Must
specify compute group via 'FOR <compute_group>' in cloud mode.`
+ - **存算一体模式(非 Cloud 模式)**:`FOR <compute_group>` 子句可选。此处取值实际指代 Resource
Group(Tag),语法与存算分离模式保持一致只是为了形式统一。若省略,则默认从默认 Resource Group(`default`)中删除同名的
Workload Group。
+
## 示例
-1. 删除名为 g1 的资源组:
+1. 删除名为 g1 的资源组(存算一体模式下,从默认 Resource Group 中删除):
```sql
drop workload group if exists g1;
```
+
+2. 从 `compute_group_a` 中删除名为 g1 的 Workload Group(存算分离模式下该子句必须指定):
+
+ ```sql
+ drop workload group if exists g1 for compute_group_a;
+ ```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/sql-blocking.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/sql-blocking.md
index 58ee9dd8272..08ba3258efc 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/sql-blocking.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/sql-blocking.md
@@ -255,6 +255,10 @@ ACTIONS(cancel_query)
PROPERTIES('workload_group'='normal');
```
+:::caution 存算分离模式必须使用完整限定形式
+上例中的 `'workload_group'='normal'` 仅适用于**存算一体模式**。**存算分离模式(Cloud 模式)下必须使用
`<compute_group>.<workload_group>` 完整限定形式**,例如
`'workload_group'='compute_group_a.normal'`,否则会报错:`workload_group must be
'<compute_group>.<workload_group>' in cloud mode`。详见 [CREATE WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY)。
+:::
+
### 使用示例
<!-- 知识类型: 操作步骤 -->
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/workload-group-bind-compute-group.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/workload-group-bind-compute-group.md
index e4f7a6f448f..5794aba3bbd 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/workload-group-bind-compute-group.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/workload-group-bind-compute-group.md
@@ -69,6 +69,11 @@ Doris 中存在默认 Compute Group 机制:新增 BE 节点未指定归属时
| 存算一体 | `default` |
:::
+:::caution `FOR` 子句在两种架构下的行为差异
+- **存算分离模式(Cloud 模式)**:CREATE / ALTER / DROP WORKLOAD GROUP 必须显式带上 `FOR
<compute_group>` 子句。省略该子句将报错:`Must specify compute group via 'FOR
<compute_group>' in cloud mode.`
+- **存算一体模式(非 Cloud 模式)**:`FOR <compute_group>` 子句可选。此处的取值实际指代 Resource
Group(Tag),并非真正的 Compute Group,语法与存算分离模式保持一致只是为了形式统一。省略时默认作用于默认 Resource
Group(`default`)。
+:::
+
### 创建 Workload Group
**绑定到指定 Compute Group:**
@@ -77,7 +82,7 @@ Doris 中存在默认 Compute Group 机制:新增 BE 节点未指定归属时
CREATE WORKLOAD GROUP group_a FOR compute_group_a PROPERTIES
('cpu_share'='1024');
```
-**不指定 Compute Group(绑定到默认 Compute Group):**
+**不指定 Compute Group(仅适用于存算一体模式,绑定到默认 Resource Group):**
```sql
CREATE WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='1024');
@@ -91,7 +96,7 @@ CREATE WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='1024');
DROP WORKLOAD GROUP group_a FOR compute_group_a;
```
-**不指定 Compute Group(从默认 Compute Group 中删除):**
+**不指定 Compute Group(仅适用于存算一体模式,从默认 Resource Group 中删除):**
```sql
DROP WORKLOAD GROUP group_a;
@@ -105,7 +110,7 @@ DROP WORKLOAD GROUP group_a;
ALTER WORKLOAD GROUP group_a FOR compute_group_a PROPERTIES
('cpu_share'='2048');
```
-**不指定 Compute Group(修改默认 Compute Group 中的 Workload Group):**
+**不指定 Compute Group(仅适用于存算一体模式,修改默认 Resource Group 中的 Workload Group):**
```sql
ALTER WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='2048');
@@ -115,6 +120,19 @@ ALTER WORKLOAD GROUP group_a PROPERTIES
('cpu_share'='2048');
`ALTER` 语句仅用于修改 Workload Group 的属性,**不能修改 Workload Group 与 Compute Group
之间的绑定关系**。
:::
+### Workload Policy 中引用 Workload Group
+
+在 [CREATE WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY)
/ [ALTER WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY)
的 `workload_group` 属性中,由于 Workload Group 归属于 Compute Group,需要按以下规则书写:
+
+- **存算分离模式(Cloud 模式)**:必须使用 `<compute_group>.<workload_group>` 完整限定形式,例如:
+
+ ```sql
+ CREATE WORKLOAD POLICY p1 CONDITIONS(query_time > 3000)
ACTIONS(cancel_query)
+ PROPERTIES('workload_group'='compute_group_a.wg1');
+ ```
+
+- **存算一体模式(非 Cloud 模式)**:支持 `<workload_group>`(默认 Resource Group)或
`<resource_group>.<workload_group>` 两种形式。
+
## 注意事项
<!-- 知识类型: 约束与限制 -->
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/workload-group.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/workload-group.md
index dc91cc3a068..a9b6d39f73a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/workload-group.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/admin-manual/workload-management/workload-group.md
@@ -194,6 +194,12 @@ PROPERTIES (
此时配置的 CPU 限制为软限。自 2.1 版本起,系统自动创建名为 `normal` 的分组,不可删除。
+:::caution 存算分离模式必须显式指定 Compute Group
+本文中所有 CREATE / ALTER / DROP WORKLOAD GROUP 示例均省略了 `FOR <compute_group>`
子句,仅在**存算一体模式**下可直接使用,此时将作用于默认 Resource Group。
+
+**存算分离模式(Cloud 模式)下必须显式带上 `FOR <compute_group>` 子句**,否则会报错:`Must specify
compute group via 'FOR <compute_group>' in cloud mode.` 详见 [Workload Group 绑定
Compute Group](./workload-group-bind-compute-group)。
+:::
+
完整语法参考:[CREATE-WORKLOAD-GROUP](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP)
### 第三步:为用户授权并绑定 Workload Group
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
index 3c14f55829a..e58d3c8a86c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
@@ -14,22 +14,34 @@
```sql
ALTER WORKLOAD GROUP "<rg_name>"
+[FOR <compute_group>]
PROPERTIES (
`<property>`
[ , ... ]
);
```
+:::note
+`ALTER` 语句仅用于修改 Workload Group 的属性,**不能修改 Workload Group 与 Compute Group
的绑定关系**。`FOR <compute_group>` 子句用于定位需要修改的 Workload Group 所归属的 Compute Group。
+:::
+
## 参数
-1.`<property>`
+1. `<compute_group>`
+
+ 指定要修改的 Workload Group 所归属的 Compute Group。
+
+ - **存算分离模式(Cloud 模式)**:`FOR <compute_group>` 子句**必须显式指定**。若省略,将报错:`Must
specify compute group via 'FOR <compute_group>' in cloud mode.`
+ - **存算一体模式(非 Cloud 模式)**:`FOR <compute_group>` 子句可选。此处取值实际指代 Resource
Group(Tag),语法与存算分离模式保持一致只是为了形式统一。若省略,则默认作用于默认 Resource Group(`default`)下同名的
Workload Group。
-`<property>` 格式为 `<key>` = `<value>`,`<key>`的具体可选值可以参考[workload
group](../../../../admin-manual/workload-management/workload-group.md).
+2. `<property>`
+
+ `<property>` 格式为 `<key>` = `<value>`,`<key>` 的具体可选值可以参考 [workload
group](../../../../admin-manual/workload-management/workload-group.md).
## 示例
-1. 修改名为 g1 的资源组:
+1. 修改名为 g1 的资源组(存算一体模式下,作用于默认 Resource Group 中的 g1):
```sql
alter workload group g1
@@ -37,4 +49,14 @@ PROPERTIES (
"max_cpu_percent"="20%",
"max_memory_percent"="40%"
);
+ ```
+
+2. 修改 `compute_group_a` 中名为 g1 的 Workload Group(存算分离模式下该子句必须指定):
+
+ ```sql
+ alter workload group g1 for compute_group_a
+ properties (
+ "max_cpu_percent"="20%",
+ "max_memory_percent"="40%"
+ );
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
index edb364684a5..edf4b93f2bf 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
@@ -26,6 +26,15 @@ ALTER WORKLOAD POLICY <workload_policy_name> PROPERTIES(
<properties> )
- priority,取值范围为 0 到 100 的正整数,默认值为 0,代表 Policy
的优先级,该值越大,优先级越高。这个属性的主要作用是,当匹配到多个 Policy 时,选择优先级最高的 Policy。
- workload_group,目前一个 Policy 可以绑定一个 Workload Group,代表这个 Policy 只对某个
Workload Group 生效。默认为空,代表对所有查询生效。
+ 由于 Workload Group 自身归属于 Compute Group,因此该属性的取值需要按以下规则书写:
+
+ - **存算分离模式(Cloud 模式)**:必须使用完整的 `<compute_group>.<workload_group>`
形式,例如 `'workload_group'='compute_group_a.wg1'`。如果使用裸的 `<workload_group>`
形式、出现多于一个的 `.`、或前后存在空段(如 `.wg1`、`wg1.`),都会被拒绝并抛出 `workload_group must be
'<compute_group>.<workload_group>' in cloud mode` 错误。
+ - **存算一体模式(非 Cloud 模式)**:支持以下两种形式:
+ - `<workload_group>`:默认绑定到默认 Resource Group(`default`)下的同名
Workload Group。
+ - `<resource_group>.<workload_group>`:显式指定 Resource
Group。此处的前缀实际指代 Resource Group(Tag),与存算分离模式共用语法只是为了形式统一。
+
+ 同样不允许多于一个的 `.` 或空段,违反将抛出 `workload_group must be
'<workload_group>' or '<resource_group>.<workload_group>' in non-cloud mode` 错误。
+
## 权限控制
至少具有`ADMIN_PRIV`权限
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
index b8b40fc4689..4439789f076 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
@@ -14,6 +14,7 @@
```sql
CREATE WORKLOAD GROUP [IF NOT EXISTS] "<rg_name>"
+[FOR <compute_group>]
PROPERTIES (
`<property>`
[ , ... ]
@@ -22,15 +23,22 @@ PROPERTIES (
## 参数
-1.`<property>`
+1. `<compute_group>`
-`<property>` 格式为 `<key>` = `<value>`,`<key>`的具体可选值可以参考[workload
group](../../../../admin-manual/workload-management/workload-group.md).
+ 指定 Workload Group 绑定的 Compute Group。
+
+ - **存算分离模式(Cloud 模式)**:`FOR <compute_group>` 子句**必须显式指定**,用于将 Workload
Group 绑定到具体的 Compute Group。若省略,将报错:`Must specify compute group via 'FOR
<compute_group>' in cloud mode.`
+ - **存算一体模式(非 Cloud 模式)**:`FOR <compute_group>` 子句可选。此处的取值实际指代 Resource
Group(Tag),并非真正的 Compute Group,语法与存算分离模式保持一致只是为了形式统一。若省略,则默认绑定到默认的 Resource
Group(`default`)。
+
+2. `<property>`
+
+ `<property>` 格式为 `<key>` = `<value>`,`<key>` 的具体可选值可以参考 [workload
group](../../../../admin-manual/workload-management/workload-group.md).
## 示例
-1. 创建名为 g1 的资源组:
+1. 创建名为 g1 的资源组(存算一体模式下,绑定到默认 Resource Group):
```sql
create workload group if not exists g1
@@ -38,4 +46,14 @@ PROPERTIES (
"max_cpu_percent"="10%",
"max_memory_percent"="30%"
);
+ ```
+
+2. 创建名为 g1 的 Workload Group,并绑定到 `compute_group_a`(存算分离模式下该子句必须指定):
+
+ ```sql
+ create workload group if not exists g1 for compute_group_a
+ properties (
+ "max_cpu_percent"="10%",
+ "max_memory_percent"="30%"
+ );
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
index c6cef5e5e81..71647b128f0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
@@ -39,6 +39,15 @@ CONDITIONS(<conditions>) ACTIONS(<actions>)
- priority,取值范围为 0 到 100 的正整数,默认值为 0,代表 Policy
的优先级,该值越大,优先级越高。这个属性的主要作用是,当匹配到多个 Policy 时,选择优先级最高的 Policy。
- workload_group,目前一个 Policy 可以绑定一个 Workload Group,代表这个 Policy 只对某个
Workload Group 生效。默认为空,代表对所有查询生效。
+ 由于 Workload Group 自身归属于 Compute Group,因此该属性的取值需要按以下规则书写:
+
+ - **存算分离模式(Cloud 模式)**:必须使用完整的 `<compute_group>.<workload_group>`
形式,例如 `'workload_group'='compute_group_a.wg1'`。如果使用裸的 `<workload_group>`
形式、出现多于一个的 `.`、或前后存在空段(如 `.wg1`、`wg1.`),都会被拒绝并抛出 `workload_group must be
'<compute_group>.<workload_group>' in cloud mode` 错误。
+ - **存算一体模式(非 Cloud 模式)**:支持以下两种形式:
+ - `<workload_group>`:默认绑定到默认 Resource Group(`default`)下的同名
Workload Group。
+ - `<resource_group>.<workload_group>`:显式指定 Resource
Group。此处的前缀实际指代 Resource Group(Tag),与存算分离模式共用语法只是为了形式统一。
+
+ 同样不允许多于一个的 `.` 或空段,违反将抛出 `workload_group must be
'<workload_group>' or '<resource_group>.<workload_group>' in non-cloud mode` 错误。
+
## 权限控制
至少具备`ADMIN_PRIV`权限
@@ -55,4 +64,10 @@ CONDITIONS(<conditions>) ACTIONS(<actions>)
```Java
create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query) properties('enabled'='false')
+ ```
+
+3. 新建一个只对存算分离模式下 `compute_group_a` 中的 Workload Group `wg1` 生效的 Policy(注意完整限定形式)
+
+ ```Java
+ create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query) properties('workload_group'='compute_group_a.wg1')
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
index cd3bc1cb8bf..58cb0bded10 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
@@ -14,13 +14,28 @@
## 语法
```sql
-DROP WORKLOAD GROUP [IF EXISTS] '<rg_name>'
+DROP WORKLOAD GROUP [IF EXISTS] '<rg_name>' [FOR <compute_group>]
```
+## 参数
+
+1. `<compute_group>`
+
+ 指定要删除的 Workload Group 所归属的 Compute Group。
+
+ - **存算分离模式(Cloud 模式)**:`FOR <compute_group>` 子句**必须显式指定**。若省略,将报错:`Must
specify compute group via 'FOR <compute_group>' in cloud mode.`
+ - **存算一体模式(非 Cloud 模式)**:`FOR <compute_group>` 子句可选。此处取值实际指代 Resource
Group(Tag),语法与存算分离模式保持一致只是为了形式统一。若省略,则默认从默认 Resource Group(`default`)中删除同名的
Workload Group。
+
## 示例
-1. 删除名为 g1 的资源组:
+1. 删除名为 g1 的资源组(存算一体模式下,从默认 Resource Group 中删除):
```sql
drop workload group if exists g1;
```
+
+2. 从 `compute_group_a` 中删除名为 g1 的 Workload Group(存算分离模式下该子句必须指定):
+
+ ```sql
+ drop workload group if exists g1 for compute_group_a;
+ ```
diff --git
a/versioned_docs/version-4.x/admin-manual/workload-management/sql-blocking.md
b/versioned_docs/version-4.x/admin-manual/workload-management/sql-blocking.md
index 0b3a4a218ac..c0f7a729c99 100644
---
a/versioned_docs/version-4.x/admin-manual/workload-management/sql-blocking.md
+++
b/versioned_docs/version-4.x/admin-manual/workload-management/sql-blocking.md
@@ -255,6 +255,10 @@ ACTIONS(cancel_query)
PROPERTIES('workload_group'='normal');
```
+:::caution Cloud mode requires the fully qualified form
+The `'workload_group'='normal'` form above is only valid in **non-cloud
(storage-compute coupled) mode**. **In cloud (storage-compute decoupled) mode,
the fully qualified `<compute_group>.<workload_group>` form is required**, e.g.
`'workload_group'='compute_group_a.normal'`; otherwise the statement fails
with: `workload_group must be '<compute_group>.<workload_group>' in cloud
mode`. See [CREATE WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE
[...]
+:::
+
### Examples
<!-- Knowledge type: procedure -->
diff --git
a/versioned_docs/version-4.x/admin-manual/workload-management/workload-group-bind-compute-group.md
b/versioned_docs/version-4.x/admin-manual/workload-management/workload-group-bind-compute-group.md
index ebe9c97f6fd..ecefa7e4686 100644
---
a/versioned_docs/version-4.x/admin-manual/workload-management/workload-group-bind-compute-group.md
+++
b/versioned_docs/version-4.x/admin-manual/workload-management/workload-group-bind-compute-group.md
@@ -69,6 +69,11 @@ Doris has a default Compute Group mechanism: when a new BE
node is added without
| Storage-compute integrated | `default` |
:::
+:::caution Behavior of the `FOR` clause differs between architectures
+- **Cloud (storage-compute decoupled) mode**: CREATE / ALTER / DROP WORKLOAD
GROUP **must** explicitly include the `FOR <compute_group>` clause. Omitting it
raises: `Must specify compute group via 'FOR <compute_group>' in cloud mode.`
+- **Non-cloud (storage-compute coupled) mode**: The `FOR <compute_group>`
clause is optional. The value here actually refers to a resource group (Tag)
rather than a real compute group — the grammar is shared with cloud mode purely
for consistency. When omitted, it defaults to the default resource group
(`default`).
+:::
+
### Create a Workload Group
**Bind to a specific Compute Group:**
@@ -77,7 +82,7 @@ Doris has a default Compute Group mechanism: when a new BE
node is added without
CREATE WORKLOAD GROUP group_a FOR compute_group_a PROPERTIES
('cpu_share'='1024');
```
-**Without specifying a Compute Group (bind to the default Compute Group):**
+**Without specifying a Compute Group (non-cloud mode only, binds to the
default resource group):**
```sql
CREATE WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='1024');
@@ -91,7 +96,7 @@ CREATE WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='1024');
DROP WORKLOAD GROUP group_a FOR compute_group_a;
```
-**Without specifying a Compute Group (drop from the default Compute Group):**
+**Without specifying a Compute Group (non-cloud mode only, drops from the
default resource group):**
```sql
DROP WORKLOAD GROUP group_a;
@@ -105,7 +110,7 @@ DROP WORKLOAD GROUP group_a;
ALTER WORKLOAD GROUP group_a FOR compute_group_a PROPERTIES
('cpu_share'='2048');
```
-**Without specifying a Compute Group (alter the Workload Group in the default
Compute Group):**
+**Without specifying a Compute Group (non-cloud mode only, alters the Workload
Group in the default resource group):**
```sql
ALTER WORKLOAD GROUP group_a PROPERTIES ('cpu_share'='2048');
@@ -115,6 +120,19 @@ ALTER WORKLOAD GROUP group_a PROPERTIES
('cpu_share'='2048');
The `ALTER` statement is used only to modify the properties of a Workload
Group. **It cannot modify the binding relationship between a Workload Group and
a Compute Group.**
:::
+### Referencing a Workload Group from a Workload Policy
+
+In the `workload_group` property of [CREATE WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY)
/ [ALTER WORKLOAD
POLICY](../../sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY),
because a workload group belongs to a compute group, the value must follow
these rules:
+
+- **Cloud (storage-compute decoupled) mode**: The fully qualified form
`<compute_group>.<workload_group>` is required, for example:
+
+ ```sql
+ CREATE WORKLOAD POLICY p1 CONDITIONS(query_time > 3000)
ACTIONS(cancel_query)
+ PROPERTIES('workload_group'='compute_group_a.wg1');
+ ```
+
+- **Non-cloud (storage-compute coupled) mode**: Both `<workload_group>`
(default resource group) and `<resource_group>.<workload_group>` are accepted.
+
## Notes
<!-- Knowledge type: Constraints and limitations -->
diff --git
a/versioned_docs/version-4.x/admin-manual/workload-management/workload-group.md
b/versioned_docs/version-4.x/admin-manual/workload-management/workload-group.md
index a62af354215..35ba62161af 100644
---
a/versioned_docs/version-4.x/admin-manual/workload-management/workload-group.md
+++
b/versioned_docs/version-4.x/admin-manual/workload-management/workload-group.md
@@ -194,6 +194,12 @@ PROPERTIES (
The CPU limit configured here is a soft limit. Starting from version 2.1, the
system automatically creates a group named `normal`, which cannot be deleted.
+:::caution Cloud mode requires an explicit compute group
+All CREATE / ALTER / DROP WORKLOAD GROUP examples in this document omit the
`FOR <compute_group>` clause, and they only work as-is in **non-cloud
(storage-compute coupled) mode**, where they apply to the default resource
group.
+
+**In cloud (storage-compute decoupled) mode, the `FOR <compute_group>` clause
must be specified explicitly**; otherwise the statement fails with: `Must
specify compute group via 'FOR <compute_group>' in cloud mode.` See [Bind
Workload Group to Compute Group](./workload-group-bind-compute-group) for
details.
+:::
+
For the complete syntax, see:
[CREATE-WORKLOAD-GROUP](../../sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP)
### Step 3: Grant permissions to a user and bind the Workload Group
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
index c6f53c900b6..fcdb520f4b4 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-GROUP.md
@@ -14,21 +14,33 @@ This statement is used to modify the workload group.
```sql
ALTER WORKLOAD GROUP "<rg_name>"
+[FOR <compute_group>]
PROPERTIES (
`<property>`
[ , ... ]
);
```
+:::note
+The `ALTER` statement only modifies the workload group's properties; it
**cannot change the binding between a workload group and a compute group**. The
`FOR <compute_group>` clause is used to locate which compute group's workload
group is being modified.
+:::
+
## Parameters
-1.`<property>`
+1. `<compute_group>`
+
+ Specifies the compute group that contains the workload group to modify.
+
+ - **Cloud (storage-compute decoupled) mode**: The `FOR <compute_group>`
clause **must be explicitly specified**. Omitting it raises: `Must specify
compute group via 'FOR <compute_group>' in cloud mode.`
+ - **Non-cloud (storage-compute coupled) mode**: The `FOR <compute_group>`
clause is optional. The value here actually refers to a resource group (Tag);
the grammar is shared with cloud mode purely for consistency. When omitted, it
defaults to the workload group with the same name under the default resource
group (`default`).
-`<property>` format is `<key>` = `<value>`, and `<key>`'s specific optional
values can be referred to [workload
group](../../../../admin-manual/workload-management/workload-group.md).
+2. `<property>`
+
+ `<property>` format is `<key>` = `<value>`, and `<key>`'s specific
optional values can be referred to [workload
group](../../../../admin-manual/workload-management/workload-group.md).
## Examples
-1. Modify the workload group named g1:
+1. Modify the workload group named g1 (non-cloud mode: acts on g1 under the
default resource group):
```sql
alter workload group g1
@@ -36,4 +48,14 @@ PROPERTIES (
"max_cpu_percent"="20%",
"max_memory_percent"="40%"
);
+ ```
+
+2. Modify the workload group named g1 under `compute_group_a` (the clause is
required in cloud mode):
+
+ ```sql
+ alter workload group g1 for compute_group_a
+ properties (
+ "max_cpu_percent"="20%",
+ "max_memory_percent"="40%"
+ );
```
\ No newline at end of file
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
index d38382fe5f4..bd69473f699 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/ALTER-WORKLOAD-POLICY.md
@@ -30,6 +30,15 @@ Workload Policy's Name
2. priority: A positive integer ranging from 0 to 100, with a default value of
0. This represents the priority of the policy. The higher the value, the higher
the priority. The main role of this property is to select the policy with the
highest priority when multiple policies match.
3. workload_group: Currently, a policy can be bound to one workload group,
which means that this policy is only effective for a specific workload group.
The default is empty, which means it is effective for all queries.
+ Because a workload group itself belongs to a compute group, the value of
this property must follow these rules:
+
+ - **Cloud (storage-compute decoupled) mode**: The fully qualified form
`<compute_group>.<workload_group>` is required, e.g.
`'workload_group'='compute_group_a.wg1'`. The bare `<workload_group>` form,
more than one `.`, or empty segments (such as `.wg1` or `wg1.`) are rejected
with: `workload_group must be '<compute_group>.<workload_group>' in cloud mode`.
+ - **Non-cloud (storage-compute coupled) mode**: Two forms are accepted:
+ - `<workload_group>`: defaults the binding to the workload group with
the same name under the default resource group (`default`).
+ - `<resource_group>.<workload_group>`: explicitly specifies the
resource group. The prefix here actually refers to a resource group (Tag); the
grammar is shared with cloud mode purely for consistency.
+
+ More than one `.` or empty segments are likewise rejected with:
`workload_group must be '<workload_group>' or
'<resource_group>.<workload_group>' in non-cloud mode`.
+
## Access Control Requirements
You must have at least ADMIN_PRIV permissions.
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
index 9f8dbbebe4e..eef03db3d03 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-GROUP.md
@@ -17,6 +17,7 @@ This statement is used to create a workload group. Workload
groups enable the is
```sql
CREATE WORKLOAD GROUP [IF NOT EXISTS] "rg_name"
+[FOR <compute_group>]
PROPERTIES (
`<property>`
[ , ... ]
@@ -25,14 +26,21 @@ PROPERTIES (
## Parameters
-1.`<property>`
+1. `<compute_group>`
-`<property>` format is `<key>` = `<value>`, and `<key>`'s specific optional
values can be referred to [workload
group](../../../../admin-manual/workload-management/workload-group.md).
+ Specifies the compute group that the workload group is bound to.
+
+ - **Cloud (storage-compute decoupled) mode**: The `FOR <compute_group>`
clause **must be explicitly specified**. Omitting it raises: `Must specify
compute group via 'FOR <compute_group>' in cloud mode.`
+ - **Non-cloud (storage-compute coupled) mode**: The `FOR <compute_group>`
clause is optional. The value here actually refers to a resource group (Tag)
rather than a real compute group — the grammar is shared with cloud mode purely
for consistency. When omitted, it defaults to the default resource group
(`default`).
+
+2. `<property>`
+
+ `<property>` format is `<key>` = `<value>`, and `<key>`'s specific
optional values can be referred to [workload
group](../../../../admin-manual/workload-management/workload-group.md).
## Examples
-1. Create a workload group named g1:
+1. Create a workload group named g1 (non-cloud mode: bound to the default
resource group):
```sql
create workload group if not exists g1
@@ -41,3 +49,13 @@ PROPERTIES (
"max_memory_percent"="30%"
);
```
+
+2. Create a workload group named g1 bound to `compute_group_a` (the clause is
required in cloud mode):
+
+ ```sql
+ create workload group if not exists g1 for compute_group_a
+ properties (
+ "max_cpu_percent"="10%",
+ "max_memory_percent"="30%"
+ );
+ ```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
index 72674d56f15..d32978c4d14 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/CREATE-WORKLOAD-POLICY.md
@@ -1,54 +1,73 @@
---
{
- "title": "CREATE WORKLOAD GROUP | Compute Management",
+ "title": "CREATE WORKLOAD POLICY",
"language": "en",
- "description": "This statement is used to create a workload group.
Workload groups enable the isolation of cpu resources and memory resources on a
single be.",
- "sidebar_label": "CREATE WORKLOAD GROUP"
+ "description": "Create a Workload Policy, which is used to execute the
corresponding action on a query when it satisfies certain conditions."
}
---
-# CREATE WORKLOAD GROUP
-
## Description
-This statement is used to create a workload group. Workload groups enable the
isolation of cpu resources and memory resources on a single be.
+Create a Workload Policy, which is used to execute the corresponding action on
a query when it satisfies certain conditions.
-grammar:
+## Syntax
```sql
-CREATE WORKLOAD GROUP [IF NOT EXISTS] "rg_name"
-PROPERTIES (
- property_list
-);
+CREATE WORKLOAD POLICY [ IF NOT EXISTS ] <workload_policy_name>
+CONDITIONS(<conditions>) ACTIONS(<actions>)
+[ PROPERTIES (<properties>) ]
```
-illustrate:
+## Required Parameters
+
+1. `<workload_policy_name>`: The name of the Workload Policy.
+
+2. `<conditions>`
+ - be_scan_rows: The number of rows scanned by a SQL within a single BE
process. If the SQL is executed with multiple concurrencies on the BE, this is
the cumulative value of the concurrent executions.
+ - be_scan_bytes: The number of bytes scanned by a SQL within a single BE
process. If the SQL is executed with multiple concurrencies on the BE, this is
the cumulative value of the concurrent executions, in bytes.
+ - query_time: The execution time of a SQL on a single BE process, in
milliseconds.
+ - query_be_memory_bytes: Supported since version 2.1.5. The memory usage
of a SQL within a single BE process. If the SQL is executed with multiple
concurrencies on the BE, this is the cumulative value of the concurrent
executions, in bytes.
+
+3. `<actions>`
+ - set_session_variable: This action executes a `set_session_variable`
statement. A single Policy may contain multiple `set_session_variable` actions,
allowing one Policy to execute multiple session-variable updates.
+ - cancel_query: Cancel the query.
-Properties supported by property_list:
+## Optional Parameters
-* cpu_share: Required, used to set how much cpu time the workload group can
acquire, which can achieve soft isolation of cpu resources. cpu_share is a
relative value indicating the weight of cpu resources available to the running
workload group. For example, if a user creates 3 workload groups rg-a, rg-b and
rg-c with cpu_share of 10, 30 and 40 respectively, and at a certain moment rg-a
and rg-b are running tasks while rg-c has no tasks, then rg-a can get (10 / (10
+ 30)) = 25% of the cp [...]
+1. `<properties>`
+ - enabled: Can be true or false; default is true. true means the policy is
enabled; false means it is disabled.
+ - priority: A positive integer in the range 0 to 100; default is 0. Higher
values mean higher priority. When multiple policies match a query, the one with
the highest priority is selected.
+ - workload_group: A policy can be bound to one workload group, meaning
that the policy only takes effect for that workload group. Defaults to empty,
which means it applies to all queries.
-* memory_limit: Required, set the percentage of be memory that can be used by
the workload group. The absolute value of the workload group memory limit is:
`physical_memory * mem_limit * memory_limit`, where mem_limit is a be
configuration item. The total memory_limit of all workload groups in the system
must not exceed 100%. Workload groups are guaranteed to use the memory_limit
for the tasks in the group in most cases. When the workload group memory usage
exceeds this limit, tasks in t [...]
+ Because a workload group itself belongs to a compute group, the value
of this property must follow these rules:
-* enable_memory_overcommit: Optional, enable soft memory isolation for the
workload group, default is false. if set to false, the workload group is hard
memory isolated and the tasks with the largest memory usage will be canceled
immediately after the workload group memory usage exceeds the limit to release
the excess memory. if set to true, the workload group is hard memory isolated
and the tasks with the largest memory usage will be canceled immediately after
the workload group memory [...]
+ - **Cloud (storage-compute decoupled) mode**: The fully qualified form
`<compute_group>.<workload_group>` is required, e.g.
`'workload_group'='compute_group_a.wg1'`. The bare `<workload_group>` form,
more than one `.`, or empty segments (such as `.wg1` or `wg1.`) are rejected
with: `workload_group must be '<compute_group>.<workload_group>' in cloud mode`.
+ - **Non-cloud (storage-compute coupled) mode**: Two forms are accepted:
+ - `<workload_group>`: defaults the binding to the workload group
with the same name under the default resource group (`default`).
+ - `<resource_group>.<workload_group>`: explicitly specifies the
resource group. The prefix here actually refers to a resource group (Tag); the
grammar is shared with cloud mode purely for consistency.
+
+ More than one `.` or empty segments are likewise rejected with:
`workload_group must be '<workload_group>' or
'<resource_group>.<workload_group>' in non-cloud mode`.
-## Example
+## Access Control Requirements
-1. Create a workload group named g1:
+You must have at least ADMIN_PRIV permissions.
- ```sql
- create workload group if not exists g1
- properties (
- "cpu_share"="10",
- "memory_limit"="30%",
- "enable_memory_overcommit"="true"
- );
- ```
+## Examples
-## Keywords
+1. Create a Workload Policy that cancels any query running longer than 3
seconds:
-CREATE, WORKLOAD, GROUP
+ ```sql
+ create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query)
+ ```
+2. Create a Workload Policy that is disabled by default:
+ ```sql
+ create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query) properties('enabled'='false')
+ ```
+3. Create a policy that only takes effect on workload group `wg1` under
compute group `compute_group_a` in cloud mode (note the fully qualified form):
+ ```sql
+ create workload policy kill_big_query conditions(query_time > 3000)
actions(cancel_query) properties('workload_group'='compute_group_a.wg1')
+ ```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
index 0c5db60e5fa..9383dc74a50 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-statements/cluster-management/compute-management/DROP-WORKLOAD-GROUP.md
@@ -13,13 +13,28 @@ This statement is used to delete a workload group.
## Syntax
```sql
-DROP WORKLOAD GROUP [IF EXISTS] '<rg_name>'
+DROP WORKLOAD GROUP [IF EXISTS] '<rg_name>' [FOR <compute_group>]
```
+## Parameters
+
+1. `<compute_group>`
+
+ Specifies the compute group that contains the workload group to delete.
+
+ - **Cloud (storage-compute decoupled) mode**: The `FOR <compute_group>`
clause **must be explicitly specified**. Omitting it raises: `Must specify
compute group via 'FOR <compute_group>' in cloud mode.`
+ - **Non-cloud (storage-compute coupled) mode**: The `FOR <compute_group>`
clause is optional. The value here actually refers to a resource group (Tag);
the grammar is shared with cloud mode purely for consistency. When omitted, the
workload group with the same name under the default resource group (`default`)
is deleted.
+
## Examples
-1. Delete the workload group named g1:
+1. Delete the workload group named g1 (non-cloud mode: deletes g1 from the
default resource group):
```sql
drop workload group if exists g1;
+ ```
+
+2. Delete the workload group named g1 from `compute_group_a` (the clause is
required in cloud mode):
+
+ ```sql
+ drop workload group if exists g1 for compute_group_a;
```
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]