Skip to content

Commit cf1a424

Browse files
executor/infoschema_reader: exclude virtual schema in TIKV_REGION_STATUS (#61068)
close #59698
1 parent 19cc638 commit cf1a424

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/executor/infoschema_cluster_table_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ func TestTikvRegionStatus(t *testing.T) {
365365
"1 test test_t2 1 p_a 1 p1",
366366
"1 test test_t2 1 p_b 0 <nil>",
367367
))
368+
369+
// Run the query to ensure virtual schemas are excluded and expect no rows to be returned
370+
tk.MustQuery(`SELECT DB_NAME FROM information_schema.TIKV_REGION_STATUS WHERE DB_NAME IN ('INFORMATION_SCHEMA', 'METRICS_SCHEMA', 'PERFORMANCE_SCHEMA')`).Check(testkit.Rows())
368371
}
369372

370373
func TestTableStorageStats(t *testing.T) {

pkg/executor/infoschema_reader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,10 @@ func (e *memtableRetriever) setDataForTiKVRegionStatus(ctx context.Context, sctx
21012101
e.setNewTiKVRegionStatusCol(&allRegionsInfo.Regions[i], nil)
21022102
}
21032103
for j, regionTable := range regionTableList {
2104+
// Exclude virtual schemas
2105+
if util.IsMemDB(regionTable.DB.Name.L) {
2106+
continue
2107+
}
21042108
if checker != nil && !checker.RequestVerification(sctx.GetSessionVars().ActiveRoles, regionTable.DB.Name.L, regionTable.Table.Name.L, "", mysql.AllPrivMask) {
21052109
continue
21062110
}

0 commit comments

Comments
 (0)