Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <[email protected]>
  • Loading branch information
hawkingrei committed Sep 19, 2023
1 parent b43e238 commit b97ea0e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions executor/analyze_global_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions statistics/fmsketch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions statistics/handle/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion statistics/handle/globalstats/global_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b97ea0e

Please sign in to comment.