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: Support exchange partition #17149

Merged
merged 77 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
70f6354
exchange partition init push
zhaox1n May 4, 2020
57af241
exchange partition: check table is compatiable
zhaox1n May 4, 2020
af97469
Merge pull request #1 from pingcap/master
zhaox1n May 4, 2020
adef48e
add checke in ddl worker
zhaox1n May 5, 2020
1a7f599
validate check
zhaox1n May 6, 2020
11809d0
Basic functions have been completed
zhaox1n May 6, 2020
c8bc050
autoID added
zhaox1n May 7, 2020
5a32fe4
test add
zhaox1n May 8, 2020
35941aa
hash exchange partition add
zhaox1n May 9, 2020
7468924
format
zhaox1n May 9, 2020
64fd709
test add
zhaox1n May 9, 2020
cb88c18
Merge pull request #2 from pingcap/master
zhaox1n May 9, 2020
71cf840
test add
zhaox1n May 10, 2020
a902cdc
auto id fix
zhaox1n May 10, 2020
a228468
add cancel job test
zhaox1n May 10, 2020
9ff0790
add exchange partition compatiable test
zhaox1n May 11, 2020
dda9d75
add test of partition
zhaox1n May 12, 2020
32c6285
add more test and set go mod
zhaox1n May 13, 2020
899033f
deal with conflict
zhaox1n May 13, 2020
f4f5b38
fix the conflict
zhaox1n May 13, 2020
a38b5e0
deal with conflict
zhaox1n May 14, 2020
3cec6f2
add more test of table compatible
zhaox1n May 14, 2020
53f4f73
fix comment
zhaox1n May 14, 2020
101c673
rename function
zhaox1n May 14, 2020
a1ca360
fix wrong english spell
zhaox1n May 14, 2020
40db78a
Merge remote-tracking branch 'upstream/master'
zhaox1n May 16, 2020
c559f12
add test for expression index
zhaox1n May 16, 2020
f9fdd0c
add check in ddl worker
zhaox1n May 17, 2020
c979e69
rename word
zhaox1n May 18, 2020
c096c8c
add global config of expression index
zhaox1n May 18, 2020
4130a9a
deal conflict
zhaox1n May 18, 2020
0ffd1ab
deal conflict
zhaox1n May 21, 2020
488cb5f
add auto_random test
zhaox1n May 21, 2020
b5cfdd3
comment fix
zhaox1n May 26, 2020
fac04c1
comment fix
zhaox1n May 26, 2020
be92bb3
more test added
zhaox1n May 26, 2020
3f38e2b
Merge remote-tracking branch 'upstream/master'
zhaox1n May 26, 2020
d9bc6fa
add failed point
zhaox1n May 26, 2020
ea173bf
remove variable
zhaox1n May 26, 2020
57aeb95
Update ddl/column.go
zhaox1n May 27, 2020
5a29bdd
Update ddl/ddl_api.go
zhaox1n May 27, 2020
aa8da8e
comment fix
zhaox1n May 27, 2020
ebce341
add test
zhaox1n May 27, 2020
65f4c64
add test
zhaox1n May 27, 2020
5a46b18
exchange auto_random
zhaox1n May 27, 2020
ec51f5e
fix range columns partition
zhaox1n May 28, 2020
a93fe24
Merge remote-tracking branch 'upstream/master'
zhaox1n May 28, 2020
95b2554
fix comment
zhaox1n May 29, 2020
134c55d
fix comment
zhaox1n May 29, 2020
d724823
fix comment
zhaox1n May 29, 2020
894b7e5
fix bug
zhaox1n May 30, 2020
40729a1
fix comment
zhaox1n Jun 1, 2020
6ea633d
fix comment
zhaox1n Jun 1, 2020
d9b98c0
fix comment
zhaox1n Jun 1, 2020
b194f11
Merge remote-tracking branch 'upstream/master' into exchange_partitio…
zhaox1n Jun 1, 2020
7807380
fix comment
zhaox1n Jun 1, 2020
4769d3b
bug fix
zhaox1n Jun 2, 2020
325d596
address comment
zhaox1n Jun 2, 2020
33e0c36
Merge pull request #3 from zhaox1n/exchange_partition_test
zhaox1n Jun 2, 2020
6eeb3fd
Merge branch 'master' into master
crazycs520 Jun 2, 2020
b46a6bb
Merge branch 'master' into master
tiancaiamao Jun 3, 2020
85d71c0
address comment
zhaox1n Jun 4, 2020
a4d0161
Merge branch 'master' of https://github.com/zhaox1n/tidb
zhaox1n Jun 4, 2020
6c1d63a
address comment
zhaox1n Jun 6, 2020
b5b6824
bug fix
zhaox1n Jun 6, 2020
999b0d9
bug fix
zhaox1n Jun 6, 2020
2cf5d03
sql fix
zhaox1n Jun 6, 2020
52676f8
add test of auto_random
zhaox1n Jun 6, 2020
6bc1a4a
expand the implementation of ApplyDiff
zhaox1n Jun 7, 2020
9cd7caa
fix typo
zhaox1n Jun 7, 2020
771e4dd
Update ddl/partition.go
zhaox1n Jun 8, 2020
f2ab275
address conflict
zhaox1n Jun 8, 2020
dc8abd3
Merge branch 'master' into master
crazycs520 Jun 9, 2020
44f6018
address comment
zhaox1n Jun 9, 2020
3ec7b7a
merge master
zhaox1n Jun 9, 2020
f3fc2e7
address comment
zhaox1n Jun 10, 2020
8396b42
Merge branch 'master' into master
crazycs520 Jun 10, 2020
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
8 changes: 8 additions & 0 deletions ddl/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -931,3 +931,11 @@ func getColumnInfoByName(tbInfo *model.TableInfo, column string) *model.ColumnIn
}
return nil
}

// isVirtualGeneratedColumn checks the column if it is virtual.
func isVirtualGeneratedColumn(col *model.ColumnInfo) bool {
if col.IsGenerated() && !col.GeneratedStored {
return true
}
return false
}
416 changes: 414 additions & 2 deletions ddl/db_partition_test.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ddl/ddl_algorithm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (s *testDDLAlgorithmSuite) TestFindAlterAlgorithm(c *C) {
{ast.AlterTableSpec{Tp: ast.AlterTableAddPartitions}, instantAlgorithm, ast.AlgorithmTypeInstant},
{ast.AlterTableSpec{Tp: ast.AlterTableDropPartition}, instantAlgorithm, ast.AlgorithmTypeInstant},
{ast.AlterTableSpec{Tp: ast.AlterTableTruncatePartition}, instantAlgorithm, ast.AlgorithmTypeInstant},
{ast.AlterTableSpec{Tp: ast.AlterTableExchangePartition}, instantAlgorithm, ast.AlgorithmTypeInstant},

// TODO: after we support lock a table, change the below case.
{ast.AlterTableSpec{Tp: ast.AlterTableLock}, instantAlgorithm, ast.AlgorithmTypeInstant},
Expand Down
174 changes: 171 additions & 3 deletions ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2212,8 +2212,6 @@ func (d *ddl) AlterTable(ctx sessionctx.Context, ident ast.Ident, specs []*ast.A
err = errors.Trace(errUnsupportedOptimizePartition)
case ast.AlterTableRemovePartitioning:
err = errors.Trace(errUnsupportedRemovePartition)
case ast.AlterTableExchangePartition:
err = errors.Trace(errUnsupportedExchangePartition)
case ast.AlterTableDropColumn:
err = d.DropColumn(ctx, ident, spec)
case ast.AlterTableDropIndex:
Expand All @@ -2226,6 +2224,8 @@ func (d *ddl) AlterTable(ctx sessionctx.Context, ident ast.Ident, specs []*ast.A
err = d.DropTablePartition(ctx, ident, spec)
case ast.AlterTableTruncatePartition:
err = d.TruncateTablePartition(ctx, ident, spec)
case ast.AlterTableExchangePartition:
err = d.ExchangeTablePartition(ctx, ident, spec)
case ast.AlterTableAddConstraint:
constr := spec.Constraint
switch spec.Constraint.Tp {
Expand Down Expand Up @@ -2454,7 +2454,7 @@ func checkAndCreateNewColumn(ctx sessionctx.Context, ti ast.Ident, schema *model
}

if option.Stored {
return nil, errUnsupportedOnGeneratedColumn.GenWithStackByArgs("Adding generated stored column through ALTER TABLE")
return nil, ErrUnsupportedOnGeneratedColumn.GenWithStackByArgs("Adding generated stored column through ALTER TABLE")
}

_, dependColNames := findDependedColumnNames(specNewColumn)
Expand Down Expand Up @@ -2816,6 +2816,174 @@ func (d *ddl) DropTablePartition(ctx sessionctx.Context, ident ast.Ident, spec *
return errors.Trace(err)
}

func checkFieldTypeCompatible(ft *types.FieldType, other *types.FieldType) bool {
// int(1) could match the type with int(8)
partialEqual := ft.Tp == other.Tp &&
ft.Decimal == other.Decimal &&
ft.Charset == other.Charset &&
ft.Collate == other.Collate &&
(ft.Flen == other.Flen || ft.StorageLength() != types.VarStorageLen) &&
mysql.HasUnsignedFlag(ft.Flag) == mysql.HasUnsignedFlag(other.Flag) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, why not use ft.Flag == other.Flag to compare directly.
BTW, below SQL will success in This PR but failed in MySQL5.7

drop table if exists t1,t;
create table t (a int not null, b int, index (a)) partition by hash(a) partitions 3;
insert into t values (1,1),(2,2),(3,3),(4,4);
create table t1 (a int key, b int, index (a));
alter table t exchange partition p0 with table t1;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that (a int key) equals to (a int not null) in tidb. To compatible with mysql, there are the other attribution that we needn't to compare with such as default value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mysql> create table t1 (a int key, b int, index (a));
Query OK, 0 rows affected (0.06 sec)

mysql> show create table t1;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                             |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Copy link
Contributor

Choose a reason for hiding this comment

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

Still need to compare more flags such as PriKeyFlag

mysql.HasAutoIncrementFlag(ft.Flag) == mysql.HasAutoIncrementFlag(other.Flag) &&
mysql.HasNotNullFlag(ft.Flag) == mysql.HasNotNullFlag(other.Flag) &&
mysql.HasZerofillFlag(ft.Flag) == mysql.HasZerofillFlag(other.Flag) &&
mysql.HasBinaryFlag(ft.Flag) == mysql.HasBinaryFlag(other.Flag) &&
mysql.HasPriKeyFlag(ft.Flag) == mysql.HasPriKeyFlag(other.Flag)
if !partialEqual || len(ft.Elems) != len(other.Elems) {
return false
}
for i := range ft.Elems {
if ft.Elems[i] != other.Elems[i] {
return false
}
}
return true
}

func checkTableDefCompatible(source *model.TableInfo, target *model.TableInfo) error {
// check auto_random
if source.AutoRandomBits != target.AutoRandomBits ||
source.Charset != target.Charset ||
source.Collate != target.Collate ||
source.ShardRowIDBits != target.ShardRowIDBits ||
source.MaxShardRowIDBits != target.MaxShardRowIDBits ||
source.TiFlashReplica != target.TiFlashReplica {
return errors.Trace(ErrTablesDifferentMetadata)
}
if len(source.Cols()) != len(target.Cols()) {
return errors.Trace(ErrTablesDifferentMetadata)
}
// Col compatible check
for i, sourceCol := range source.Cols() {
targetCol := target.Cols()[i]
if isVirtualGeneratedColumn(sourceCol) != isVirtualGeneratedColumn(targetCol) {
return ErrUnsupportedOnGeneratedColumn.GenWithStackByArgs("Exchanging partitions for non-generated columns")
}
// It should strictyle compare expressions for generated columns
if sourceCol.Name.L != targetCol.Name.L ||
zhaox1n marked this conversation as resolved.
Show resolved Hide resolved
sourceCol.Hidden != targetCol.Hidden ||
!checkFieldTypeCompatible(&sourceCol.FieldType, &targetCol.FieldType) ||
sourceCol.GeneratedExprString != targetCol.GeneratedExprString {
return errors.Trace(ErrTablesDifferentMetadata)
}
crazycs520 marked this conversation as resolved.
Show resolved Hide resolved
if sourceCol.State != model.StatePublic ||
targetCol.State != model.StatePublic {
return errors.Trace(ErrTablesDifferentMetadata)
}
if sourceCol.ID != targetCol.ID {
return ErrPartitionExchangeDifferentOption.GenWithStackByArgs(fmt.Sprintf("column: %s", sourceCol.Name))
}
}
if len(source.Indices) != len(target.Indices) {
return errors.Trace(ErrTablesDifferentMetadata)
}
for _, sourceIdx := range source.Indices {
var compatIdx *model.IndexInfo
for _, targetIdx := range target.Indices {
if strings.EqualFold(sourceIdx.Name.L, targetIdx.Name.L) {
compatIdx = targetIdx
crazycs520 marked this conversation as resolved.
Show resolved Hide resolved
}
}
// No match index
if compatIdx == nil {
return errors.Trace(ErrTablesDifferentMetadata)
}
// Index type is not compatible
if sourceIdx.Tp != compatIdx.Tp ||
tangenta marked this conversation as resolved.
Show resolved Hide resolved
sourceIdx.Unique != compatIdx.Unique ||
sourceIdx.Primary != compatIdx.Primary {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@crazycs520 It has compared the Primary key here.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, they are different. For table create table t1 (a int key, b int, index (a));, the TableInfo.Indices is nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @crazycs520 PTAL

return errors.Trace(ErrTablesDifferentMetadata)
}
// The index column
if len(sourceIdx.Columns) != len(compatIdx.Columns) {
return errors.Trace(ErrTablesDifferentMetadata)
}
for i, sourceIdxCol := range sourceIdx.Columns {
compatIdxCol := compatIdx.Columns[i]
if sourceIdxCol.Length != compatIdxCol.Length ||
sourceIdxCol.Name.L != compatIdxCol.Name.L {
return errors.Trace(ErrTablesDifferentMetadata)
}
}
if sourceIdx.ID != compatIdx.ID {
return ErrPartitionExchangeDifferentOption.GenWithStackByArgs(fmt.Sprintf("index: %s", sourceIdx.Name))
}
}

return nil
}

func checkExchangePartition(pt *model.TableInfo, nt *model.TableInfo) error {
if nt.IsView() || nt.IsSequence() {
return errors.Trace(ErrCheckNoSuchTable)
}
if pt.GetPartitionInfo() == nil {
return errors.Trace(ErrPartitionMgmtOnNonpartitioned)
}
if nt.GetPartitionInfo() != nil {
return errors.Trace(ErrPartitionExchangePartTable.GenWithStackByArgs(nt.Name))
}

if nt.ForeignKeys != nil {
return errors.Trace(ErrPartitionExchangeForeignKey.GenWithStackByArgs(nt.Name))
}

// NOTE: if nt is temporary table, it should be checked
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

func (d *ddl) ExchangeTablePartition(ctx sessionctx.Context, ident ast.Ident, spec *ast.AlterTableSpec) error {
ptSchema, pt, err := d.getSchemaAndTableByIdent(ctx, ident)
if err != nil {
return errors.Trace(err)
}

ptMeta := pt.Meta()

ntIdent := ast.Ident{Schema: spec.NewTable.Schema, Name: spec.NewTable.Name}
ntSchema, nt, err := d.getSchemaAndTableByIdent(ctx, ntIdent)
if err != nil {
return errors.Trace(err)
}

ntMeta := nt.Meta()

err = checkExchangePartition(ptMeta, ntMeta)
if err != nil {
return errors.Trace(err)
}

partName := spec.PartitionNames[0].L

// NOTE: if pt is subPartitioned, it should be checked

defID, err := tables.FindPartitionByName(ptMeta, partName)
if err != nil {
return errors.Trace(err)
}

err = checkTableDefCompatible(ptMeta, ntMeta)
if err != nil {
return errors.Trace(err)
}

job := &model.Job{
SchemaID: ntSchema.ID,
TableID: ntMeta.ID,
SchemaName: ntSchema.Name.L,
Type: model.ActionExchangeTablePartition,
BinlogInfo: &model.HistoryInfo{},
Args: []interface{}{defID, ptSchema.ID, ptMeta.ID, partName, spec.WithValidation},
}

err = d.doDDLJob(ctx, job)
if err != nil {
return errors.Trace(err)
}
err = d.callHookOnChanged(err)
return errors.Trace(err)
}

// DropColumn will drop a column from the table, now we don't support drop the column with index covered.
func (d *ddl) DropColumn(ctx sessionctx.Context, ti ast.Ident, spec *ast.AlterTableSpec) error {
schema, t, err := d.getSchemaAndTableByIdent(ctx, ti)
Expand Down
19 changes: 19 additions & 0 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ func (w *worker) runDDLJob(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64,
ver, err = onDropTablePartition(t, job)
case model.ActionTruncateTablePartition:
ver, err = onTruncateTablePartition(d, t, job)
case model.ActionExchangeTablePartition:
ver, err = w.onExchangeTablePartition(d, t, job)
case model.ActionAddColumn:
ver, err = onAddColumn(d, t, job)
case model.ActionAddColumns:
Expand Down Expand Up @@ -842,6 +844,23 @@ func updateSchemaVersion(t *meta.Meta, job *model.Job) (int64, error) {
return 0, errors.Trace(err)
}
diff.TableID = job.TableID
case model.ActionExchangeTablePartition:
var (
ptSchemaID int64
ptTableID int64
)
err = job.DecodeArgs(&diff.TableID, &ptSchemaID, &ptTableID)
if err != nil {
return 0, errors.Trace(err)
}
diff.OldTableID = job.TableID
zhaox1n marked this conversation as resolved.
Show resolved Hide resolved
affects := make([]*model.AffectedOption, 1)
affects[0] = &model.AffectedOption{
SchemaID: ptSchemaID,
TableID: ptTableID,
OldTableID: ptTableID,
}
diff.AffectedOpts = affects
default:
diff.TableID = job.TableID
}
Expand Down
28 changes: 28 additions & 0 deletions ddl/ddl_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ func buildCancelJobTests(firstID int64) []testCancelJob {

{act: model.ActionAlterIndexVisibility, jobIDs: []int64{firstID + 46}, cancelRetErrs: noErrs, cancelState: model.StateNone},
{act: model.ActionAlterIndexVisibility, jobIDs: []int64{firstID + 47}, cancelRetErrs: []error{admin.ErrCancelFinishedDDLJob.GenWithStackByArgs(firstID + 47)}, cancelState: model.StatePublic},

{act: model.ActionExchangeTablePartition, jobIDs: []int64{firstID + 53}, cancelRetErrs: noErrs, cancelState: model.StateNone},
{act: model.ActionExchangeTablePartition, jobIDs: []int64{firstID + 54}, cancelRetErrs: []error{admin.ErrCancelFinishedDDLJob.GenWithStackByArgs(firstID + 54)}, cancelState: model.StatePublic},
}

return tests
Expand Down Expand Up @@ -986,6 +989,31 @@ func (s *testDDLSuite) TestCancelJob(c *C) {
c.Check(checkErr, IsNil)
changedTable = testGetTable(c, d, dbInfo.ID, tblInfo.ID)
c.Assert(checkIdxVisibility(changedTable, indexName, true), IsTrue)

// test exchange partition failed caused by canceled
pt := testTableInfoWithPartition(c, d, "pt", 5)
nt := testTableInfo(c, d, "nt", 5)
testCreateTable(c, ctx, d, dbInfo, pt)
testCreateTable(c, ctx, d, dbInfo, nt)

updateTest(&tests[43])
defID := pt.Partition.Definitions[0].ID
exchangeTablePartition := []interface{}{defID, dbInfo.ID, pt.ID, "p0", true}
doDDLJobErrWithSchemaState(ctx, d, c, dbInfo.ID, nt.ID, test.act, exchangeTablePartition, &test.cancelState)
c.Check(checkErr, IsNil)
changedNtTable := testGetTable(c, d, dbInfo.ID, nt.ID)
changedPtTable := testGetTable(c, d, dbInfo.ID, pt.ID)
c.Assert(changedNtTable.Meta().ID == nt.ID, IsTrue)
c.Assert(changedPtTable.Meta().Partition.Definitions[0].ID == pt.Partition.Definitions[0].ID, IsTrue)

// cancel exchange partition successfully
updateTest(&tests[44])
doDDLJobSuccess(ctx, d, c, dbInfo.ID, nt.ID, test.act, exchangeTablePartition)
c.Check(checkErr, IsNil)
changedNtTable = testGetTable(c, d, dbInfo.ID, pt.Partition.Definitions[0].ID)
changedPtTable = testGetTable(c, d, dbInfo.ID, pt.ID)
c.Assert(changedNtTable.Meta().ID == nt.ID, IsFalse)
c.Assert(changedPtTable.Meta().Partition.Definitions[0].ID == nt.ID, IsTrue)
}

func (s *testDDLSuite) TestIgnorableSpec(c *C) {
Expand Down
17 changes: 15 additions & 2 deletions ddl/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ var (
errWrongKeyColumn = terror.ClassDDL.New(mysql.ErrWrongKeyColumn, mysql.MySQLErrName[mysql.ErrWrongKeyColumn])
// errWrongFKOptionForGeneratedColumn is for wrong foreign key reference option on generated columns.
errWrongFKOptionForGeneratedColumn = terror.ClassDDL.New(mysql.ErrWrongFKOptionForGeneratedColumn, mysql.MySQLErrName[mysql.ErrWrongFKOptionForGeneratedColumn])
// errUnsupportedOnGeneratedColumn is for unsupported actions on generated columns.
errUnsupportedOnGeneratedColumn = terror.ClassDDL.New(mysql.ErrUnsupportedOnGeneratedColumn, mysql.MySQLErrName[mysql.ErrUnsupportedOnGeneratedColumn])
// ErrUnsupportedOnGeneratedColumn is for unsupported actions on generated columns.
ErrUnsupportedOnGeneratedColumn = terror.ClassDDL.New(mysql.ErrUnsupportedOnGeneratedColumn, mysql.MySQLErrName[mysql.ErrUnsupportedOnGeneratedColumn])
// errGeneratedColumnNonPrior forbids to refer generated column non prior to it.
errGeneratedColumnNonPrior = terror.ClassDDL.New(mysql.ErrGeneratedColumnNonPrior, mysql.MySQLErrName[mysql.ErrGeneratedColumnNonPrior])
// errDependentByGeneratedColumn forbids to delete columns which are dependent by generated columns.
Expand Down Expand Up @@ -210,4 +210,17 @@ var (
ErrAddColumnWithSequenceAsDefault = terror.ClassDDL.New(mysql.ErrAddColumnWithSequenceAsDefault, mysql.MySQLErrName[mysql.ErrAddColumnWithSequenceAsDefault])
// ErrUnsupportedExpressionIndex is returned when create an expression index without allow-expression-index.
ErrUnsupportedExpressionIndex = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "creating expression index without allow-expression-index in config"))
// ErrPartitionExchangePartTable is returned when exchange table partition with another table is partitioned.
ErrPartitionExchangePartTable = terror.ClassDDL.New(mysql.ErrPartitionExchangePartTable, mysql.MySQLErrName[mysql.ErrPartitionExchangePartTable])
// ErrTablesDifferentMetadata is returned when exchanges tables is not compatible.
ErrTablesDifferentMetadata = terror.ClassDDL.New(mysql.ErrTablesDifferentMetadata, mysql.MySQLErrName[mysql.ErrTablesDifferentMetadata])
// ErrRowDoesNotMatchPartition is returned when the row record of exchange table does not match the partition rule.
ErrRowDoesNotMatchPartition = terror.ClassDDL.New(mysql.ErrRowDoesNotMatchPartition, mysql.MySQLErrName[mysql.ErrRowDoesNotMatchPartition])
// ErrPartitionExchangeForeignKey is returned when exchanged normal table has foreign keys.
ErrPartitionExchangeForeignKey = terror.ClassDDL.New(mysql.ErrPartitionExchangeForeignKey, mysql.MySQLErrName[mysql.ErrPartitionExchangeForeignKey])
// ErrCheckNoSuchTable is returned when exchaned normal table is view or sequence.
ErrCheckNoSuchTable = terror.ClassDDL.New(mysql.ErrCheckNoSuchTable, mysql.MySQLErrName[mysql.ErrCheckNoSuchTable])
errUnsupportedPartitionType = terror.ClassDDL.New(mysql.ErrUnsupportedDDLOperation, fmt.Sprintf(mysql.MySQLErrName[mysql.ErrUnsupportedDDLOperation], "partition type of table %s when exchanging partition"))
// ErrPartitionExchangeDifferentOption is returned when attribute doesnot match between partition table and normal table.
ErrPartitionExchangeDifferentOption = terror.ClassDDL.New(mysql.ErrPartitionExchangeDifferentOption, mysql.MySQLErrName[mysql.ErrPartitionExchangeDifferentOption])
)
Loading