From 5d98c169c98777d5ea63f8b399096d34b5abe5e4 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 13 May 2024 11:48:12 +0800 Subject: [PATCH] add concurrently-init-stats Signed-off-by: Weizhen Wang --- pkg/executor/analyze.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/executor/analyze.go b/pkg/executor/analyze.go index a3739480df5dc..2fbf0bc179cfa 100644 --- a/pkg/executor/analyze.go +++ b/pkg/executor/analyze.go @@ -161,10 +161,16 @@ TASKLOOP: dom.SysProcTracker().KillSysProcess(dom.GetAutoAnalyzeProcID()) }) // If we enabled dynamic prune mode, then we need to generate global stats here for partition tables. - if needGlobalStats && e.notEmpty.Load() { - err = e.handleGlobalStats(ctx, globalStatsMap) - if err != nil { - return err + if needGlobalStats { + if e.notEmpty.Load() { + err = e.handleGlobalStats(ctx, globalStatsMap) + if err != nil { + return err + } + } else { + for globalStatsID := range globalStatsMap { + statsHandle.SaveMetaToStorage(globalStatsID.tableID, 0, 0, handleutil.StatsMetaHistorySourceAnalyze) + } } }