Skip to content

Commit

Permalink
infoschema_v2: remove schemaTableInfos call of fetchAllTablePlacements (
Browse files Browse the repository at this point in the history
  • Loading branch information
GMHDBJD authored Sep 25, 2024
1 parent bf455f5 commit 165c4a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions pkg/executor/show_placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,16 @@ func (e *ShowExec) fetchAllTablePlacements(ctx context.Context, scheduleState ma
dbs := e.is.AllSchemaNames()
slices.SortFunc(dbs, func(i, j pmodel.CIStr) int { return cmp.Compare(i.O, j.O) })

for _, dbName := range dbs {
tbls := e.is.ListTablesWithSpecialAttribute(infoschema.AllSpecialAttribute)
for _, db := range tbls {
tableRowSets := make([]tableRowSet, 0)
tblInfos, err := e.is.SchemaTableInfos(ctx, dbName)
if err != nil {
return errors.Trace(err)
}
for _, tblInfo := range tblInfos {
if checker != nil && !checker.RequestVerification(activeRoles, dbName.O, tblInfo.Name.O, "", mysql.AllPrivMask) {
for _, tblInfo := range db.TableInfos {
if checker != nil && !checker.RequestVerification(activeRoles, db.DBName.O, tblInfo.Name.O, "", mysql.AllPrivMask) {
continue
}

var rows [][]any
ident := ast.Ident{Schema: dbName, Name: tblInfo.Name}
ident := ast.Ident{Schema: db.DBName, Name: tblInfo.Name}
tblPlacement, err := e.getTablePlacement(tblInfo)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/executor/show_placement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ func TestShowPlacementPrivilege(t *testing.T) {
tk1.MustQuery("show placement").Check(testkit.Rows(
"POLICY p1 PRIMARY_REGION=\"cn-east-1\" REGIONS=\"cn-east-1,cn-east-2\" SCHEDULE=\"EVEN\" NULL",
"DATABASE db2 PRIMARY_REGION=\"cn-east-1\" REGIONS=\"cn-east-1,cn-east-2\" SCHEDULE=\"EVEN\" PENDING",
"TABLE db2.t1 PRIMARY_REGION=\"cn-east-1\" REGIONS=\"cn-east-1,cn-east-2\" SCHEDULE=\"EVEN\" PENDING",
"TABLE test.t1 PRIMARY_REGION=\"cn-east-1\" REGIONS=\"cn-east-1,cn-east-2\" SCHEDULE=\"EVEN\" PENDING",
"TABLE test.t3 PARTITION p1 PRIMARY_REGION=\"cn-east-1\" REGIONS=\"cn-east-1,cn-east-2\" SCHEDULE=\"EVEN\" PENDING",
"TABLE db2.t1 PRIMARY_REGION=\"cn-east-1\" REGIONS=\"cn-east-1,cn-east-2\" SCHEDULE=\"EVEN\" PENDING",
))
}

Expand Down

0 comments on commit 165c4a5

Please sign in to comment.