infoschema: add tidb_hot_regions_history virtual table (#27373)

This commit is contained in:
Daobing Zhu
2021-09-09 10:22:38 +08:00
committed by GitHub
parent 2c329c20a9
commit dcd3bdb90e

View File

@ -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,