-
Notifications
You must be signed in to change notification settings - Fork 6k
planner: check DROP privilege for TRUNCATE PARTITION statement (#64024) #64225
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
|
[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 |
|
Hi @jjshanks. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
|
Welcome @jjshanks! |
|
Hi @jjshanks. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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. |
|
/ok-to-test |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #64225 +/- ##
================================================
+ Coverage 72.7255% 73.4479% +0.7224%
================================================
Files 1859 1860 +1
Lines 503882 503977 +95
================================================
+ Hits 366451 370161 +3710
+ Misses 115158 111719 -3439
+ Partials 22273 22097 -176
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…ap#64024) close pingcap#64024 Signed-off-by: Joshua Shanks <jjshanks@gmail.com>
|
/retest |
What problem does this PR solve?
Issue Number: close #64024
Problem Summary:
ALTER TABLE TRUNCATE PARTITION and ALTER TABLE DROP PARTITION have inconsistent privilege requirements. Currently, TRUNCATE PARTITION only requires ALTER privilege, while DROP PARTITION correctly requires DROP privilege. This is inconsistent with MySQL behavior, where both operations require DROP privilege since they both perform destructive data operations.
What changed and how does it work?
Added privilege checking for ALTER TABLE TRUNCATE PARTITION to require DROP privilege, making it consistent with DROP PARTITION.
Changes:
How it works:
When the planner encounters an ALTER TABLE TRUNCATE PARTITION statement, it now builds visitInfo with mysql.DropPriv requirement, generating a "DROP command denied" error if the user lacks the privilege.
Check List
Tests
Side effects
This is a breaking change for users who currently rely on TRUNCATE PARTITION working with only ALTER privilege. They will now need DROP privilege.
Documentation
Affects user behaviors
Contains syntax changes
Contains variable changes
Contains experimental features
Changes MySQL compatibility
Users who previously could truncate partitions with only ALTER privilege now need DROP privilege
Improves MySQL compatibility by aligning privilege requirements
Release note