Skip to content

Use mDDLTableVersion key to control backfill related tables. #40980

Closed
@Defined2014

Description

Enhancement

split InitDDLJobTables to two functions. one for create ddl tables, another for create backfill related tables. It could avoid get database list during bootstrap.

tidb/session/session.go

Lines 3107 to 3130 in 337af61

func InitDDLJobTables(store kv.Storage) error {
return kv.RunInNewTxn(kv.WithInternalSourceType(context.Background(), kv.InternalTxnDDL), store, true, func(ctx context.Context, txn kv.Transaction) error {
t := meta.NewMeta(txn)
exists, err := t.CheckDDLTableExists()
if err != nil {
return errors.Trace(err)
}
dbID, err := t.CreateMySQLDatabaseIfNotExists()
if err != nil {
return err
}
if exists {
return initBackfillJobTables(store, t, dbID)
}
if err = createAndSplitTables(store, t, dbID, DDLJobTables); err != nil {
return err
}
if err = initBackfillJobTables(store, t, dbID); err != nil {
return err
}
return t.SetDDLTables()
})
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

type/enhancementThe issue or PR belongs to an enhancement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions