Skip to content

Commit

Permalink
fix conflict after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwangchao committed Sep 25, 2024
1 parent 86c612e commit a370b3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions pkg/ddl/create_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/pingcap/tidb/pkg/ddl/notifier"
"github.com/pingcap/tidb/pkg/ddl/placement"
"github.com/pingcap/tidb/pkg/domain/infosync"
"github.com/pingcap/tidb/pkg/errctx"
"github.com/pingcap/tidb/pkg/expression"
"github.com/pingcap/tidb/pkg/infoschema"
infoschemactx "github.com/pingcap/tidb/pkg/infoschema/context"
Expand Down Expand Up @@ -406,7 +407,7 @@ func buildTableInfoWithCheck(ctx *metabuild.Context, s *ast.CreateTableStmt, dbC
if err = checkTableInfoValidWithStmt(ctx, tbInfo, s); err != nil {
return nil, err
}
if err = checkTableInfoValidExtra(ctx, tbInfo); err != nil {
if err = checkTableInfoValidExtra(ctx.GetExprCtx().GetEvalCtx().ErrCtx(), tbInfo); err != nil {
return nil, err
}
return tbInfo, nil
Expand Down Expand Up @@ -512,7 +513,7 @@ func checkGeneratedColumn(ctx *metabuild.Context, schemaName pmodel.CIStr, table
// name length and column count.
// (checkTableInfoValid is also used in repairing objects which don't perform
// these checks. Perhaps the two functions should be merged together regardless?)
func checkTableInfoValidExtra(ctx sessionctx.Context, tbInfo *model.TableInfo) error {
func checkTableInfoValidExtra(ec errctx.Context, tbInfo *model.TableInfo) error {
if err := checkTooLongTable(tbInfo.Name); err != nil {
return err
}
Expand All @@ -532,7 +533,7 @@ func checkTableInfoValidExtra(ctx sessionctx.Context, tbInfo *model.TableInfo) e
if err := checkColumnsAttributes(tbInfo.Columns); err != nil {
return errors.Trace(err)
}
if err := checkGlobalIndexes(ctx, tbInfo); err != nil {
if err := checkGlobalIndexes(ec, tbInfo); err != nil {
return errors.Trace(err)
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/ddl/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ func checkInvisibleIndexOnPK(tblInfo *model.TableInfo) error {
}

// checkGlobalIndex check if the index is allowed to have global index
func checkGlobalIndex(ctx sessionctx.Context, tblInfo *model.TableInfo, indexInfo *model.IndexInfo) error {
func checkGlobalIndex(ec errctx.Context, tblInfo *model.TableInfo, indexInfo *model.IndexInfo) error {
pi := tblInfo.GetPartitionInfo()
isPartitioned := pi != nil && pi.Type != pmodel.PartitionTypeNone
if indexInfo.Global {
Expand All @@ -961,15 +961,15 @@ func checkGlobalIndex(ctx sessionctx.Context, tblInfo *model.TableInfo, indexInf
if inAllPartitionColumns {
return dbterror.ErrGeneralUnsupportedDDL.GenWithStackByArgs("Global Index including all columns in the partitioning expression")
}
validateGlobalIndexWithGeneratedColumns(ctx.GetSessionVars().StmtCtx.ErrCtx(), tblInfo, indexInfo.Name.O, indexInfo.Columns)
validateGlobalIndexWithGeneratedColumns(ec, tblInfo, indexInfo.Name.O, indexInfo.Columns)
}
return nil
}

// checkGlobalIndexes check if global index is supported.
func checkGlobalIndexes(ctx sessionctx.Context, tblInfo *model.TableInfo) error {
func checkGlobalIndexes(ec errctx.Context, tblInfo *model.TableInfo) error {
for _, indexInfo := range tblInfo.Indices {
err := checkGlobalIndex(ctx, tblInfo, indexInfo)
err := checkGlobalIndex(ec, tblInfo, indexInfo)
if err != nil {
return err
}
Expand Down Expand Up @@ -1079,7 +1079,7 @@ func (e *executor) createTableWithInfoJob(
}
}

if err := checkTableInfoValidExtra(ctx, tbInfo); err != nil {
if err := checkTableInfoValidExtra(ctx.GetSessionVars().StmtCtx.ErrCtx(), tbInfo); err != nil {
return nil, err
}

Expand Down

0 comments on commit a370b3a

Please sign in to comment.