Skip to content

Commit

Permalink
*: tiny update
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala committed Sep 4, 2024
1 parent b4380ee commit 978e284
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions pkg/ddl/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4625,15 +4625,13 @@ func (e *executor) createVectorIndex(ctx sessionctx.Context, ti ast.Ident, index
return errors.Trace(err)
}

finalColumns := make([]*model.ColumnInfo, len(tblInfo.Columns), len(tblInfo.Columns))
copy(finalColumns, tblInfo.Columns)
// Check before the job is put to the queue.
// This check is redundant, but useful. If DDL check fail before the job is put
// to job queue, the fail path logic is particularly fast.
// After DDL job is put to the queue, and if the check fail, TiDB will run the DDL cancel logic.
// The recover step causes DDL wait a few seconds, makes the unit test painfully slow.
// For same reason, decide whether index is global here.
_, _, err = buildIndexColumns(ctx, finalColumns, indexPartSpecifications, true)
_, _, err = buildIndexColumns(ctx, tblInfo.Columns, indexPartSpecifications, true)
if err != nil {
return errors.Trace(err)
}
Expand All @@ -4644,7 +4642,7 @@ func (e *executor) createVectorIndex(ctx sessionctx.Context, ti ast.Ident, index
return errors.Trace(err)
}

job, err := e.buildAddIndexJobWithoutTypeAndArgs(ctx, schema, t)
job, err := buildAddIndexJobWithoutTypeAndArgs(ctx, schema, t)
if err != nil {
return errors.Trace(err)
}
Expand All @@ -4662,7 +4660,7 @@ func (e *executor) createVectorIndex(ctx sessionctx.Context, ti ast.Ident, index
return errors.Trace(err)
}

func (e *executor) buildAddIndexJobWithoutTypeAndArgs(ctx sessionctx.Context, schema *model.DBInfo, t table.Table) (*model.Job, error) {
func buildAddIndexJobWithoutTypeAndArgs(ctx sessionctx.Context, schema *model.DBInfo, t table.Table) (*model.Job, error) {
tzName, tzOffset := ddlutil.GetTimeZone(ctx)
charset, collate := ctx.GetSessionVars().GetCharsetInfo()
job := &model.Job{
Expand Down Expand Up @@ -4841,7 +4839,7 @@ func (e *executor) createIndex(ctx sessionctx.Context, ti ast.Ident, keyType ast
// global is set to 'false' is just there to be backwards compatible,
// to avoid unmarshal issues, it is now part of indexOption.
global := false
job, err := e.buildAddIndexJobWithoutTypeAndArgs(ctx, schema, t)
job, err := buildAddIndexJobWithoutTypeAndArgs(ctx, schema, t)
if err != nil {
return errors.Trace(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/domain/infosync/tiflash_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ func (tiflash *MockTiFlash) SetNetworkError(e bool) {
}

// SyncTiFlashTableSchema syncs the table's schema to TiFlash.
func (m *mockTiFlashReplicaManagerCtx) SyncTiFlashTableSchema(_ int64, _ *pd.StoresInfo) error {
func (*mockTiFlashReplicaManagerCtx) SyncTiFlashTableSchema(_ int64, _ *pd.StoresInfo) error {
return nil
}

Expand Down

0 comments on commit 978e284

Please sign in to comment.