statistics: remove some dead codes (#59363)

This commit is contained in:
Yiding Cui
2025-02-10 18:26:59 +08:00
committed by GitHub
parent e4dc47f861
commit eae800f8d4
2 changed files with 0 additions and 47 deletions

View File

@ -52,46 +52,6 @@ func NewStatsReadWriter(statsHandler statstypes.StatsHandle) statstypes.StatsRea
return &statsReadWriter{statsHandler: statsHandler}
}
// InsertColStats2KV insert a record to stats_histograms with distinct_count 1 and insert a bucket to stats_buckets with default value.
// This operation also updates version.
func (s *statsReadWriter) InsertColStats2KV(physicalID int64, colInfos []*model.ColumnInfo) (err error) {
statsVer := uint64(0)
defer func() {
if err == nil && statsVer != 0 {
s.statsHandler.RecordHistoricalStatsMeta(statsVer, util.StatsMetaHistorySourceSchemaChange, false, physicalID)
}
}()
return util.CallWithSCtx(s.statsHandler.SPool(), func(sctx sessionctx.Context) error {
startTS, err := InsertColStats2KV(util.StatsCtx, sctx, physicalID, colInfos)
if err != nil {
return errors.Trace(err)
}
statsVer = startTS
return nil
}, util.FlagWrapTxn)
}
// InsertTableStats2KV inserts a record standing for a new table to stats_meta and inserts some records standing for the
// new columns and indices which belong to this table.
func (s *statsReadWriter) InsertTableStats2KV(info *model.TableInfo, physicalID int64) (err error) {
statsVer := uint64(0)
defer func() {
if err == nil && statsVer != 0 {
s.statsHandler.RecordHistoricalStatsMeta(statsVer, util.StatsMetaHistorySourceSchemaChange, false, physicalID)
}
}()
return util.CallWithSCtx(s.statsHandler.SPool(), func(sctx sessionctx.Context) error {
startTS, err := InsertTableStats2KV(util.StatsCtx, sctx, info, physicalID)
if err != nil {
return errors.Trace(err)
}
statsVer = startTS
return nil
}, util.FlagWrapTxn)
}
// ChangeGlobalStatsID changes the table ID in global-stats to the new table ID.
func (s *statsReadWriter) ChangeGlobalStatsID(from, to int64) (err error) {
return util.CallWithSCtx(s.statsHandler.SPool(), func(sctx sessionctx.Context) error {

View File

@ -353,13 +353,6 @@ type StatsReadWriter interface {
// SaveMetaToStorage saves the stats meta of a table to storage.
SaveMetaToStorage(tableID, count, modifyCount int64, source string) (err error)
// InsertColStats2KV inserts columns stats to kv.
InsertColStats2KV(physicalID int64, colInfos []*model.ColumnInfo) (err error)
// InsertTableStats2KV inserts a record standing for a new table to stats_meta and inserts some records standing for the
// new columns and indices which belong to this table.
InsertTableStats2KV(info *model.TableInfo, physicalID int64) (err error)
// UpdateStatsVersion will set statistics version to the newest TS,
// then tidb-server will reload automatic.
UpdateStatsVersion() error