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

*: add new global variable tidb_enable_resource_control as a switch #40440

Merged
merged 7 commits into from
Jan 12, 2023

Conversation

BornChanger
Copy link
Contributor

Signed-off-by: BornChanger [email protected]

What problem does this PR solve?

Issue Number: ref #38825

Problem Summary:

What is changed and how it works?

A new global variable tidb_enable_resource_control is introduced via this pr, which is off by default.
When it's off, resource group create/drop/alter operations or create/alter user with resource group options are forbidden,
and no resource group tagging is carried in tikv requests.

Check List

Tests

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

Documentation

  • Contains variable changes

Release note

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

None

@BornChanger BornChanger requested a review from a team as a code owner January 9, 2023 16:25
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jan 9, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • glorv
  • tiancaiamao

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 9, 2023
@BornChanger
Copy link
Contributor Author

/cc @nolouch @glorv @tiancaiamao

@BornChanger BornChanger changed the title *: add new globle variable tidb_enable_resource_control as a switch *: add new global variable tidb_enable_resource_control as a switch Jan 9, 2023
@BornChanger BornChanger force-pushed the resource_group_switch branch from 7063614 to 80ffb7d Compare January 10, 2023 08:47
@BornChanger
Copy link
Contributor Author

/retest

2 similar comments
@BornChanger
Copy link
Contributor Author

/retest

@BornChanger
Copy link
Contributor Author

/retest

Copy link
Member

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

lgtm

@nolouch
Copy link
Member

nolouch commented Jan 11, 2023

ptal @tiancaiamao @glorv

Copy link
Contributor

@tiancaiamao tiancaiamao left a comment

Choose a reason for hiding this comment

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

Let @@tidb_enable_resource_control control the 'create/alter resource' statement is not the best choice.
Because the user may create resource group first, and then disable the global variable.
In this order, this new added switch is useless.

It's better to make the variable work by avoid setting the tag for the request.

@BornChanger
Copy link
Contributor Author

BornChanger commented Jan 12, 2023

Let @@tidb_enable_resource_control control the 'create/alter resource' statement is not the best choice. Because the user may create resource group first, and then disable the global variable. In this order, this new added switch is useless.

It's better to make the variable work by avoid setting the tag for the request.

Yes. @glorv's pr #40237 and the coming token controlling pr and write scheduling pr need to honor the flag. @Connor1996 @JmPotato @nolouch

@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 12, 2023
@Connor1996
Copy link
Member

Whether enabling read/write scheduling is only controlled by TiKV config as I understand. Do we need to consider this global variable?

@nolouch
Copy link
Member

nolouch commented Jan 12, 2023

@Connor1996 it's better let TiKV config be online change and be associated with this switch or maybe TiKV no need a switch if it can enable by default. IMO, user better only know one switch. But currently it's may difficulty to implement.

@nolouch
Copy link
Member

nolouch commented Jan 12, 2023

I think the main purpose is not allow user to use the resource group ddl by default to prevent unexpected behavior. If user enable it and then disable it, maybe we can delete all resource groups?

@BornChanger
Copy link
Contributor Author

After I discuss with @glorv, at the experimental phase, I would like to let the flag affect new sessions. That is to give a "default" group to session context if the flag is disabled. We may need to consolidate the behavior of tidb and tikv later.

@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 12, 2023
session/session.go Outdated Show resolved Hide resolved
session/session.go Outdated Show resolved Hide resolved
Signed-off-by: BornChanger <[email protected]>
Signed-off-by: BornChanger <[email protected]>
@BornChanger BornChanger force-pushed the resource_group_switch branch from 194d07c to fc45835 Compare January 12, 2023 08:54
Signed-off-by: BornChanger <[email protected]>
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.

LGTM

@BornChanger BornChanger force-pushed the resource_group_switch branch from b4913b4 to 7f8d2e5 Compare January 12, 2023 09:17
@BornChanger
Copy link
Contributor Author

@tiancaiamao @Connor1996 please take another look.

@BornChanger
Copy link
Contributor Author

@bb7133 @jackysp, it seems you need to give a lgtm also since this pr introduces a new global variable. thx

@BornChanger
Copy link
Contributor Author

/cc @bb7133 @jackysp

@ti-chi-bot ti-chi-bot requested review from bb7133 and jackysp January 12, 2023 09:39
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 12, 2023
Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Member

@bb7133: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

LGTM

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

@glorv: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 12, 2023
@glorv
Copy link
Contributor

glorv commented Jan 12, 2023

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 7f8d2e5

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 12, 2023
@ti-chi-bot
Copy link
Member

@BornChanger: Your PR was out of date, I have automatically updated it for you.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit b8e5460 into pingcap:master Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants