From 8737e48b53978bef10417df04f30836790dc6f3e Mon Sep 17 00:00:00 2001 From: hillium Date: Mon, 23 Dec 2024 12:10:51 +0800 Subject: [PATCH] rename enable -> tweak Signed-off-by: hillium --- br/pkg/task/common_test.go | 2 +- br/pkg/task/restore.go | 6 +++--- br/pkg/task/stream.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/br/pkg/task/common_test.go b/br/pkg/task/common_test.go index b58f3f52ee57f..cc0c64e531857 100644 --- a/br/pkg/task/common_test.go +++ b/br/pkg/task/common_test.go @@ -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) diff --git a/br/pkg/task/restore.go b/br/pkg/task/restore.go index 7aa5303e9c6e2..95c5141d82449 100644 --- a/br/pkg/task/restore.go +++ b/br/pkg/task/restore.go @@ -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() { @@ -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 diff --git a/br/pkg/task/stream.go b/br/pkg/task/stream.go index 85b70e8d9aca3..d56b9b021354a 100644 --- a/br/pkg/task/stream.go +++ b/br/pkg/task/stream.go @@ -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 {