diff --git a/executor/analyze_test.go b/executor/analyze_test.go index ce5e9b4a9130a..48e725ec912b0 100644 --- a/executor/analyze_test.go +++ b/executor/analyze_test.go @@ -369,8 +369,8 @@ func TestAnalyzePartitionTableByConcurrencyInDynamic(t *testing.T) { for _, tc := range testcases { concurrency := tc.concurrency fmt.Println("testcase ", concurrency) - tk.MustExec(fmt.Sprintf("set @@tidb_merge_partition_stats_concurrency=%v", concurrency)) - tk.MustQuery("select @@tidb_merge_partition_stats_concurrency").Check(testkit.Rows(concurrency)) + tk.MustExec(fmt.Sprintf("set @@global.tidb_merge_partition_stats_concurrency=%v", concurrency)) + tk.MustQuery("select @@global.tidb_merge_partition_stats_concurrency").Check(testkit.Rows(concurrency)) tk.MustExec(fmt.Sprintf("set @@tidb_analyze_partition_concurrency=%v", concurrency)) tk.MustQuery("select @@tidb_analyze_partition_concurrency").Check(testkit.Rows(concurrency)) diff --git a/statistics/handle/handle.go b/statistics/handle/handle.go index 1a934e068a22a..b9bb52d4a3ac6 100644 --- a/statistics/handle/handle.go +++ b/statistics/handle/handle.go @@ -636,6 +636,15 @@ func (h *Handle) UpdateSessionVar() error { return err } h.mu.ctx.GetSessionVars().AnalyzeVersion = int(ver) + verInString, err = h.mu.ctx.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(variable.TiDBMergePartitionStatsConcurrency) + if err != nil { + return err + } + ver2, err := strconv.ParseInt(verInString, 10, 64) + if err != nil { + return err + } + h.mu.ctx.GetSessionVars().AnalyzePartitionMergeConcurrency = int(ver2) return err }