Skip to content

Commit

Permalink
*: fix AnalyzePartitionMergeConcurrency unavailable (#47589) (#51141)
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 6d13674 commit 5fbffee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 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
9 changes: 9 additions & 0 deletions statistics/handle/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 5fbffee

Please sign in to comment.