Skip to content

Commit

Permalink
statistics: remove useless GetFullTableName (#52552) (#52587)
Browse files Browse the repository at this point in the history
close #52553
  • Loading branch information
ti-chi-bot committed Apr 12, 2024
1 parent 85de551 commit 7efe4ea
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion pkg/statistics/handle/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (h *Handle) initStatsMeta4Chunk(is infoschema.InfoSchema, cache util.StatsC
tbl := &statistics.Table{
HistColl: newHistColl,
Version: row.GetUint64(0),
Name: util.GetFullTableName(is, tableInfo),
}
cache.Put(physicalID, tbl) // put this table again since it is updated
}
Expand Down
1 change: 0 additions & 1 deletion pkg/statistics/handle/cache/statscache.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func (s *StatsCacheImpl) Update(is infoschema.InfoSchema) error {
tbl.Version = version
tbl.RealtimeCount = count
tbl.ModifyCount = modifyCount
tbl.Name = util.GetFullTableName(is, tableInfo)
tbl.TblInfoUpdateTS = tableInfo.UpdateTS
tables = append(tables, tbl)
}
Expand Down
14 changes: 0 additions & 14 deletions pkg/statistics/handle/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ import (

"github.com/ngaut/pools"
"github.com/pingcap/errors"
"github.com/pingcap/tidb/pkg/infoschema"
"github.com/pingcap/tidb/pkg/kv"
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/model"
"github.com/pingcap/tidb/pkg/parser/terror"
"github.com/pingcap/tidb/pkg/sessionctx"
"github.com/pingcap/tidb/pkg/sessionctx/variable"
Expand Down Expand Up @@ -233,18 +231,6 @@ func DurationToTS(d time.Duration) uint64 {
return oracle.ComposeTS(d.Nanoseconds()/int64(time.Millisecond), 0)
}

// GetFullTableName returns the full table name.
func GetFullTableName(is infoschema.InfoSchema, tblInfo *model.TableInfo) string {
for _, schema := range is.AllSchemas() {
if t, err := is.TableByName(schema.Name, tblInfo.Name); err == nil {
if t.Meta().ID == tblInfo.ID {
return schema.Name.O + "." + tblInfo.Name.O
}
}
}
return strconv.FormatInt(tblInfo.ID, 10)
}

// JSONTable is used for dumping statistics.
type JSONTable struct {
Columns map[string]*JSONColumn `json:"columns"`
Expand Down
3 changes: 0 additions & 3 deletions pkg/statistics/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ var (
// Table represents statistics for a table.
type Table struct {
ExtendedStats *ExtendedStatsColl
Name string
HistColl
Version uint64
// TblInfoUpdateTS is the UpdateTS of the TableInfo used when filling this struct.
Expand Down Expand Up @@ -304,7 +303,6 @@ func (t *Table) Copy() *Table {
nt := &Table{
HistColl: newHistColl,
Version: t.Version,
Name: t.Name,
TblInfoUpdateTS: t.TblInfoUpdateTS,
}
if t.ExtendedStats != nil {
Expand Down Expand Up @@ -336,7 +334,6 @@ func (t *Table) ShallowCopy() *Table {
nt := &Table{
HistColl: newHistColl,
Version: t.Version,
Name: t.Name,
TblInfoUpdateTS: t.TblInfoUpdateTS,
ExtendedStats: t.ExtendedStats,
}
Expand Down

0 comments on commit 7efe4ea

Please sign in to comment.