-
Notifications
You must be signed in to change notification settings - Fork 700
resource control: support more mode for BURSTABLE #21138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: lhy1024 <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @lhy1024, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
Hello! I'm gemini-code-assist, here to provide a summary of this pull request. This PR primarily focuses on updating the documentation related to TiDB's resource control feature. Specifically, it introduces and documents the support for more granular modes for the BURSTABLE
option within resource groups. The changes involve updating the syntax descriptions for CREATE RESOURCE GROUP
and ALTER RESOURCE GROUP
statements, as well as clarifying the behavior and available modes (OFF
, MODERATED
, UNLIMITED
) for BURSTABLE
in the documentation for the INFORMATION_SCHEMA.RESOURCE_GROUPS
table. Several examples showing the output of querying INFORMATION_SCHEMA.RESOURCE_GROUPS
are also updated to reflect the new BURSTABLE
output format and include columns for QUERY_LIMIT
and BACKGROUND
.
Highlights
- Documentation Updates: Documentation for
CREATE RESOURCE GROUP
,ALTER RESOURCE GROUP
, andINFORMATION_SCHEMA.RESOURCE_GROUPS
is modified to include the newBURSTABLE
modes and their descriptions. - Example Updates: Examples showing the output of
SELECT * FROM information_schema.resource_groups
are updated to display the newBURSTABLE
format (e.g.,YES(UNLIMITED)
) and include theQUERY_LIMIT
andBACKGROUND
columns.
Changelog
Click here to see the changelog
- information-schema/information-schema-resource-groups.md
- Updated example output for
DESC resource_groups;
to includeQUERY_LIMIT
andBACKGROUND
columns and changeRU_PER_SEC
type display frombigint(21)
tovarchar(21)
(lines 20-29). - Updated example output for
SELECT * FROM information_schema.resource_groups;
to includeQUERY_LIMIT
andBACKGROUND
columns and showBURSTABLE
asYES(UNLIMITED)
for the default group (lines 40-44). - Updated example output for
SELECT * FROM information_schema.resource_groups WHERE NAME = 'rg1';
to includeQUERY_LIMIT
andBACKGROUND
columns (lines 73-77). - Updated the description of the
BURSTABLE
column to explain theOFF
,MODERATED
, andUNLIMITED
modes and clarify the default mode for thedefault
resource group (lines 86-90).
- Updated example output for
- sql-statements/sql-statement-alter-resource-group.md
- Updated the grammar definition for
ALTER RESOURCE GROUP
to explicitly listMODERATED
,UNLIMITED
, andOFF
as valid options forBURSTABLE
(lines 36-38). - Updated the description table for
DirectResourceGroupOption
to explain the threeBURSTABLE
modes and the default behavior (lines 89). - Updated example output for
SELECT * FROM information_schema.resource_groups WHERE NAME ='default';
to showBURSTABLE
asYES(UNLIMITED)
(lines 173-177).
- Updated the grammar definition for
- sql-statements/sql-statement-create-resource-group.md
- Updated the grammar definition for
CREATE RESOURCE GROUP
to explicitly listMODERATED
,UNLIMITED
, andOFF
as valid options forBURSTABLE
(lines 36-38). - Updated the description table for
DirectResourceGroupOption
to explain the threeBURSTABLE
modes and the default behavior (lines 86). - Clarified the default
BURSTABLE
mode for thedefault
resource group isUNLIMITED
in the note section (line 92). - Added a new example for creating a resource group with
BURSTABLE=UNLIMITED
(lines 206-210). - Updated example output for
SELECT * FROM information_schema.resource_groups WHERE NAME ='rg1' or NAME = 'rg2';
to showBURSTABLE
asYES(MODERATED)
forrg1
andNO
forrg2
(lines 132-137).
- Updated the grammar definition for
- sql-statements/sql-statement-drop-resource-group.md
- Updated example output for
SELECT * FROM information_schema.resource_groups WHERE NAME ='rg1';
to showBURSTABLE
asYES(MODERATED)
(lines 58-62).
- Updated example output for
- tidb-resource-control-background-tasks.md
- Updated example output for
SELECT * FROM information_schema.resource_groups;
to showBURSTABLE
asYES(UNLIMITED)
for the default group (lines 80-84).
- Updated example output for
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request updates the documentation to reflect the new modes available for the BURSTABLE
option in resource groups. The changes are mostly in table outputs and descriptions across several files. Overall, the updates clarify the new functionality. However, there are a few areas that need attention to ensure accuracy and consistency, primarily related to example outputs and a typo.
Summary of Findings
- Documentation Accuracy: There's an incorrect row count in the
DESC resource_groups;
output ininformation-schema/information-schema-resource-groups.md
. - Spelling Error: A typo "UNLIMTED" was found in
sql-statements/sql-statement-create-resource-group.md
. It should be "UNLIMITED". - Example Consistency: In
tidb-resource-control-ru-groups.md
, an example description refers torg1
while the SQL code createsrg4
. - Readability: The description of the
BURSTABLE
option is quite long in several files and could be broken down for better readability. - Formatting Consistency: EBNF diagrams in
sql-statement-alter-resource-group.md
andsql-statement-create-resource-group.md
have inconsistent indentation for the newBURSTABLE
options.
Merge Readiness
The pull request introduces important documentation updates for the BURSTABLE
resource control option. While the changes are largely good, there are a few issues related to accuracy (incorrect command output, typo) and consistency (example naming) that should be addressed before merging. Addressing these will improve the clarity and correctness of the documentation. I am unable to approve pull requests, so please ensure these changes are reviewed and approved by a maintainer.
| BURSTABLE | varchar(3) | YES | | NULL | | | ||
| QUERY_LIMIT | varchar(256) | YES | | NULL | | | ||
| BACKGROUND | varchar(256) | YES | | NULL | | | ||
+-------------+--------------+------+------+---------+-------+ | ||
3 rows in set (0.00 sec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output of DESC resource_groups;
indicates 3 rows in set
, but the table now lists 6 fields (NAME
, RU_PER_SEC
, PRIORITY
, BURSTABLE
, QUERY_LIMIT
, BACKGROUND
). Shouldn't this be 6 rows in set
to accurately reflect the number of fields described? 1
Style Guide References
3 rows in set (0.00 sec) | |
6 rows in set (0.00 sec) |
Footnotes
| `QUERY_LIMIT` | When the query execution meets this condition, the query is identified as a runaway query and the corresponding action is executed. | `QUERY_LIMIT=(EXEC_ELAPSED='60s', ACTION=KILL, WATCH=EXACT DURATION='10m')` indicates that the query is identified as a runaway query when the execution time exceeds 60 seconds. The query is terminated. All SQL statements with the same SQL text will be terminated immediately in the coming 10 minutes. `QUERY_LIMIT=()` or `QUERY_LIMIT=NULL` means that runaway control is not enabled. See [Runaway Queries](/tidb-resource-control-runaway-queries.md). | | ||
|
||
> **Note:** | ||
> | ||
> - The `CREATE RESOURCE GROUP` statement can only be executed when the global variable [`tidb_enable_resource_control`](/system-variables.md#tidb_enable_resource_control-new-in-v660) is set to `ON`. | ||
> TiDB automatically creates a `default` resource group during cluster initialization. For this resource group, the default value of `RU_PER_SEC` is `UNLIMITED` (equivalent to the maximum value of the `INT` type, that is, `2147483647`) and it is in `BURSTABLE` mode. All requests that are not bound to any resource group are automatically bound to this `default` resource group. When you create a new configuration for another resource group, it is recommended to modify the `default` resource group configuration as needed. | ||
> TiDB automatically creates a `default` resource group during cluster initialization. For this resource group, the default value of `RU_PER_SEC` is `UNLIMITED` (equivalent to the maximum value of the `INT` type, that is, `2147483647`) and its `BURSTABLE` mode is `UNLIMTED`. All requests that are not bound to any resource group are automatically bound to this `default` resource group. When you create a new configuration for another resource group, it is recommended to modify the `default` resource group configuration as needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo here: "UNLIMTED" should be "UNLIMITED". 1
Style Guide References
> TiDB automatically creates a `default` resource group during cluster initialization. For this resource group, the default value of `RU_PER_SEC` is `UNLIMITED` (equivalent to the maximum value of the `INT` type, that is, `2147483647`) and its `BURSTABLE` mode is `UNLIMTED`. All requests that are not bound to any resource group are automatically bound to this `default` resource group. When you create a new configuration for another resource group, it is recommended to modify the `default` resource group configuration as needed. | |
> TiDB automatically creates a `default` resource group during cluster initialization. For this resource group, the default value of `RU_PER_SEC` is `UNLIMITED` (equivalent to the maximum value of the `INT` type, that is, `2147483647`) and its `BURSTABLE` mode is `UNLIMITED`. All requests that are not bound to any resource group are automatically bound to this `default` resource group. When you create a new configuration for another resource group, it is recommended to modify the `default` resource group configuration as needed. |
Footnotes
@@ -203,6 +203,12 @@ The following is an example of how to create a resource group. | |||
CREATE RESOURCE GROUP IF NOT EXISTS rg3 RU_PER_SEC = 100 PRIORITY = HIGH; | |||
``` | |||
|
|||
4. Create a resource group `rg1`. The resource limit is 500 RUs per second and allows applications in this resource group to overrun resources with `UNLIMITED` mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description mentions creating a resource group rg1
, but the SQL example creates rg4
. To avoid confusion, should the description also refer to rg4
? 1
Style Guide References
4. Create a resource group `rg1`. The resource limit is 500 RUs per second and allows applications in this resource group to overrun resources with `UNLIMITED` mode. | |
4. Create a resource group `rg4`. The resource limit is 500 RUs per second and allows applications in this resource group to overrun resources with `UNLIMITED` mode. |
Footnotes
@@ -81,8 +83,8 @@ The descriptions of the columns in the `RESOURCE_GROUPS` table are as follows: | |||
* `NAME`: the name of the resource group. | |||
* `RU_PER_SEC`: the backfilling speed of the resource group. The unit is RU/second, in which RU means [Request Unit](/tidb-resource-control-ru-groups.md#what-is-request-unit-ru). | |||
* `PRIORITY`: the absolute priority of tasks to be processed on TiKV. Different resources are scheduled according to the `PRIORITY` setting. Tasks with high `PRIORITY` are scheduled first. For resource groups with the same `PRIORITY`, tasks will be scheduled proportionally according to the `RU_PER_SEC` configuration. If `PRIORITY` is not specified, the default priority is `MEDIUM`. | |||
* `BURSTABLE`: whether to allow the resource group to overuse the available system resources. | |||
* `BURSTABLE`: whether to allow the resource group to overuse the available system resources. There are three modes, `OFF`, which means this resource group is not allowed to overuse the remaining system resources; `MODERATED`, which means this resource group is allowed to overuse the remaining system resources in a limited way; and `UNLIMITED`, which means this resource group is allowed to overuse the remaining system resources in an unlimited way. If no target value is specified for `BURSTABLE`, `MODERATED` is enabled by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for BURSTABLE
is quite long. For better readability 1, consider breaking it down. For example:
"* BURSTABLE
: Specifies whether the resource group can overuse available system resources. It supports three modes:
* OFF
: The resource group cannot overuse remaining system resources.
* MODERATED
: The resource group can overuse remaining system resources in a limited way. This is the default mode if BURSTABLE
is specified without a value.
* UNLIMITED
: The resource group can overuse remaining system resources in an unlimited way."
Style Guide References
Footnotes
| "BURSTABLE" | ||
| "BURSTABLE" EqOpt "MODERATED" | ||
| "BURSTABLE" EqOpt "UNLIMITED" | ||
| "BURSTABLE" EqOpt "OFF" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation for the new BURSTABLE
options in the EBNF diagram uses tabs, while other options like RU_PER_SEC
and PRIORITY
use spaces. For consistency within the EBNF block, could these also use spaces for indentation? 1
Style Guide References
| "BURSTABLE" | |
| "BURSTABLE" EqOpt "MODERATED" | |
| "BURSTABLE" EqOpt "UNLIMITED" | |
| "BURSTABLE" EqOpt "OFF" | |
| "BURSTABLE" | |
| "BURSTABLE" EqOpt "MODERATED" | |
| "BURSTABLE" EqOpt "UNLIMITED" | |
| "BURSTABLE" EqOpt "OFF" |
Footnotes
@@ -84,7 +86,7 @@ TiDB supports the following `DirectResourceGroupOption`, where [Request Unit (RU | |||
|---------------|-------------------------------------|------------------------| | |||
| `RU_PER_SEC` | Rate of RU backfilling per second | `RU_PER_SEC = 500` indicates that this resource group is backfilled with 500 RUs per second | | |||
| `PRIORITY` | The absolute priority of tasks to be processed on TiKV | `PRIORITY = HIGH` indicates that the priority is high. If not specified, the default value is `MEDIUM`. | | |||
| `BURSTABLE` | If the `BURSTABLE` attribute is set, TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded. | | |||
| `BURSTABLE` | TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded. There are three modes, `OFF`, which means this resource group is not allowed to overuse the remaining system resources; `MODERATED`, which means this resource group is allowed to overuse the remaining system resources in a limited way; and `UNLIMITED`, which means this resource group is allowed to overuse the remaining system resources in an unlimited way. If no target value is specified for `BURSTABLE`, `MODERATED` is enabled by default. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the comment in information-schema-resource-groups.md
, this description for BURSTABLE
is a bit long. Could it be broken down for improved readability? 1
For example:
"TiDB allows the corresponding resource group to use available system resources when the quota is exceeded. There are three modes:
OFF
: This resource group is not allowed to overuse the remaining system resources.MODERATED
: This resource group is allowed to overuse the remaining system resources in a limited way. If no target value is specified forBURSTABLE
,MODERATED
is enabled by default.UNLIMITED
: This resource group is allowed to overuse the remaining system resources in an unlimited way."
Style Guide References
Footnotes
| "BURSTABLE" | ||
| "BURSTABLE" EqOpt "MODERATED" | ||
| "BURSTABLE" EqOpt "UNLIMITED" | ||
| "BURSTABLE" EqOpt "OFF" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation for the new BURSTABLE
options in the EBNF diagram uses tabs, while other options use spaces. For consistency, could these also use spaces? 1
Style Guide References
| "BURSTABLE" | |
| "BURSTABLE" EqOpt "MODERATED" | |
| "BURSTABLE" EqOpt "UNLIMITED" | |
| "BURSTABLE" EqOpt "OFF" | |
| "BURSTABLE" | |
| "BURSTABLE" EqOpt "MODERATED" | |
| "BURSTABLE" EqOpt "UNLIMITED" | |
| "BURSTABLE" EqOpt "OFF" |
Footnotes
@@ -81,13 +83,13 @@ TiDB supports the following `DirectResourceGroupOption`, where [Request Unit (RU | |||
|---------------|-------------------------------------|------------------------| | |||
| `RU_PER_SEC` | Rate of RU backfilling per second | `RU_PER_SEC = 500` indicates that this resource group is backfilled with 500 RUs per second | | |||
| `PRIORITY` | The absolute priority of tasks to be processed on TiKV | `PRIORITY = HIGH` indicates that the priority is high. If not specified, the default value is `MEDIUM`. | | |||
| `BURSTABLE` | If the `BURSTABLE` attribute is set, TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded. | | |||
| `BURSTABLE` | TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded. There are three modes, `OFF`, which means this resource group is not allowed to overuse the remaining system resources; `MODERATED`, which means this resource group is allowed to overuse the remaining system resources in a limited way; and `UNLIMITED`, which means this resource group is allowed to overuse the remaining system resources in an unlimited way. If no target value is specified for `BURSTABLE`, `MODERATED` is enabled by default. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gemini-code-assist[bot]: adding LGTM is restricted to approvers and reviewers in OWNERS files. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@lhy1024: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
First-time contributors' checklist
What is changed, added or deleted? (Required)
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions.
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?