Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statistics: remove useless GetFullTableName #52552

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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