Skip to content

Commit

Permalink
add one more log
Browse files Browse the repository at this point in the history
  • Loading branch information
winoros committed Dec 3, 2024
1 parent a2a418e commit 6cc809c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/statistics/handle/cache/statscache.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (s *StatsCacheImpl) Update(ctx context.Context, is infoschema.InfoSchema, t
noStatsInMemoryIDs := make([]int64, 0, len(rows))
noTableMetaIDs := make([]int64, 0, 100)
noStorageIDs := make([]int64, 0, 100)
noStatsMetaIDs := make([]int64, 0, 100)

for _, row := range rows {
version := row.GetUint64(0)
Expand Down Expand Up @@ -148,6 +149,10 @@ func (s *StatsCacheImpl) Update(ctx context.Context, is infoschema.InfoSchema, t
noStatsInMemoryIDs = append(noStatsInMemoryIDs, physicalID)
err = nil
}
if err != nil && err.Error() == "no stats meta" {
noStatsMetaIDs = append(noStatsMetaIDs, physicalID)
err = nil
}
// Error is not nil may mean that there are some ddl changes on this table, we will not update it.
if err != nil {
statslogutil.StatsLogger().Error(
Expand Down Expand Up @@ -202,6 +207,7 @@ func (s *StatsCacheImpl) Update(ctx context.Context, is infoschema.InfoSchema, t
zap.Int64s("IDs with no table meta", noTableMetaIDs),
zap.Int64s("IDs with no stats", noStorageIDs),
zap.Int64s("no stats in memory IDs", noStatsInMemoryIDs),
zap.Int64s("no stats meta IDs", noStatsMetaIDs),
)
}
return nil
Expand Down
6 changes: 6 additions & 0 deletions pkg/statistics/handle/storage/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,12 @@ func TableStatsFromStorage(sctx sessionctx.Context, snapshot uint64, tableInfo *
table.Pseudo = false

realtimeCount, modidyCount, isNull, err := StatsMetaCountAndModifyCount(util.StatsCtx, sctx, tableID)
if err != nil {
return nil, err
}
if isNull {
return nil, errors.Errorf("no stats meta")
}
if err != nil || isNull {
return nil, err
}
Expand Down

0 comments on commit 6cc809c

Please sign in to comment.