-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: bind user to some resource group #39561
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/assign @nolouch @CbcWestwolf @glorv |
/unassign @nolouch @CbcWestwolf @glorv |
/cc @tiancaiamao |
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.
Isn't the 'alter user RESOURCE GROUP ...' a DDL?
I don't see any of the change of ddl files in this PR.
privilege/privileges/privileges.go
Outdated
|
||
// special handling to existing users or root user initialized with insecure | ||
if record.ResourceGroup == "" { | ||
record.ResourceGroup = "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.
record
is a shallow copy from the source, so change it here also change the original value.
Althrough the correctness still seem to be hold, it may data race here.
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.
Just return "default", there is no need to change the record.ResourceGroup
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.
fixed.
parser/parser.y
Outdated
@@ -12889,6 +12892,11 @@ CommentOrAttributeOption: | |||
$$ = &ast.CommentOrAttributeOption{Type: ast.UserAttributeType, Value: $2} | |||
} | |||
|
|||
| "RESOURCE" "GROUP" stringLit |
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.
I prefer to declare "RESOURCE" "GROUP" stringLit
with a new term ResourceGroupOption
, and add ResourceGroupOption
into CreateUserStmt
and AlterUserStmt
after CommentOrAttributeOption
, like
AlterUserStmt:
"ALTER" "USER" IfExists UserSpecList RequireClauseOpt ConnectionOptions PasswordOrLockOptions CommentOrAttributeOption ResourceGroupOption
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.
In my implementation, "resource group" is just one attribute for user, like email. which is stored in User_attributes column of mysql.user.
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.
So can we just use 'alter user ... attribute ...' without provide an extra new syntax?
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.
No. Resource group might be a frequently used attribute. So, we introduce new syntax for it following the pattern of comment.
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.
I prefer to declare
"RESOURCE" "GROUP" stringLit
with a new termResourceGroupOption
, and addResourceGroupOption
intoCreateUserStmt
andAlterUserStmt
afterCommentOrAttributeOption
, likeAlterUserStmt: "ALTER" "USER" IfExists UserSpecList RequireClauseOpt ConnectionOptions PasswordOrLockOptions CommentOrAttributeOption ResourceGroupOption
fixed
…ap#26) Signed-off-by: BornChanger <dawn_catcher@126.com>
…ingcap#27) Signed-off-by: BornChanger <dawn_catcher@126.com>
Signed-off-by: BornChanger <dawn_catcher@126.com>
43e8715
to
07e5406
Compare
07e5406
to
57d07c4
Compare
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.
Rest LGTM
Co-authored-by: CbcWestwolf <1004626265@qq.com>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 7cef273
|
/run-check_dev_2 |
/merge |
TiDB MergeCI notify✅ Well Done! New fixed [2] after this pr merged.
|
What problem does this PR solve?
Issue Number: Ref #38825
Problem Summary:
The Spec show details: https://docs.google.com/document/d/1P_D1R1qGMFjmjbGCxYjRodgp1Yeyx4dBvg2W1l_Eiy0/edit?n=1-page_Spec_template#
What is changed and how it works?
add support to bind user to resource group at create/alter user time.
Check List
Tests
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.