diff --git a/executor/analyze_global_stats.go b/executor/analyze_global_stats.go index 85bb1863a6a61..2c7ca951626f1 100644 --- a/executor/analyze_global_stats.go +++ b/executor/analyze_global_stats.go @@ -99,7 +99,7 @@ func (e *AnalyzeExec) handleGlobalStats(ctx context.Context, globalStatsMap glob } // Dump global-level stats to kv. for i := 0; i < globalStats.Num; i++ { - globalStats.Fms[i].Destroy() + globalStats.Fms[i].DestroyAndPutToPool() hg, cms, topN := globalStats.Hg[i], globalStats.Cms[i], globalStats.TopN[i] if hg == nil { // All partitions have no stats so global stats are not created. @@ -131,7 +131,7 @@ func (e *AnalyzeExec) handleGlobalStats(ctx context.Context, globalStatsMap glob for _, value := range tableAllPartitionStats { for _, v := range value.Columns { - v.FMSketch.Destroy() + v.FMSketch.DestroyAndPutToPool() } } } diff --git a/statistics/fmsketch.go b/statistics/fmsketch.go index f947c86c2e6d7..485df1d98cc9b 100644 --- a/statistics/fmsketch.go +++ b/statistics/fmsketch.go @@ -212,8 +212,8 @@ func (s *FMSketch) reset() { s.maxSize = 0 } -// Destroy resets the FMSketch and puts it back to the pool. -func (s *FMSketch) Destroy() { +// DestroyAndPutToPool resets the FMSketch and puts it to the pool. +func (s *FMSketch) DestroyAndPutToPool() { if s == nil { return } diff --git a/statistics/handle/ddl.go b/statistics/handle/ddl.go index 9bc7d2589e41e..107fc6eba432c 100644 --- a/statistics/handle/ddl.go +++ b/statistics/handle/ddl.go @@ -210,7 +210,7 @@ func (h *Handle) updateGlobalStats(tblInfo *model.TableInfo) error { zap.String("item", "columns"), zap.Strings("missing", newColGlobalStats.MissingPartitionStats)) } for i := 0; i < newColGlobalStats.Num; i++ { - newColGlobalStats.Fms[i].Destroy() + newColGlobalStats.Fms[i].DestroyAndPutToPool() hg, cms, topN := newColGlobalStats.Hg[i], newColGlobalStats.Cms[i], newColGlobalStats.TopN[i] if hg == nil { // All partitions have no stats so global stats are not created. @@ -250,7 +250,7 @@ func (h *Handle) updateGlobalStats(tblInfo *model.TableInfo) error { zap.String("item", "index "+idx.Name.L), zap.Strings("missing", newIndexGlobalStats.MissingPartitionStats)) } for i := 0; i < newIndexGlobalStats.Num; i++ { - newColGlobalStats.Fms[i].Destroy() + newColGlobalStats.Fms[i].DestroyAndPutToPool() hg, cms, topN := newIndexGlobalStats.Hg[i], newIndexGlobalStats.Cms[i], newIndexGlobalStats.TopN[i] if hg == nil { // All partitions have no stats so global stats are not created. diff --git a/statistics/handle/globalstats/global_stats.go b/statistics/handle/globalstats/global_stats.go index 9ec4203154e30..9ea69d29ca43e 100644 --- a/statistics/handle/globalstats/global_stats.go +++ b/statistics/handle/globalstats/global_stats.go @@ -249,7 +249,7 @@ func (g *GlobalStatusHandler) MergePartitionStats2GlobalStats( globalStats.Fms[i] = allFms[i][0].Copy() for j := 1; j < len(allFms[i]); j++ { globalStats.Fms[i].MergeFMSketch(allFms[i][j]) - allFms[i][j].Destroy() + allFms[i][j].DestroyAndPutToPool() } // Update the global NDV.