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.
|
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() |
|
}) |
|
} |
Enhancement
split
InitDDLJobTablesto 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