Skip to content

Commit

Permalink
rename enable -> tweak
Browse files Browse the repository at this point in the history
Signed-off-by: hillium <[email protected]>
  • Loading branch information
YuJuncen committed Dec 23, 2024
1 parent 9e989bb commit 8737e48
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion br/pkg/task/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestUrlNoQuery(t *testing.T) {

func TestTiDBConfigUnchanged(t *testing.T) {
cfg := config.GetGlobalConfig()
restoreConfig := enableTiDBConfig()
restoreConfig := tweakLocalConfForRestore()
require.NotEqual(t, config.GetGlobalConfig(), cfg)
restoreConfig()
require.Equal(t, config.GetGlobalConfig(), cfg)
Expand Down
6 changes: 3 additions & 3 deletions br/pkg/task/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ func runSnapshotRestore(c context.Context, mgr *conn.Mgr, g glue.Glue, cmdName s
}

// pre-set TiDB config for restore
restoreDBConfig := enableTiDBConfig()
restoreDBConfig := tweakLocalConfForRestore()
defer restoreDBConfig()

if client.GetSupportPolicy() {
Expand Down Expand Up @@ -1407,9 +1407,9 @@ func filterRestoreFiles(
return
}

// enableTiDBConfig tweaks some of configs of TiDB to make the restore progress go well.
// tweakLocalConfForRestore tweaks some of configs of TiDB to make the restore progress go well.
// return a function that could restore the config to origin.
func enableTiDBConfig() func() {
func tweakLocalConfForRestore() func() {
restoreConfig := config.RestoreFunc()
config.UpdateGlobal(func(conf *config.Config) {
// set max-index-length before execute DDLs and create tables
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/task/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ func restoreStream(
ctx, cancelFn := context.WithCancel(c)
defer cancelFn()

restoreCfg := enableTiDBConfig()
restoreCfg := tweakLocalConfForRestore()
defer restoreCfg()

if span := opentracing.SpanFromContext(ctx); span != nil && span.Tracer() != nil {
Expand Down

0 comments on commit 8737e48

Please sign in to comment.