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

ddl: check no partitions error when create partition table #9531

Merged
merged 7 commits into from
Mar 9, 2019

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Mar 3, 2019

What problem does this PR solve?

In MySQL

mysql > create table t (a int not null) partition by range( a );
(1492, u'For RANGE partitions each partition must be defined')
mysql > create table t (a int not null) partition by range columns ( a );
(1492, u'For RANGE partitions each partition must be defined')
mysql > create table th (a int, b int) partition by hash(a) partitions 0;
(1504, u'Number of partitions = 0 is not an allowed value')

But in TiDB will execute those sql successful. then add index in this no partition table will panic.

Other check, drop partition will have check if drop the last partition and return ErrDropLastPartition, so drop partition will not cause the no partition table problem.

What is changed and how it works?

Add check when create partition table.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

Related changes

  • Need to cherry-pick to the release branch

@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

@tiancaiamao @winkyao @zimulala PTAL

@codecov-io
Copy link

codecov-io commented Mar 3, 2019

Codecov Report

Merging #9531 into master will increase coverage by 0.015%.
The diff coverage is 100%.

@@              Coverage Diff              @@
##           master      #9531       +/-   ##
=============================================
+ Coverage   67.38%   67.3951%   +0.015%     
=============================================
  Files         374        374               
  Lines       78921      78936       +15     
=============================================
+ Hits        53177      53199       +22     
+ Misses      20991      20987        -4     
+ Partials     4753       4750        -3

@zhouqiang-cl
Copy link
Contributor

/run-all-tests

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 4, 2019
ddl/db_partition_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 6, 2019
Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason merged commit 8e812d8 into pingcap:master Mar 9, 2019
@crazycs520 crazycs520 deleted the check-no-partition branch March 12, 2019 05:04
crazycs520 added a commit to crazycs520/tidb that referenced this pull request Mar 12, 2019
@you06 you06 added the sig/sql-infra SIG: SQL Infra label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants