-
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
parser: support GLOBAL IndexOption #55259
Conversation
Hi @mjonss. 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. |
Is there a convenient way to convert between local and global index like ALTER TABLE t ALTER INDEX c1 [GLOBAL | LOCAL]; ? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #55259 +/- ##
================================================
+ Coverage 72.7812% 75.2699% +2.4887%
================================================
Files 1570 1572 +2
Lines 439488 444945 +5457
================================================
+ Hits 319865 334910 +15045
+ Misses 99907 90003 -9904
- Partials 19716 20032 +316
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@tangenta Good question, I have not thought of it, I would consider the indexes to be different, so you should probably create a new index and drop the old one instead, which would also have less impact of DDL handling, since it would need to recreate the full index and it is not a simple metadata only change like VISIBLE/INVISIBLE IndexOption. |
After some consideration and discussion with the PM, I changed from: to be able to more explicitly change which indexes to change to GLOBAL (and to LOCAL if you repartition a table). |
$$ = &ast.ColumnOption{Tp: ast.ColumnOptionPrimaryKey, PrimaryKeyTp: $3.(model.PrimaryKeyType)} | ||
$$ = &ast.ColumnOption{Tp: ast.ColumnOptionPrimaryKey, PrimaryKeyTp: $3.(model.PrimaryKeyType), StrValue: $4} | ||
} | ||
| "UNIQUE" "GLOBAL" |
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.
Not tested in UT and should this be GlobalOrLocalOpt
instead of GLOBAL
?
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.
Right, I will update it or add the possibility of LOCAL as well in case of conflicts.
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 explicitly added "GLOBAL"
and "LOCAL"
, as well as kept the "UNIQUE" %prec lowerThanKey
to avoid conflicts.
[LGTM Timeline notifier]Timeline:
|
/retest |
@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an 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-sigs/prow repository. |
/ok-to-test |
/retest |
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.
LGTM
/hold |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bb7133, Defined2014, easonn7, 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 |
/unhold |
What problem does this PR solve?
Issue Number: ref #52994
Problem Summary:
To not surprise our users and create MySQL incompatibilities, we should require explicit mentioning of 'GLOBAL' when creating a Global Unique Index.
This also makes it easier to allow non-unique indexes as well as unique indexes already containing all partitioning columns to be GLOBAL.
Currently ALTER TABLE t PARTITION BY ... would implicitly create a Global Index of UNIQUE Indexes if they don't include all partitioning columns.
With this PR we are adding an optional UPDATE INDEXES clause after the partitioning definitions:
UPDATE INDEXES ( index_name {GLOBAL|LOCAL} [, index_name {GLOBAL|LOCAL}[,...]] ) to make every index change explicit.
What changed and how does it work?
Parser:
Executor:
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.