diff --git a/br/pkg/lightning/lightning.go b/br/pkg/lightning/lightning.go index b068e4bad33f7..0a9cf1585456a 100644 --- a/br/pkg/lightning/lightning.go +++ b/br/pkg/lightning/lightning.go @@ -75,6 +75,9 @@ type Lightning struct { } func initEnv(cfg *config.GlobalConfig) error { + if cfg.App.Config.File == "" { + return nil + } return log.InitLogger(&cfg.App.Config, cfg.TiDB.LogLevel) } diff --git a/br/pkg/lightning/restore/table_restore.go b/br/pkg/lightning/restore/table_restore.go index 5d0ad6addca89..4abf8e8591270 100644 --- a/br/pkg/lightning/restore/table_restore.go +++ b/br/pkg/lightning/restore/table_restore.go @@ -192,6 +192,7 @@ func createColumnPermutation(columns []string, ignoreColumns []string, tableInfo func (tr *TableRestore) restoreEngines(pCtx context.Context, rc *Controller, cp *checkpoints.TableCheckpoint) error { indexEngineCp := cp.Engines[indexEngineID] if indexEngineCp == nil { + tr.logger.Error("fail to restoreEngines because indexengine is nil") return errors.Errorf("table %v index engine checkpoint not found", tr.tableName) } // If there is an index engine only, it indicates no data needs to restore. diff --git a/br/pkg/lightning/restore/tidb.go b/br/pkg/lightning/restore/tidb.go index 7f242a297b3c1..ee1252fd3862d 100644 --- a/br/pkg/lightning/restore/tidb.go +++ b/br/pkg/lightning/restore/tidb.go @@ -112,9 +112,10 @@ func DBFromConfig(ctx context.Context, dsn config.DBStore) (*sql.DB, error) { // always set auto-commit to ON "autocommit": "1", } + if dsn.Vars != nil { for k, v := range dsn.Vars { - param.Vars[k] = v + vars[k] = v } }