From dcd3bdb90ea7ed44d4478a1e405ca353fef31d9a Mon Sep 17 00:00:00 2001 From: Daobing Zhu <39407623+IcePigZDB@users.noreply.github.com> Date: Thu, 9 Sep 2021 10:22:38 +0800 Subject: [PATCH] infoschema: add tidb_hot_regions_history virtual table (#27373) --- infoschema/tables.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/infoschema/tables.go b/infoschema/tables.go index 5e92704f6c..20593738e0 100644 --- a/infoschema/tables.go +++ b/infoschema/tables.go @@ -107,6 +107,8 @@ const ( TableTiDBIndexes = "TIDB_INDEXES" // TableTiDBHotRegions is the string constant of infoschema table TableTiDBHotRegions = "TIDB_HOT_REGIONS" + // TableTiDBHotRegionsHistory is the string constant of infoschema table + TableTiDBHotRegionsHistory = "TIDB_HOT_REGIONS_HISTORY" // TableTiKVStoreStatus is the string constant of infoschema table TableTiKVStoreStatus = "TIKV_STORE_STATUS" // TableAnalyzeStatus is the string constant of Analyze Status @@ -272,6 +274,7 @@ var tableIDMap = map[string]int64{ TableStatementsSummaryEvicted: autoid.InformationSchemaDBID + 75, ClusterTableStatementsSummaryEvicted: autoid.InformationSchemaDBID + 76, TableRegionLabel: autoid.InformationSchemaDBID + 77, + TableTiDBHotRegionsHistory: autoid.InformationSchemaDBID + 78, } type columnInfo struct { @@ -879,6 +882,26 @@ var TableTiDBHotRegionsCols = []columnInfo{ {name: "FLOW_BYTES", tp: mysql.TypeLonglong, size: 21}, } +// TableTiDBHotRegionsHistoryCols is TiDB hot region history mem table columns. +var TableTiDBHotRegionsHistoryCols = []columnInfo{ + {name: "UPDATE_TIME", tp: mysql.TypeTimestamp, size: 26, decimal: 6}, + {name: "DB_NAME", tp: mysql.TypeVarchar, size: 64}, + {name: "TABLE_NAME", tp: mysql.TypeVarchar, size: 64}, + {name: "TABLE_ID", tp: mysql.TypeLonglong, size: 21}, + {name: "INDEX_NAME", tp: mysql.TypeVarchar, size: 64}, + {name: "INDEX_ID", tp: mysql.TypeLonglong, size: 21}, + {name: "REGION_ID", tp: mysql.TypeLonglong, size: 21}, + {name: "STORE_ID", tp: mysql.TypeLonglong, size: 21}, + {name: "PEER_ID", tp: mysql.TypeLonglong, size: 21}, + {name: "IS_LEARNER", tp: mysql.TypeTiny, size: 1, flag: mysql.NotNullFlag, deflt: 0}, + {name: "IS_LEADER", tp: mysql.TypeTiny, size: 1, flag: mysql.NotNullFlag, deflt: 0}, + {name: "TYPE", tp: mysql.TypeVarchar, size: 64}, + {name: "HOT_DEGREE", tp: mysql.TypeLonglong, size: 21}, + {name: "FLOW_BYTES", tp: mysql.TypeDouble, size: 22}, + {name: "KEY_RATE", tp: mysql.TypeDouble, size: 22}, + {name: "QUERY_RATE", tp: mysql.TypeDouble, size: 22}, +} + // TableTiKVStoreStatusCols is TiDB kv store status columns. var TableTiKVStoreStatusCols = []columnInfo{ {name: "STORE_ID", tp: mysql.TypeLonglong, size: 21}, @@ -1778,6 +1801,7 @@ var tableNameToColumns = map[string][]columnInfo{ TableTiDBIndexes: tableTiDBIndexesCols, TableSlowQuery: slowQueryCols, TableTiDBHotRegions: TableTiDBHotRegionsCols, + TableTiDBHotRegionsHistory: TableTiDBHotRegionsHistoryCols, TableTiKVStoreStatus: TableTiKVStoreStatusCols, TableAnalyzeStatus: tableAnalyzeStatusCols, TableTiKVRegionStatus: TableTiKVRegionStatusCols,