Skip to content

Commit

Permalink
Merge branch 'check_non_bmp_characters' of https://github.com/winkyao…
Browse files Browse the repository at this point in the history
…/tidb into check_non_bmp_characters
  • Loading branch information
winkyao committed Dec 19, 2018
2 parents 0de7c0a + 28e1129 commit b518488
Show file tree
Hide file tree
Showing 42 changed files with 734 additions and 95 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ explaintest: server
@cd cmd/explaintest && ./run-tests.sh -s ../../bin/tidb-server

gotest:
$(GO) get github.com/etcd-io/gofail
@rm -rf $GOPATH/bin/gofail
$(GO) get github.com/pingcap/gofail
@which gofail
@$(GOFAIL_ENABLE)
ifeq ("$(TRAVIS_COVERAGE)", "1")
@echo "Running in TRAVIS_COVERAGE mode."
Expand All @@ -130,21 +132,21 @@ endif
@$(GOFAIL_DISABLE)

race:
$(GO) get github.com/etcd-io/gofail
$(GO) get github.com/pingcap/gofail
@$(GOFAIL_ENABLE)
@export log_level=debug; \
$(GOTEST) -timeout 20m -race $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
@$(GOFAIL_DISABLE)

leak:
$(GO) get github.com/etcd-io/gofail
$(GO) get github.com/pingcap/gofail
@$(GOFAIL_ENABLE)
@export log_level=debug; \
$(GOTEST) -tags leak $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
@$(GOFAIL_DISABLE)

tikv_integration_test:
$(GO) get github.com/etcd-io/gofail
$(GO) get github.com/pingcap/gofail
@$(GOFAIL_ENABLE)
$(GOTEST) ./store/tikv/. -with-tikv=true || { $(GOFAIL_DISABLE); exit 1; }
@$(GOFAIL_DISABLE)
Expand Down
20 changes: 10 additions & 10 deletions cmd/explaintest/r/explain_complex.result
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ Projection_7 53.00 root test.dt.ds, test.dt.p1, test.dt.p2, test.dt.p3, test.dt.
└─HashAgg_11 53.00 cop group by:test.dt.ds, test.dt.p1, test.dt.p2, test.dt.p3, test.dt.p4, test.dt.p5, test.dt.p6_md5, test.dt.p7_md5, funcs:count(test.dt.dic), firstrow(test.dt.ds), firstrow(test.dt.ds2), firstrow(test.dt.p1), firstrow(test.dt.p2), firstrow(test.dt.p3), firstrow(test.dt.p4), firstrow(test.dt.p5), firstrow(test.dt.p6_md5), firstrow(test.dt.p7_md5)
└─Selection_16 66.25 cop ge(test.dt.ds, 2016-09-01 00:00:00.000000), le(test.dt.ds, 2016-11-03 00:00:00.000000)
└─TableScan_15 2650.00 cop table:dt, keep order:false, stats:pseudo
explain select gad.id as gid,sdk.id as sid,gad.aid as aid,gad.cm as cm,sdk.dic as dic,sdk.ip as ip, sdk.t as t, gad.p1 as p1, gad.p2 as p2, gad.p3 as p3, gad.p4 as p4, gad.p5 as p5, gad.p6_md5 as p6, gad.p7_md5 as p7, gad.ext as ext, gad.t as gtime from st gad join (select id, aid, pt, dic, ip, t from dd where pt = 'android' and bm = 0 and t > 1478143908) sdk on gad.aid = sdk.aid and gad.ip = sdk.ip and sdk.t > gad.t where gad.t > 1478143908 and gad.bm = 0 and gad.pt = 'android' group by gad.aid, sdk.dic limit 2500;
explain select gad.id as gid,sdk.id as sid,gad.aid as aid,gad.cm as cm,sdk.dic as dic,sdk.ip as ip, sdk.t as t, gad.p1 as p1, gad.p2 as p2, gad.p3 as p3, gad.p4 as p4, gad.p5 as p5, gad.p6_md5 as p6, gad.p7_md5 as p7, gad.ext as ext, gad.t as gtime from st gad join (select id, aid, pt, dic, ip, t from dd where pt = 'android' and bm = 0 and t > 1478143908) sdk on gad.aid = sdk.aid and gad.ip = sdk.ip and sdk.t > gad.t where gad.t > 1478143908 and gad.pt = 'android' group by gad.aid, sdk.dic limit 2500;
id count task operator info
Projection_13 1.00 root gad.id, test.dd.id, gad.aid, gad.cm, test.dd.dic, test.dd.ip, test.dd.t, gad.p1, gad.p2, gad.p3, gad.p4, gad.p5, gad.p6_md5, gad.p7_md5, gad.ext, gad.t
└─Limit_16 1.00 root offset:0, count:2500
└─HashAgg_19 1.00 root group by:gad.aid, test.dd.dic, funcs:firstrow(gad.id), firstrow(gad.aid), firstrow(gad.cm), firstrow(gad.p1), firstrow(gad.p2), firstrow(gad.p3), firstrow(gad.p4), firstrow(gad.p5), firstrow(gad.p6_md5), firstrow(gad.p7_md5), firstrow(gad.ext), firstrow(gad.t), firstrow(test.dd.id), firstrow(test.dd.dic), firstrow(test.dd.ip), firstrow(test.dd.t)
└─IndexJoin_24 0.00 root inner join, inner:IndexLookUp_23, outer key:gad.aid, inner key:test.dd.aid, other cond:eq(gad.ip, test.dd.ip), gt(test.dd.t, gad.t)
├─IndexLookUp_33 0.00 root
│ ├─IndexScan_30 3333.33 cop table:gad, index:t, range:(1478143908,+inf], keep order:false, stats:pseudo
│ └─Selection_32 0.00 cop eq(gad.bm, 0), eq(gad.pt, "android")
│ └─TableScan_31 3333.33 cop table:st, keep order:false, stats:pseudo
└─IndexLookUp_23 0.00 root
├─IndexScan_20 10.00 cop table:dd, index:aid, dic, range: decided by [gad.aid gad.ip], keep order:false, stats:pseudo
└─Selection_22 0.00 cop eq(test.dd.bm, 0), eq(test.dd.pt, "android"), gt(test.dd.t, 1478143908)
└─TableScan_21 10.00 cop table:dd, keep order:false, stats:pseudo
└─IndexJoin_24 0.00 root inner join, inner:IndexLookUp_23, outer key:gad.aid, inner key:test.dd.aid, other cond:eq(test.dd.ip, gad.ip), gt(test.dd.t, gad.t)
├─IndexLookUp_23 0.00 root
│ ├─IndexScan_20 10.00 cop table:dd, index:aid, dic, range: decided by [gad.aid gad.ip], keep order:false, stats:pseudo
│ └─Selection_22 0.00 cop eq(test.dd.bm, 0), eq(test.dd.pt, "android"), gt(test.dd.t, 1478143908)
│ └─TableScan_21 10.00 cop table:dd, keep order:false, stats:pseudo
└─IndexLookUp_33 3.33 root
├─IndexScan_30 3333.33 cop table:gad, index:t, range:(1478143908,+inf], keep order:false, stats:pseudo
└─Selection_32 3.33 cop eq(gad.pt, "android")
└─TableScan_31 3333.33 cop table:st, keep order:false, stats:pseudo
explain select gad.id as gid,sdk.id as sid,gad.aid as aid,gad.cm as cm,sdk.dic as dic,sdk.ip as ip, sdk.t as t, gad.p1 as p1, gad.p2 as p2, gad.p3 as p3, gad.p4 as p4, gad.p5 as p5, gad.p6_md5 as p6, gad.p7_md5 as p7, gad.ext as ext from st gad join dd sdk on gad.aid = sdk.aid and gad.dic = sdk.mac and gad.t < sdk.t where gad.t > 1477971479 and gad.bm = 0 and gad.pt = 'ios' and gad.dit = 'mac' and sdk.t > 1477971479 and sdk.bm = 0 and sdk.pt = 'ios' limit 3000;
id count task operator info
Projection_10 0.00 root gad.id, sdk.id, gad.aid, gad.cm, sdk.dic, sdk.ip, sdk.t, gad.p1, gad.p2, gad.p3, gad.p4, gad.p5, gad.p6_md5, gad.p7_md5, gad.ext
Expand Down
2 changes: 1 addition & 1 deletion cmd/explaintest/t/explain_complex.test
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ CREATE TABLE `rr` (

explain SELECT `ds`, `p1`, `p2`, `p3`, `p4`, `p5`, `p6_md5`, `p7_md5`, count(dic) as install_device FROM `dt` use index (cmi) WHERE (`ds` >= '2016-09-01') AND (`ds` <= '2016-11-03') AND (`cm` IN ('1062', '1086', '1423', '1424', '1425', '1426', '1427', '1428', '1429', '1430', '1431', '1432', '1433', '1434', '1435', '1436', '1437', '1438', '1439', '1440', '1441', '1442', '1443', '1444', '1445', '1446', '1447', '1448', '1449', '1450', '1451', '1452', '1488', '1489', '1490', '1491', '1492', '1493', '1494', '1495', '1496', '1497', '1550', '1551', '1552', '1553', '1554', '1555', '1556', '1557', '1558', '1559', '1597', '1598', '1599', '1600', '1601', '1602', '1603', '1604', '1605', '1606', '1607', '1608', '1609', '1610', '1611', '1612', '1613', '1614', '1615', '1616', '1623', '1624', '1625', '1626', '1627', '1628', '1629', '1630', '1631', '1632', '1709', '1719', '1720', '1843', '2813', '2814', '2815', '2816', '2817', '2818', '2819', '2820', '2821', '2822', '2823', '2824', '2825', '2826', '2827', '2828', '2829', '2830', '2831', '2832', '2833', '2834', '2835', '2836', '2837', '2838', '2839', '2840', '2841', '2842', '2843', '2844', '2845', '2846', '2847', '2848', '2849', '2850', '2851', '2852', '2853', '2854', '2855', '2856', '2857', '2858', '2859', '2860', '2861', '2862', '2863', '2864', '2865', '2866', '2867', '2868', '2869', '2870', '2871', '2872', '3139', '3140', '3141', '3142', '3143', '3144', '3145', '3146', '3147', '3148', '3149', '3150', '3151', '3152', '3153', '3154', '3155', '3156', '3157', '3158', '3386', '3387', '3388', '3389', '3390', '3391', '3392', '3393', '3394', '3395', '3664', '3665', '3666', '3667', '3668', '3670', '3671', '3672', '3673', '3674', '3676', '3677', '3678', '3679', '3680', '3681', '3682', '3683', '3684', '3685', '3686', '3687', '3688', '3689', '3690', '3691', '3692', '3693', '3694', '3695', '3696', '3697', '3698', '3699', '3700', '3701', '3702', '3703', '3704', '3705', '3706', '3707', '3708', '3709', '3710', '3711', '3712', '3713', '3714', '3715', '3960', '3961', '3962', '3963', '3964', '3965', '3966', '3967', '3968', '3978', '3979', '3980', '3981', '3982', '3983', '3984', '3985', '3986', '3987', '4208', '4209', '4210', '4211', '4212', '4304', '4305', '4306', '4307', '4308', '4866', '4867', '4868', '4869', '4870', '4871', '4872', '4873', '4874', '4875')) GROUP BY `ds`, `p1`, `p2`, `p3`, `p4`, `p5`, `p6_md5`, `p7_md5` ORDER BY `ds2` DESC;

explain select gad.id as gid,sdk.id as sid,gad.aid as aid,gad.cm as cm,sdk.dic as dic,sdk.ip as ip, sdk.t as t, gad.p1 as p1, gad.p2 as p2, gad.p3 as p3, gad.p4 as p4, gad.p5 as p5, gad.p6_md5 as p6, gad.p7_md5 as p7, gad.ext as ext, gad.t as gtime from st gad join (select id, aid, pt, dic, ip, t from dd where pt = 'android' and bm = 0 and t > 1478143908) sdk on gad.aid = sdk.aid and gad.ip = sdk.ip and sdk.t > gad.t where gad.t > 1478143908 and gad.bm = 0 and gad.pt = 'android' group by gad.aid, sdk.dic limit 2500;
explain select gad.id as gid,sdk.id as sid,gad.aid as aid,gad.cm as cm,sdk.dic as dic,sdk.ip as ip, sdk.t as t, gad.p1 as p1, gad.p2 as p2, gad.p3 as p3, gad.p4 as p4, gad.p5 as p5, gad.p6_md5 as p6, gad.p7_md5 as p7, gad.ext as ext, gad.t as gtime from st gad join (select id, aid, pt, dic, ip, t from dd where pt = 'android' and bm = 0 and t > 1478143908) sdk on gad.aid = sdk.aid and gad.ip = sdk.ip and sdk.t > gad.t where gad.t > 1478143908 and gad.pt = 'android' group by gad.aid, sdk.dic limit 2500;

explain select gad.id as gid,sdk.id as sid,gad.aid as aid,gad.cm as cm,sdk.dic as dic,sdk.ip as ip, sdk.t as t, gad.p1 as p1, gad.p2 as p2, gad.p3 as p3, gad.p4 as p4, gad.p5 as p5, gad.p6_md5 as p6, gad.p7_md5 as p7, gad.ext as ext from st gad join dd sdk on gad.aid = sdk.aid and gad.dic = sdk.mac and gad.t < sdk.t where gad.t > 1477971479 and gad.bm = 0 and gad.pt = 'ios' and gad.dit = 'mac' and sdk.t > 1477971479 and sdk.bm = 0 and sdk.pt = 'ios' limit 3000;

Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ type Binlog struct {
// If IgnoreError is true, when writing binlog meets error, TiDB would
// ignore the error.
IgnoreError bool `toml:"ignore-error" json:"ignore-error"`
// Use socket file to write binlog, for compatible with kafka version tidb-binlog.
BinlogSocket string `toml:"binlog-socket" json:"binlog-socket"`
}

var defaultConf = Config{
Expand Down
3 changes: 3 additions & 0 deletions config/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,6 @@ write-timeout = "15s"
# If IgnoreError is true, when writting binlog meets error, TiDB would stop writting binlog,
# but still provide service.
ignore-error = false

# use socket file to write binlog, for compatible with kafka version tidb-binlog.
binlog-socket = ""
2 changes: 1 addition & 1 deletion ddl/column_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func getCurrentTable(d *ddl, schemaID, tableID int64) (table.Table, error) {
if err != nil {
return nil, errors.Trace(err)
}
alloc := autoid.NewAllocator(d.store, schemaID)
alloc := autoid.NewAllocator(d.store, schemaID, false)
tbl, err := table.TableFromMeta(alloc, tblInfo)
if err != nil {
return nil, errors.Trace(err)
Expand Down
4 changes: 3 additions & 1 deletion ddl/column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ func (s *testColumnSuite) colDefStrToFieldType(c *C, str string) *types.FieldTyp
func (s *testColumnSuite) TestFieldCase(c *C) {
var fields = []string{"field", "Field"}
var colDefs = make([]*ast.ColumnDef, len(fields))
var colObjects []interface{}
for i, name := range fields {
colDefs[i] = &ast.ColumnDef{
Name: &ast.ColumnName{
Expand All @@ -953,6 +954,7 @@ func (s *testColumnSuite) TestFieldCase(c *C) {
Name: model.NewCIStr(name),
},
}
colObjects = append(colObjects, colDefs[i])
}
c.Assert(checkDuplicateColumn(colDefs), NotNil)
c.Assert(checkDuplicateColumn(colObjects), NotNil)
}
5 changes: 5 additions & 0 deletions ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,16 @@ var (
ErrWarnDataTruncated = terror.ClassDDL.New(codeWarnDataTruncated, mysql.MySQLErrName[mysql.WarnDataTruncated])
// ErrCoalesceOnlyOnHashPartition returns coalesce partition can only be used on hash/key partitions.
ErrCoalesceOnlyOnHashPartition = terror.ClassDDL.New(codeCoalesceOnlyOnHashPartition, mysql.MySQLErrName[mysql.ErrCoalesceOnlyOnHashPartition])
// ErrViewWrongList returns create view must include all columns in the select clause
ErrViewWrongList = terror.ClassDDL.New(codeViewWrongList, mysql.MySQLErrName[mysql.ErrViewWrongList])
)

// DDL is responsible for updating schema in data store and maintaining in-memory InfoSchema cache.
type DDL interface {
CreateSchema(ctx sessionctx.Context, name model.CIStr, charsetInfo *ast.CharsetOpt) error
DropSchema(ctx sessionctx.Context, schema model.CIStr) error
CreateTable(ctx sessionctx.Context, stmt *ast.CreateTableStmt) error
CreateView(ctx sessionctx.Context, stmt *ast.CreateViewStmt) error
CreateTableWithLike(ctx sessionctx.Context, ident, referIdent ast.Ident, ifNotExists bool) error
DropTable(ctx sessionctx.Context, tableIdent ast.Ident) (err error)
CreateIndex(ctx sessionctx.Context, tableIdent ast.Ident, unique bool, indexName model.CIStr,
Expand Down Expand Up @@ -621,6 +624,7 @@ const (
codeWrongKeyColumn = 1167
codeBlobKeyWithoutLength = 1170
codeInvalidOnUpdate = 1294
codeViewWrongList = 1353
codeUnsupportedOnGeneratedColumn = 3106
codeGeneratedColumnNonPrior = 3107
codeDependentByGeneratedColumn = 3108
Expand Down Expand Up @@ -679,6 +683,7 @@ func init() {
codeTableMustHaveColumns: mysql.ErrTableMustHaveColumns,
codeTooManyFields: mysql.ErrTooManyFields,
codeErrTooLongIndexComment: mysql.ErrTooLongIndexComment,
codeViewWrongList: mysql.ErrViewWrongList,
codeUnknownCharacterSet: mysql.ErrUnknownCharacterSet,
codePartitionsMustBeDefined: mysql.ErrPartitionsMustBeDefined,
codePartitionMgmtOnNonpartitioned: mysql.ErrPartitionMgmtOnNonpartitioned,
Expand Down
134 changes: 120 additions & 14 deletions ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/schemautil"
"github.com/pingcap/tidb/util/set"
)

func (d *ddl) CreateSchema(ctx sessionctx.Context, schema model.CIStr, charsetInfo *ast.CharsetOpt) (err error) {
Expand Down Expand Up @@ -569,14 +570,22 @@ func checkColumnValueConstraint(col *table.Column) error {
return nil
}

func checkDuplicateColumn(colDefs []*ast.ColumnDef) error {
colNames := map[string]bool{}
for _, colDef := range colDefs {
nameLower := colDef.Name.Name.L
if colNames[nameLower] {
return infoschema.ErrColumnExists.GenWithStackByArgs(colDef.Name.Name)
func checkDuplicateColumn(cols []interface{}) error {
colNames := set.StringSet{}
var nameLower string
for _, col := range cols {
switch x := col.(type) {
case *ast.ColumnDef:
nameLower = x.Name.Name.L
case model.CIStr:
nameLower = x.L
default:
nameLower = ""
}
if colNames.Exist(nameLower) {
return infoschema.ErrColumnExists.GenWithStackByArgs(nameLower)
}
colNames[nameLower] = true
colNames.Insert(nameLower)
}
return nil
}
Expand Down Expand Up @@ -607,10 +616,19 @@ func checkGeneratedColumn(colDefs []*ast.ColumnDef) error {
return nil
}

func checkTooLongColumn(colDefs []*ast.ColumnDef) error {
for _, colDef := range colDefs {
if len(colDef.Name.Name.O) > mysql.MaxColumnNameLength {
return ErrTooLongIdent.GenWithStackByArgs(colDef.Name.Name)
func checkTooLongColumn(cols []interface{}) error {
var colName string
for _, col := range cols {
switch x := col.(type) {
case *ast.ColumnDef:
colName = x.Name.Name.O
case model.CIStr:
colName = x.O
default:
colName = ""
}
if len(colName) > mysql.MaxColumnNameLength {
return ErrTooLongIdent.GenWithStackByArgs(colName)
}
}
return nil
Expand Down Expand Up @@ -888,16 +906,21 @@ func (d *ddl) CreateTable(ctx sessionctx.Context, s *ast.CreateTableStmt) (err e
}
return infoschema.ErrTableExists.GenWithStackByArgs(ident)
}

var colObjects []interface{}
for _, col := range colDefs {
colObjects = append(colObjects, col)
}
if err = checkTooLongTable(ident.Name); err != nil {
return errors.Trace(err)
}
if err = checkDuplicateColumn(colDefs); err != nil {
if err = checkDuplicateColumn(colObjects); err != nil {
return errors.Trace(err)
}
if err = checkGeneratedColumn(colDefs); err != nil {
return errors.Trace(err)
}
if err = checkTooLongColumn(colDefs); err != nil {
if err = checkTooLongColumn(colObjects); err != nil {
return errors.Trace(err)
}
if err = checkTooManyColumns(colDefs); err != nil {
Expand Down Expand Up @@ -981,6 +1004,89 @@ func (d *ddl) CreateTable(ctx sessionctx.Context, s *ast.CreateTableStmt) (err e
return errors.Trace(err)
}

func (d *ddl) CreateView(ctx sessionctx.Context, s *ast.CreateViewStmt) (err error) {
ident := ast.Ident{Name: s.ViewName.Name, Schema: s.ViewName.Schema}
is := d.GetInformationSchema(ctx)
schema, ok := is.SchemaByName(ident.Schema)
if !ok {
return infoschema.ErrDatabaseNotExists.GenWithStackByArgs(ident.Schema)
}
if is.TableExists(ident.Schema, ident.Name) {
return infoschema.ErrTableExists.GenWithStackByArgs(ident)
}
if err = checkTooLongTable(ident.Name); err != nil {
return err
}
viewInfo, cols := buildViewInfoWithTableColumns(ctx, s)

var colObjects []interface{}
for _, col := range viewInfo.Cols {
colObjects = append(colObjects, col)
}

if err = checkTooLongColumn(colObjects); err != nil {
return err
}
if err = checkDuplicateColumn(colObjects); err != nil {
return err
}

tbInfo, err := buildTableInfo(ctx, d, ident.Name, cols, nil)
if err != nil {
return err
}
tbInfo.View = viewInfo

job := &model.Job{
SchemaID: schema.ID,
TableID: tbInfo.ID,
Type: model.ActionCreateView,
BinlogInfo: &model.HistoryInfo{},
Args: []interface{}{tbInfo, s.OrReplace},
}
err = d.doDDLJob(ctx, job)

return d.callHookOnChanged(err)
}

func buildViewInfoWithTableColumns(ctx sessionctx.Context, s *ast.CreateViewStmt) (*model.ViewInfo, []*table.Column) {
viewInfo := &model.ViewInfo{Definer: s.Definer, Algorithm: s.Algorithm,
Security: s.Security, SelectStmt: s.Select.Text(), CheckOption: s.CheckOption}

if s.Definer.CurrentUser {
viewInfo.Definer = ctx.GetSessionVars().User
}

var schemaCols = s.Select.(*ast.SelectStmt).Fields.Fields
viewInfo.Cols = make([]model.CIStr, len(schemaCols))
for i, v := range schemaCols {
viewInfo.Cols[i] = v.AsName
}

var tableColumns = make([]*table.Column, len(schemaCols))
if s.Cols == nil {
for i, v := range schemaCols {
tableColumns[i] = table.ToColumn(&model.ColumnInfo{
Name: v.AsName,
ID: int64(i),
Offset: i,
State: model.StatePublic,
})
}
} else {
for i, v := range s.Cols {
tableColumns[i] = table.ToColumn(&model.ColumnInfo{
Name: v,
ID: int64(i),
Offset: i,
State: model.StatePublic,
})
}
}

return viewInfo, tableColumns
}

func checkPartitionByHash(pi *model.PartitionInfo) error {
if err := checkAddPartitionTooManyPartitions(pi.Num); err != nil {
return errors.Trace(err)
Expand Down Expand Up @@ -1026,7 +1132,7 @@ func checkCharsetAndCollation(cs string, co string) error {
// handleAutoIncID handles auto_increment option in DDL. It creates a ID counter for the table and initiates the counter to a proper value.
// For example if the option sets auto_increment to 10. The counter will be set to 9. So the next allocated ID will be 10.
func (d *ddl) handleAutoIncID(tbInfo *model.TableInfo, schemaID int64) error {
alloc := autoid.NewAllocator(d.store, tbInfo.GetDBID(schemaID))
alloc := autoid.NewAllocator(d.store, tbInfo.GetDBID(schemaID), tbInfo.IsAutoIncColUnsigned())
tbInfo.State = model.StatePublic
tb, err := table.TableFromMeta(alloc, tbInfo)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ func (w *worker) runDDLJob(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64,
ver, err = onDropSchema(t, job)
case model.ActionCreateTable:
ver, err = onCreateTable(d, t, job)
case model.ActionCreateView:
ver, err = onCreateView(d, t, job)
case model.ActionDropTable:
ver, err = onDropTable(t, job)
case model.ActionDropTablePartition:
Expand Down
Loading

0 comments on commit b518488

Please sign in to comment.