From 33c50c389ac3eb74b23743500e21e303277e1cc1 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Thu, 28 Mar 2024 22:02:18 +0800 Subject: [PATCH] infoschema: don't display tables in MemDB when query `TIDB_HOT_REGIONS` (#52180) (#52204) close pingcap/tidb#50810 --- executor/infoschema_reader.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/executor/infoschema_reader.go b/executor/infoschema_reader.go index 786c3aa41dc4a..ff3ac832f9766 100644 --- a/executor/infoschema_reader.go +++ b/executor/infoschema_reader.go @@ -1851,17 +1851,17 @@ func (e *memtableRetriever) setDataForTiDBHotRegions(ctx sessionctx.Context) err if !ok { return errors.New("Information about hot region can be gotten only when the storage is TiKV") } - allSchemas := ctx.GetInfoSchema().(infoschema.InfoSchema).AllSchemas() tikvHelper := &helper.Helper{ Store: tikvStore, RegionCache: tikvStore.GetRegionCache(), } - metrics, err := tikvHelper.ScrapeHotInfo(pdapi.HotRead, allSchemas) + schemas := tikvHelper.FilterMemDBs(sessiontxn.GetTxnManager(ctx).GetTxnInfoSchema().AllSchemas()) + metrics, err := tikvHelper.ScrapeHotInfo(pdapi.HotRead, schemas) if err != nil { return err } e.setDataForHotRegionByMetrics(metrics, "read") - metrics, err = tikvHelper.ScrapeHotInfo(pdapi.HotWrite, allSchemas) + metrics, err = tikvHelper.ScrapeHotInfo(pdapi.HotWrite, schemas) if err != nil { return err }