Skip to content

Commit

Permalink
*: fix AnalyzePartitionMergeConcurrency unavailable (#47589) (#51140)
Browse files Browse the repository at this point in the history
close #47594
  • Loading branch information
ti-chi-bot authored Feb 19, 2024
1 parent f4dabb9 commit b19d950
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions executor/analyze_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
11 changes: 10 additions & 1 deletion statistics/handle/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,16 @@ func (h *Handle) UpdateSessionVar() error {
return err
}
h.mu.ctx.GetSessionVars().AnalyzeVersion = int(ver)
return err
verInString, err = h.mu.ctx.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(variable.TiDBMergePartitionStatsConcurrency)
if err != nil {
return err
}
ver, err = strconv.ParseInt(verInString, 10, 64)
if err != nil {
return err
}
h.mu.ctx.GetSessionVars().AnalyzePartitionMergeConcurrency = int(ver)
return nil
}

// GlobalStats is used to store the statistics contained in the global-level stats
Expand Down

0 comments on commit b19d950

Please sign in to comment.