statistics: remove some dead codes (#59363)
This commit is contained in:
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user