Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Yisaer committed Jan 4, 2023
1 parent 2eeae63 commit 7c7a5ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions domain/historical_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (w *HistoricalStatsWorker) DumpHistoricalStats(tableID int64, statsHandle *
return errors.Errorf("cannot get DBInfo by TableID %d", tableID)
}
if _, err := statsHandle.RecordHistoricalStatsToStorage(dbInfo.Name.O, tblInfo, tableID, isPartition); err != nil {
generateHistoricalStatsFailedCounter.Inc()
return errors.Errorf("record table %s.%s's historical stats failed, err:%v", dbInfo.Name.O, tblInfo.Name.O, err)
}
generateHistoricalStatsSuccessCounter.Inc()
Expand Down
8 changes: 4 additions & 4 deletions statistics/handle/handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1159,8 +1159,8 @@ func TestGlobalStatsData2(t *testing.T) {
tk.MustExec("analyze table tint with 2 topn, 2 buckets")

tk.MustQuery("select modify_count, count from mysql.stats_meta order by table_id asc").Check(testkit.Rows(
"0 20", // global: g.count = p0.count + p1.count
"0 9", // p0
"0 20", // global: g.count = p0.count + p1.count
"0 9", // p0
"0 11")) // p1

tk.MustQuery("show stats_topn where table_name='tint' and is_index=0").Check(testkit.Rows(
Expand Down Expand Up @@ -1190,7 +1190,7 @@ func TestGlobalStatsData2(t *testing.T) {

tk.MustQuery("select distinct_count, null_count, tot_col_size from mysql.stats_histograms where is_index=0 order by table_id asc").Check(
testkit.Rows("12 1 19", // global, g = p0 + p1
"5 1 8", // p0
"5 1 8", // p0
"7 0 11")) // p1

tk.MustQuery("show stats_buckets where is_index=1").Check(testkit.Rows(
Expand All @@ -1204,7 +1204,7 @@ func TestGlobalStatsData2(t *testing.T) {

tk.MustQuery("select distinct_count, null_count from mysql.stats_histograms where is_index=1 order by table_id asc").Check(
testkit.Rows("12 1", // global, g = p0 + p1
"5 1", // p0
"5 1", // p0
"7 0")) // p1

// double + (column + index with 1 column)
Expand Down

0 comments on commit 7c7a5ac

Please sign in to comment.