-
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
ddl: error or skip unsupported partition-related DDLs #10672
Conversation
a34a853
to
2cd158a
Compare
This comment has been minimized.
This comment has been minimized.
e52446c
to
fb1db96
Compare
/run-integration-tests |
/run-all-tests |
@@ -1747,8 +1747,7 @@ func resolveAlterTableSpec(ctx sessionctx.Context, specs []*ast.AlterTableSpec) | |||
validSpecs = append(validSpecs, spec) | |||
} | |||
|
|||
if len(validSpecs) != 1 { | |||
// TODO: Hanlde len(validSpecs) == 0. | |||
if len(validSpecs) > 1 { |
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.
Will len(validSpecs) == 0
?
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.
Yes, ALTER TABLE t;
is len(validSpecs) == 0
.
LGTM |
PTAL @crazycs520 @winkyao @zimulala |
/run-all-tests |
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
/run-integration-common-test |
/run-all-tests |
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
@kennytm Can you cherry pick this pr to v3.0.0, I found there was bug fix in this PR: create table t (a int,b int) partition by hash(a) partitions 10;
truncate table t;
select * from t partition (p0)
(1735, u"Unknown partition 'p0' in table 't'")
mysql>select tidb_version();
+--------------------------------------------------------------------------+
| tidb_version() |
+--------------------------------------------------------------------------+
| Release Version: v3.0.1-19-g8dd4a277d |
| Git Commit Hash: 8dd4a277d2a844aaaf03b6d90792baade8adea70 |
| Git Branch: release-3.0 |
| UTC Build Time: 2019-07-22 01:04:07 |
| GoVersion: go version go1.12 darwin/amd64 |
| Race Enabled: false |
| TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e |
| Check Table Before Drop: false |
+--------------------------------------------------------------------------+
|
* ddl: error or skip unsupported partition-related DDLs * go.mod: stop replacing parser since the PR is merged * ddl: addressed comment
What problem does this PR solve?
Update parser to include pingcap/parser#345, which involved some changes in the DDL component.
What is changed and how it works?
Make sure code which checks PartitionType recognizes all 5 partition types:
ALTER TABLE ... ADD PARTITION
, reject all types ("unsupported") except RANGEIn a HASH partition, if the partitions are explicitly named (and maybe contains comments), they will be saved into the model. The comments are kept even after
ALTER TABLE ... TRUNCATE PARTITION
.ALTER TABLE ... PARTITION BY
will raise an error (instead of silently ignoring).ALTER TABLE ... DROP PARTITION
andALTER TABLE ... TRUNCATE PARTITION
will raise "multiple schema changes" error if multiple partition names are supplied.Check List
Tests
Code changes
Side effects
Related changes