diff --git a/ddl/ddl_api.go b/ddl/ddl_api.go index 37cf2f1e44879..58cc5030d24b0 100644 --- a/ddl/ddl_api.go +++ b/ddl/ddl_api.go @@ -6703,6 +6703,7 @@ func (d *ddl) createIndex(ctx sessionctx.Context, ti ast.Ident, keyType ast.Inde } tzName, tzOffset := ddlutil.GetTimeZone(ctx) + charset, collate := ctx.GetSessionVars().GetCharsetInfo() job := &model.Job{ SchemaID: schema.ID, TableID: t.Meta().ID, @@ -6718,6 +6719,8 @@ func (d *ddl) createIndex(ctx sessionctx.Context, ti ast.Ident, keyType ast.Inde }, Args: []interface{}{unique, indexName, indexPartSpecifications, indexOption, hiddenCols, global}, Priority: ctx.GetSessionVars().DDLReorgPriority, + Charset: charset, + Collate: collate, } err = d.DoDDLJob(ctx, job) diff --git a/ddl/index.go b/ddl/index.go index b095bc7eed634..0acfd4fd79f6f 100644 --- a/ddl/index.go +++ b/ddl/index.go @@ -699,6 +699,9 @@ func (w *worker) onCreateIndex(d *ddlCtx, t *meta.Meta, job *model.Job, isPK boo if job.ReorgMeta.ReorgTp == model.ReorgTypeLitMerge { ingest.LitBackCtxMgr.Unregister(job.ID) } + logutil.BgLogger().Info("[ddl] run add index job done", + zap.String("charset", job.Charset), + zap.String("collation", job.Collate)) default: err = dbterror.ErrInvalidDDLState.GenWithStackByArgs("index", tblInfo.State) } diff --git a/executor/seqtest/seq_executor_test.go b/executor/seqtest/seq_executor_test.go index 5af9e3dc18196..1ca8a92f6c958 100644 --- a/executor/seqtest/seq_executor_test.go +++ b/executor/seqtest/seq_executor_test.go @@ -940,7 +940,7 @@ func TestBatchInsertDelete(t *testing.T) { kv.TxnTotalSizeLimit.Store(originLimit) }() // Set the limitation to a small value, make it easier to reach the limitation. - kv.TxnTotalSizeLimit.Store(5900) + kv.TxnTotalSizeLimit.Store(6000) tk := testkit.NewTestKit(t, store) tk.MustExec("use test") diff --git a/parser/model/ddl.go b/parser/model/ddl.go index 23638519e01d9..d6d8790962382 100644 --- a/parser/model/ddl.go +++ b/parser/model/ddl.go @@ -344,6 +344,8 @@ func (sub *SubJob) ToProxyJob(parentJob *Job) Job { MultiSchemaInfo: &MultiSchemaInfo{Revertible: sub.Revertible}, Priority: parentJob.Priority, SeqNum: parentJob.SeqNum, + Charset: parentJob.Charset, + Collate: parentJob.Collate, } } @@ -423,6 +425,11 @@ type Job struct { // SeqNum is the total order in all DDLs, it's used to identify the order of DDL. SeqNum uint64 `json:"seq_num"` + + // Charset is the charset when the DDL Job is created. + Charset string `json:"charset"` + // Collate is the collation the DDL Job is created. + Collate string `json:"collate"` } // FinishTableJob is called when a job is finished. diff --git a/parser/model/ddl_test.go b/parser/model/ddl_test.go index 04d2992aed939..1b501327239cf 100644 --- a/parser/model/ddl_test.go +++ b/parser/model/ddl_test.go @@ -50,7 +50,7 @@ func TestJobSize(t *testing.T) { - SubJob.ToProxyJob() ` job := model.Job{} - require.Equal(t, 288, int(unsafe.Sizeof(job)), msg) + require.Equal(t, 320, int(unsafe.Sizeof(job)), msg) } func TestBackfillMetaCodec(t *testing.T) {