Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Jun 6, 2025

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.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.4 (TiDB 8.4 versions)
  • v8.3 (TiDB 8.3 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Copy link

ti-chi-bot bot commented Jun 6, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lilin90 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 6, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a 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, and INFORMATION_SCHEMA.RESOURCE_GROUPS is modified to include the new BURSTABLE modes and their descriptions.
  • Example Updates: Examples showing the output of SELECT * FROM information_schema.resource_groups are updated to display the new BURSTABLE format (e.g., YES(UNLIMITED)) and include the QUERY_LIMIT and BACKGROUND columns.

Changelog

Click here to see the changelog
  • information-schema/information-schema-resource-groups.md
    • Updated example output for DESC resource_groups; to include QUERY_LIMIT and BACKGROUND columns and change RU_PER_SEC type display from bigint(21) to varchar(21) (lines 20-29).
    • Updated example output for SELECT * FROM information_schema.resource_groups; to include QUERY_LIMIT and BACKGROUND columns and show BURSTABLE as YES(UNLIMITED) for the default group (lines 40-44).
    • Updated example output for SELECT * FROM information_schema.resource_groups WHERE NAME = 'rg1'; to include QUERY_LIMIT and BACKGROUND columns (lines 73-77).
    • Updated the description of the BURSTABLE column to explain the OFF, MODERATED, and UNLIMITED modes and clarify the default mode for the default resource group (lines 86-90).
  • sql-statements/sql-statement-alter-resource-group.md
    • Updated the grammar definition for ALTER RESOURCE GROUP to explicitly list MODERATED, UNLIMITED, and OFF as valid options for BURSTABLE (lines 36-38).
    • Updated the description table for DirectResourceGroupOption to explain the three BURSTABLE modes and the default behavior (lines 89).
    • Updated example output for SELECT * FROM information_schema.resource_groups WHERE NAME ='default'; to show BURSTABLE as YES(UNLIMITED) (lines 173-177).
  • sql-statements/sql-statement-create-resource-group.md
    • Updated the grammar definition for CREATE RESOURCE GROUP to explicitly list MODERATED, UNLIMITED, and OFF as valid options for BURSTABLE (lines 36-38).
    • Updated the description table for DirectResourceGroupOption to explain the three BURSTABLE modes and the default behavior (lines 86).
    • Clarified the default BURSTABLE mode for the default resource group is UNLIMITED 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 show BURSTABLE as YES(MODERATED) for rg1 and NO for rg2 (lines 132-137).
  • sql-statements/sql-statement-drop-resource-group.md
    • Updated example output for SELECT * FROM information_schema.resource_groups WHERE NAME ='rg1'; to show BURSTABLE as YES(MODERATED) (lines 58-62).
  • tidb-resource-control-background-tasks.md
    • Updated example output for SELECT * FROM information_schema.resource_groups; to show BURSTABLE as YES(UNLIMITED) for the default group (lines 80-84).
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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 in information-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 to rg1 while the SQL code creates rg4.
  • 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 and sql-statement-create-resource-group.md have inconsistent indentation for the new BURSTABLE 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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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

Suggested change
3 rows in set (0.00 sec)
6 rows in set (0.00 sec)

Footnotes

  1. Technical accuracy is important. The output of a command should accurately reflect the state or structure it describes. (link)

| `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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo here: "UNLIMTED" should be "UNLIMITED". 1

Style Guide References

Suggested change
> 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

  1. Correct spelling is crucial for technical accuracy and professionalism. (link)

@@ -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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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

Suggested change
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

  1. Technical accuracy and consistency between description and code examples are important for clarity. (link)

@@ -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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

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

  1. Ensuring documentation is clear and readable is a key review aspect. (link)

Comment on lines +35 to +38
| "BURSTABLE"
| "BURSTABLE" EqOpt "MODERATED"
| "BURSTABLE" EqOpt "UNLIMITED"
| "BURSTABLE" EqOpt "OFF"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

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

Suggested change
| "BURSTABLE"
| "BURSTABLE" EqOpt "MODERATED"
| "BURSTABLE" EqOpt "UNLIMITED"
| "BURSTABLE" EqOpt "OFF"
| "BURSTABLE"
| "BURSTABLE" EqOpt "MODERATED"
| "BURSTABLE" EqOpt "UNLIMITED"
| "BURSTABLE" EqOpt "OFF"

Footnotes

  1. While not explicitly for EBNF, maintaining consistent formatting (Markdown style) improves readability. (link)

@@ -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. |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

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 for BURSTABLE, 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

  1. Clarity and readability are key aspects of good documentation. (link)

Comment on lines +35 to +38
| "BURSTABLE"
| "BURSTABLE" EqOpt "MODERATED"
| "BURSTABLE" EqOpt "UNLIMITED"
| "BURSTABLE" EqOpt "OFF"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

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

Suggested change
| "BURSTABLE"
| "BURSTABLE" EqOpt "MODERATED"
| "BURSTABLE" EqOpt "UNLIMITED"
| "BURSTABLE" EqOpt "OFF"
| "BURSTABLE"
| "BURSTABLE" EqOpt "MODERATED"
| "BURSTABLE" EqOpt "UNLIMITED"
| "BURSTABLE" EqOpt "OFF"

Footnotes

  1. Consistent formatting improves readability. (link)

@@ -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. |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

This description for BURSTABLE is also quite long. For better readability 1, would it be possible to rephrase it, perhaps using a list for the modes as suggested for the other files?

Style Guide References

Footnotes

  1. Ensuring documentation is clear and readable is important. (link)

Copy link

ti-chi-bot bot commented Jun 6, 2025

@gemini-code-assist[bot]: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

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 in information-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 to rg1 while the SQL code creates rg4.
  • 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 and sql-statement-create-resource-group.md have inconsistent indentation for the new BURSTABLE 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.

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.

Copy link

ti-chi-bot bot commented Jun 6, 2025

@lhy1024: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-verify 89d233a link true /test pull-verify

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.

@lilin90 lilin90 added the translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. label Jun 9, 2025
@lilin90 lilin90 self-assigned this Jun 9, 2025
@ti-chi-bot ti-chi-bot bot removed the missing-translation-status This PR does not have translation status info. label Jun 9, 2025
@lilin90 lilin90 added missing-translation-status This PR does not have translation status info. v9.0-beta.2 This PR/issue applies to TiDB v9.0-beta.2. labels Jun 9, 2025
@lilin90 lilin90 requested review from songrijie and lilin90 June 9, 2025 06:34
@lilin90 lilin90 added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed missing-translation-status This PR does not have translation status info. labels Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. v9.0-beta.2 This PR/issue applies to TiDB v9.0-beta.2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants