Skip to content

Commit

Permalink
lightning: fix in-correctly check for session variable (#29291)
Browse files Browse the repository at this point in the history
  • Loading branch information
Little-Wallace authored Nov 1, 2021
1 parent 01e4bdd commit bdc9987
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions br/pkg/lightning/lightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/restore/table_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion br/pkg/lightning/restore/tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit bdc9987

Please sign in to comment.