Skip to content

Commit

Permalink
*: fix AnalyzePartitionMergeConcurrency unavailable (#47589)
Browse files Browse the repository at this point in the history
close #47594
  • Loading branch information
hawkingrei authored Oct 12, 2023
1 parent 0152683 commit 7a371dd
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 @@ -150,8 +150,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/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ func UpdateSCtxVarsForStats(sctx sessionctx.Context) error {
return err
}
sctx.GetSessionVars().SkipMissingPartitionStats = variable.TiDBOptOn(val)
verInString, err = sctx.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(variable.TiDBMergePartitionStatsConcurrency)
if err != nil {
return err
}
ver, err = strconv.ParseInt(verInString, 10, 64)
if err != nil {
return err
}
sctx.GetSessionVars().AnalyzePartitionMergeConcurrency = int(ver)
return nil
}

Expand Down

0 comments on commit 7a371dd

Please sign in to comment.