Skip to content

Commit

Permalink
statistics: update some vars for internal sessions correctly (#53977) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jul 3, 2024
1 parent b0b845f commit 497f837
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/statistics/handle/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ func CallWithSCtx(pool SessionPool, f func(sctx sessionctx.Context) error, flags

// UpdateSCtxVarsForStats updates all necessary variables that may affect the behavior of statistics.
func UpdateSCtxVarsForStats(sctx sessionctx.Context) error {
// async merge global stats
enableAsyncMergeGlobalStats, err := sctx.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(variable.TiDBEnableAsyncMergeGlobalStats)
if err != nil {
return err
}
sctx.GetSessionVars().EnableAsyncMergeGlobalStats = variable.TiDBOptOn(enableAsyncMergeGlobalStats)

// concurrency of save stats to storage
analyzePartitionConcurrency, err := sctx.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(variable.TiDBAnalyzePartitionConcurrency)
if err != nil {
return err
}
c, err := strconv.ParseInt(analyzePartitionConcurrency, 10, 64)
if err != nil {
return err
}
sctx.GetSessionVars().AnalyzePartitionConcurrency = int(c)

// analyzer version
verInString, err := sctx.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(variable.TiDBAnalyzeVersion)
if err != nil {
Expand Down

0 comments on commit 497f837

Please sign in to comment.