Skip to content

Commit

Permalink
statistics: remove useless GetFullTableName (#52552) (#52588)
Browse files Browse the repository at this point in the history
close #52553
  • Loading branch information
ti-chi-bot authored Apr 12, 2024
1 parent f471b0b commit 6bf6755
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 @@ -73,7 +73,6 @@ func (h *Handle) initStatsMeta4Chunk(is infoschema.InfoSchema, cache statstypes.
tbl := &statistics.Table{
HistColl: newHistColl,
Version: row.GetUint64(0),
Name: util.GetFullTableName(is, tableInfo),
ColAndIdxExistenceMap: statistics.NewColAndIndexExistenceMap(len(tableInfo.Columns), len(tableInfo.Indices)),
IsPkIsHandle: tableInfo.PKIsHandle,
}
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 @@ -127,7 +127,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 @@ -20,10 +20,8 @@ import (
"time"

"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 @@ -226,18 +224,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 _, schemaName := range is.AllSchemaNames() {
if t, err := is.TableByName(schemaName, tblInfo.Name); err == nil {
if t.Meta().ID == tblInfo.ID {
return schemaName.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 @@ -61,7 +61,6 @@ type Table struct {
ExtendedStats *ExtendedStatsColl

ColAndIdxExistenceMap *ColAndIdxExistenceMap
Name string
HistColl
Version uint64
// It's the timestamp of the last analyze time.
Expand Down Expand Up @@ -427,7 +426,6 @@ func (t *Table) Copy() *Table {
nt := &Table{
HistColl: newHistColl,
Version: t.Version,
Name: t.Name,
TblInfoUpdateTS: t.TblInfoUpdateTS,
IsPkIsHandle: t.IsPkIsHandle,
LastAnalyzeVersion: t.LastAnalyzeVersion,
Expand Down Expand Up @@ -465,7 +463,6 @@ func (t *Table) ShallowCopy() *Table {
nt := &Table{
HistColl: newHistColl,
Version: t.Version,
Name: t.Name,
TblInfoUpdateTS: t.TblInfoUpdateTS,
ExtendedStats: t.ExtendedStats,
ColAndIdxExistenceMap: t.ColAndIdxExistenceMap,
Expand Down

0 comments on commit 6bf6755

Please sign in to comment.