-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Labels
affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.This bug affects the 8.5.x(LTS) versions.component/statisticsseverity/moderatesig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
- Create a tidb cluster
- Create 1000 tables
- Check the grafana
2. What did you expect to see? (Required)
The stats health is correct.
3. What did you see instead (Required)

| test | sbtest604 | | 89 |
| test | sbtest875 | | 90 |
| test | sbtest419 | | 89 |
| test | sbtest746 | | 89 |
| test | sbtest896 | | 89 |
+---------+------------+----------------+---------+
1000 rows in set (0.01 sec)
Introduce by #56475
// UpdateStatsHealthyMetrics updates stats healthy distribution metrics according to stats cache.
func (s *StatsCacheImpl) UpdateStatsHealthyMetrics() {
distribution := make([]int64, 9)
uneligibleAnalyze := 0
for _, tbl := range s.Values() {
- distribution[4]++ // total table count
+ distribution[7]++ // total table count
isEligibleForAnalysis := tbl.IsEligibleForAnalysis()
if !isEligibleForAnalysis {
uneligibleAnalyze++
continue
}
healthy, ok := tbl.GetStatsHealthy()
if !ok {
continue
}
if healthy < 50 {
distribution[0]++
} else if healthy < 55 {
distribution[1]++
} else if healthy < 60 {
distribution[2]++
} else if healthy < 70 {
distribution[3]++
} else if healthy < 80 {
distribution[4]++
} else if healthy < 100 {
distribution[5]++
} else {
distribution[6]++
}
}
for i, val := range distribution {
handle_metrics.StatsHealthyGauges[i].Set(float64(val))
}
handle_metrics.StatsHealthyGauges[8].Set(float64(uneligibleAnalyze))
}
4. What is your TiDB version? (Required)
master
Metadata
Metadata
Assignees
Labels
affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.This bug affects the 8.5.x(LTS) versions.component/statisticsseverity/moderatesig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.