Skip to content
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

resource_control: support unlimited keyword when setting the resource group #54704

Merged
merged 6 commits into from
Jul 26, 2024

Conversation

HuSharp
Copy link
Contributor

@HuSharp HuSharp commented Jul 18, 2024

What problem does this PR solve?

Issue Number: close #54413

Problem Summary:

What changed and how does it work?

mysql> SELECT * FROM information_schema.resource_groups;
+---------+------------+----------+-----------+-------------+------------+
| NAME    | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND |
+---------+------------+----------+-----------+-------------+------------+
| default | UNLIMITED  | MEDIUM   | YES       | NULL        | NULL       |
+---------+------------+----------+-----------+-------------+------------+
1 row in set (0.00 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS rg1   RU_PER_SEC = 100   BURSTABLE;
Query OK, 0 rows affected (0.07 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS rg2   RU_PER_SEC = unlimited   BURSTABLE;
Query OK, 0 rows affected (0.06 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS rg3   RU_PER_SEC = UNLIMITED   BURSTABLE;
Query OK, 0 rows affected (0.07 sec)

mysql> SELECT * FROM information_schema.resource_groups;
+---------+------------+----------+-----------+-------------+------------+
| NAME    | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND |
+---------+------------+----------+-----------+-------------+------------+
| default | UNLIMITED  | MEDIUM   | YES       | NULL        | NULL       |
| rg1     | 100        | MEDIUM   | YES       | NULL        | NULL       |
| rg2     | UNLIMITED  | MEDIUM   | YES       | NULL        | NULL       |
| rg3     | UNLIMITED  | MEDIUM   | YES       | NULL        | NULL       |
+---------+------------+----------+-----------+-------------+------------+
4 rows in set (0.00 sec)

mysql> ALTER RESOURCE GROUP rg2 RU_PER_SEC = 200;
Query OK, 0 rows affected (0.05 sec)

mysql> SELECT * FROM information_schema.resource_groups;
+---------+------------+----------+-----------+-------------+------------+
| NAME    | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND |
+---------+------------+----------+-----------+-------------+------------+
| default | UNLIMITED  | MEDIUM   | YES       | NULL        | NULL       |
| rg1     | 100        | MEDIUM   | YES       | NULL        | NULL       |
| rg2     | 200        | MEDIUM   | YES       | NULL        | NULL       |
| rg3     | UNLIMITED  | MEDIUM   | YES       | NULL        | NULL       |
+---------+------------+----------+-----------+-------------+------------+
4 rows in set (0.00 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS rg4   RU_PER_SEC = UNLIMITED   BURSTABLE=FALSE;
Query OK, 0 rows affected (0.06 sec)

mysql> SELECT * FROM information_schema.resource_groups;
+---------+------------+----------+-----------+-------------+------------+
| NAME    | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND |
+---------+------------+----------+-----------+-------------+------------+
| default | UNLIMITED  | MEDIUM   | YES       | NULL        | NULL       |
| rg1     | 100        | MEDIUM   | YES       | NULL        | NULL       |
| rg2     | 200        | MEDIUM   | YES       | NULL        | NULL       |
| rg3     | UNLIMITED  | MEDIUM   | YES       | NULL        | NULL       |
| rg4     | UNLIMITED  | MEDIUM   | NO        | NULL        | NULL       |
+---------+------------+----------+-----------+-------------+------------+
5 rows in set (0.01 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS rg5   RU_PER_SEC = 'check'   BURSTABLE=FALSE;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 74 near "BURSTABLE=FALSE"The RU_PER_SEC value 'check' is not valid.

mysql> alter resource group rg1 RU_PER_SEC= unlimited QUERY_LIMIT=(EXEC_ELAPSED='15s' ACTION DRYRUN WATCH SIMILAR DURATION '10m0s')
    -> ;
Query OK, 0 rows affected (0.06 sec)

mysql> SELECT * FROM information_schema.resource_groups;
+---------+------------+----------+-----------+-------------------------------------------------------------------+------------+
| NAME    | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT                                                       | BACKGROUND |
+---------+------------+----------+-----------+-------------------------------------------------------------------+------------+
| default | UNLIMITED  | MEDIUM   | YES       | NULL                                                              | NULL       |
| rg1     | UNLIMITED  | MEDIUM   | YES       | EXEC_ELAPSED='15s', ACTION=DRYRUN, WATCH=SIMILAR DURATION='10m0s' | NULL       |
| rg2     | 200        | MEDIUM   | YES       | NULL                                                              | NULL       |
| rg3     | UNLIMITED  | MEDIUM   | YES       | NULL                                                              | NULL       |
| rg4     | UNLIMITED  | MEDIUM   | NO        | NULL                                                              | NULL       |
+---------+------------+----------+-----------+-------------------------------------------------------------------+------------+
5 rows in set (0.01 sec)

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 18, 2024
@HuSharp
Copy link
Contributor Author

HuSharp commented Jul 18, 2024

@nolouch @JmPotato PTAL, thx!

Copy link

tiprow bot commented Jul 18, 2024

Hi @HuSharp. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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

codecov bot commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.0466%. Comparing base (98b7858) to head (6b15ad8).
Report is 13 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #54704        +/-   ##
================================================
- Coverage   74.7144%   74.0466%   -0.6678%     
================================================
  Files          1558       1561         +3     
  Lines        363836     441747     +77911     
================================================
+ Hits         271838     327099     +55261     
- Misses        72290      94328     +22038     
- Partials      19708      20320       +612     
Flag Coverage Δ
integration 27.9100% <0.0000%> (?)
unit 71.6413% <100.0000%> (-1.9815%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9567% <ø> (-2.2428%) ⬇️
parser ∅ <ø> (∅)
br 51.7713% <ø> (+4.0933%) ⬆️

@@ -622,6 +622,7 @@ var Keywords = []KeywordsType{
{"VALIDATION", false, "unreserved"},
{"VALUE", false, "unreserved"},
{"VARIABLES", false, "unreserved"},
{"VECTOR", false, "unreserved"},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Someone who forgot to update, maybe we need a lint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added #54827

pkg/parser/parser.y Outdated Show resolved Hide resolved
@nolouch nolouch requested a review from glorv July 19, 2024 06:05
Signed-off-by: husharp <ihusharp@gmail.com>
Signed-off-by: husharp <ihusharp@gmail.com>
Signed-off-by: husharp <ihusharp@gmail.com>
@HuSharp HuSharp requested a review from nolouch July 23, 2024 03:21
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 25, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 26, 2024
Copy link
Contributor

@glorv glorv left a comment

Choose a reason for hiding this comment

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

rest LGTM

pkg/parser/ast/ddl.go Outdated Show resolved Hide resolved
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 26, 2024
Copy link

ti-chi-bot bot commented Jul 26, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-26 02:22:43.018393195 +0000 UTC m=+1184585.009334657: ☑️ agreed by nolouch.
  • 2024-07-26 06:26:22.471373479 +0000 UTC m=+1199204.462314949: ☑️ agreed by glorv.

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Jul 26, 2024

@songrijie: 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/test-infra repository.

Copy link

ti-chi-bot bot commented Jul 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: easonn7, glorv, GMHDBJD, nolouch, songrijie, tangenta

The full list of commands accepted by this bot can be found here.

The pull request process is described 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 the approved label Jul 26, 2024
@ti-chi-bot ti-chi-bot bot merged commit 0dff610 into pingcap:master Jul 26, 2024
23 checks passed
@HuSharp HuSharp deleted the add_ru_unlimited branch July 26, 2024 09:31
morgo added a commit to morgo/tidb that referenced this pull request Jul 28, 2024
* upstream/master: (93 commits)
  disjoinset: add generic impl (pingcap#54917)
  planner: derive index filters for mv index paths (pingcap#54877)
  br: cli refactor backup error handling logic (pingcap#54697)
  expression: fix infinity loop in `timestampadd` (pingcap#54916)
  planner: import more expand test. (pingcap#54962)
  planner: use code-gen to generate CloneForPlanCache method for some operators (pingcap#54957)
  test: fix flaky test TestFailSchemaSyncer (pingcap#54958)
  planner: move logical show into logicalop pkg. (pingcap#54928)
  privilege: Remove TestAbnormalMySQLTable (pingcap#54925)
  resource_control: support unlimited keyword when setting the resource group (pingcap#54704)
  ddl: fix a data race on localRowCntListener Written() (pingcap#54484)
  lightning: fix SET SESSION on connection pool (pingcap#54927)
  planner: move logical mem-table to logicalop pkg. (pingcap#54903)
  table: Add `CachedTableSupport` and `TemporaryTableSupport` for `MutateContext` (pingcap#54900)
  executor: fix index_hash_join hang when context canceled (pingcap#54855)
  statistics: add metrics for unneeded analyze table (pingcap#54822)
  *: refine pipelined dml benchmarks (pingcap#54844)
  ddl: assign table IDs for jobs submitted to queue (pingcap#54880)
  *: avoid using Tables field of model.DBInfo, use API instead (pingcap#52302)
  planner: remove useless check (pingcap#54907)
  ...
hawkingrei pushed a commit to hawkingrei/tidb that referenced this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support unlimit keyworld when setting the resource group
7 participants