Skip to content

Commit f203272

Browse files
committed
executor: filter virtual schema
Signed-off-by: IcePigZDB <[email protected]>
1 parent f6015c1 commit f203272

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

executor/memtable_reader.go

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -765,19 +765,19 @@ type HistoryHotRegions struct {
765765
// HistoryHotRegion records each hot region's statistics.
766766
// it's the response of PD.
767767
type HistoryHotRegion struct {
768-
UpdateTime int64 `json:"update_time,omitempty"`
769-
RegionID uint64 `json:"region_id,omitempty"`
770-
StoreID uint64 `json:"store_id,omitempty"`
771-
PeerID uint64 `json:"peer_id,omitempty"`
772-
IsLearner bool `json:"is_learner,omitempty"`
773-
IsLeader bool `json:"is_leader,omitempty"`
774-
HotRegionType string `json:"hot_region_type,omitempty"`
775-
HotDegree int64 `json:"hot_degree,omitempty"`
776-
FlowBytes float64 `json:"flow_bytes,omitempty"`
777-
KeyRate float64 `json:"key_rate,omitempty"`
778-
QueryRate float64 `json:"query_rate,omitempty"`
779-
StartKey string `json:"start_key,omitempty"`
780-
EndKey string `json:"end_key,omitempty"`
768+
UpdateTime int64 `json:"update_time"`
769+
RegionID uint64 `json:"region_id"`
770+
StoreID uint64 `json:"store_id"`
771+
PeerID uint64 `json:"peer_id"`
772+
IsLearner bool `json:"is_learner"`
773+
IsLeader bool `json:"is_leader"`
774+
HotRegionType string `json:"hot_region_type"`
775+
HotDegree int64 `json:"hot_degree"`
776+
FlowBytes float64 `json:"flow_bytes"`
777+
KeyRate float64 `json:"key_rate"`
778+
QueryRate float64 `json:"query_rate"`
779+
StartKey string `json:"start_key"`
780+
EndKey string `json:"end_key"`
781781
}
782782

783783
func (e *hotRegionsHistoryRetriver) initialize(ctx context.Context, sctx sessionctx.Context) ([]chan hotRegionsResult, error) {
@@ -901,7 +901,8 @@ func (e *hotRegionsHistoryRetriver) retrieve(ctx context.Context, sctx sessionct
901901
Store: tikvStore,
902902
RegionCache: tikvStore.GetRegionCache(),
903903
}
904-
tables := tikvHelper.GetTablesInfoWithKeyRange(allSchemas)
904+
schemas := tikvHelper.FilterMemDBs(allSchemas)
905+
tables := tikvHelper.GetTablesInfoWithKeyRange(schemas)
905906
for e.heap.Len() > 0 && len(finalRows) < hotRegionsHistoryBatchSize {
906907
minTimeItem := heap.Pop(e.heap).(hotRegionsResult)
907908
rows, err := e.getHotRegionRowWithSchemaInfo(minTimeItem.messages.HistoryHotRegion[0], tikvHelper, tables, tz)

store/helper/helper.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,18 @@ func newPartitionTableWithKeyRange(db *model.DBInfo, table *model.TableInfo, par
669669
}
670670
}
671671

672+
// FilterMemDBs filter memory databases in the input schemas.
673+
func (h *Helper) FilterMemDBs(oldSchemas []*model.DBInfo) (schemas []*model.DBInfo) {
674+
for _, dbInfo := range oldSchemas {
675+
if util.IsMemDB(dbInfo.Name.L) {
676+
continue
677+
} else {
678+
schemas = append(schemas, dbInfo)
679+
}
680+
}
681+
return
682+
}
683+
672684
// GetRegionsTableInfo returns a map maps region id to its tables or indices.
673685
// Assuming tables or indices key ranges never intersect.
674686
// Regions key ranges can intersect.

0 commit comments

Comments
 (0)