statistics: add update metrics for stats cache (#46665)

close pingcap/tidb#46577
This commit is contained in:
Weizhen Wang
2023-09-05 18:33:50 +08:00
committed by GitHub
parent 196bc2a589
commit a4b3df5a8c

View File

@ -118,6 +118,7 @@ func (sc *StatsCache) Put(id int64, t *statistics.Table) {
}
func (sc *StatsCache) putCache(id int64, t *statistics.Table) bool {
metrics.UpdateCounter.Inc()
ok := sc.c.Put(id, t)
if ok {
return ok
@ -202,9 +203,11 @@ func (sc *StatsCache) Update(tables []*statistics.Table, deletedIDs []int64, opt
}
for _, tbl := range tables {
id := tbl.PhysicalID
metrics.UpdateCounter.Inc()
sc.c.Put(id, tbl)
}
for _, id := range deletedIDs {
metrics.DelCounter.Inc()
sc.c.Del(id)
}