From 04c03e7c469f753fdc64b419bd98e470b0368991 Mon Sep 17 00:00:00 2001 From: BornChanger Date: Thu, 2 Feb 2023 18:53:15 +0800 Subject: [PATCH] *: rebase Signed-off-by: BornChanger --- executor/infoschema_reader.go | 98 ++++++++++++++++++----------------- infoschema/tables.go | 16 +++--- 2 files changed, 58 insertions(+), 56 deletions(-) diff --git a/executor/infoschema_reader.go b/executor/infoschema_reader.go index 0080741e440f6..d7cc521271275 100644 --- a/executor/infoschema_reader.go +++ b/executor/infoschema_reader.go @@ -3396,65 +3396,69 @@ func (e *memtableRetriever) setDataFromResourceGroups() error { } rows := make([][]types.Datum, 0, len(resourceGroups)) for _, group := range resourceGroups { - mode := "" + //mode := "" switch group.Mode { case rmpb.GroupMode_RUMode: - mode = "RU_MODE" - rruSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RUSettings.RRU.Settings.String(), ":")[1], " ")) + //mode = "RU_MODE" + ruSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RUSettings.RU.Settings.String(), ":")[1], " ")) if err != nil { - return errors.Errorf("invalid fill rate of RRU for resource group %s", group.Name) + return errors.Errorf("invalid fill rate of RU for resource group %s", group.Name) } - wruSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RUSettings.WRU.Settings.String(), ":")[1], " ")) - if err != nil { - return errors.Errorf("invalid fill rate of WRU for resource group %s", group.Name) + burstable := false + if group.RUSettings.RU.GetSettings().BurstLimit < 0 { + burstable = true } row := types.MakeDatums( group.Name, - mode, - rruSetting, - int(group.RUSettings.RRU.Tokens), - wruSetting, - int(group.RUSettings.WRU.Tokens), - nil, - nil, - nil, - ) - rows = append(rows, row) - case rmpb.GroupMode_RawMode: - mode = "RAW_MODE" - cpuSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RawResourceSettings.Cpu.Settings.String(), ":")[1], " ")) - if err != nil { - return errors.Errorf("invalid fill rate of CPU for resource group %s", group.Name) - } - readIoSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RawResourceSettings.IoRead.Settings.String(), ":")[1], " ")) - if err != nil { - return errors.Errorf("invalid fill rate of READ for resource group %s", group.Name) - } - writeIoSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RawResourceSettings.IoWrite.Settings.String(), ":")[1], " ")) - if err != nil { - return errors.Errorf("invalid fill rate of WRITE for resource group %s", group.Name) - } - row := types.MakeDatums( - group.Name, - mode, - nil, - nil, - nil, - nil, - cpuSetting, - readIoSetting, - writeIoSetting, + //mode, + ruSetting, + int(group.RUSettings.RU.Tokens), + //nil, + //nil, + //nil, + burstable, ) rows = append(rows, row) + /* + case rmpb.GroupMode_RawMode: + mode = "RAW_MODE" + cpuSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RawResourceSettings.Cpu.Settings.String(), ":")[1], " ")) + if err != nil { + return errors.Errorf("invalid fill rate of CPU for resource group %s", group.Name) + } + readIoSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RawResourceSettings.IoRead.Settings.String(), ":")[1], " ")) + if err != nil { + return errors.Errorf("invalid fill rate of READ for resource group %s", group.Name) + } + writeIoSetting, err := strconv.Atoi(strings.Trim(strings.Split(group.RawResourceSettings.IoWrite.Settings.String(), ":")[1], " ")) + if err != nil { + return errors.Errorf("invalid fill rate of WRITE for resource group %s", group.Name) + } + + burstable := false + if group.RawResourceSettings. < 0 { + burstable = true + } + row := types.MakeDatums( + group.Name, + mode, + nil, + nil, + cpuSetting, + readIoSetting, + writeIoSetting, + burstable, + ) + rows = append(rows, row) + */ default: - mode = "UNKNOWN_MODE" + //mode = "UNKNOWN_MODE" row := types.MakeDatums( group.Name, - mode, - nil, - nil, - nil, - nil, + //mode, + //nil, + //nil, + //nil, nil, nil, nil, diff --git a/infoschema/tables.go b/infoschema/tables.go index 3e0fa888d4cd6..70b35fea92ae0 100644 --- a/infoschema/tables.go +++ b/infoschema/tables.go @@ -1594,15 +1594,13 @@ var tableMemoryUsageOpsHistoryCols = []columnInfo{ var tableResourceGroupsCols = []columnInfo{ {name: "NAME", tp: mysql.TypeVarchar, size: resourcegroup.MaxGroupNameLength, flag: mysql.NotNullFlag}, - {name: "MODE", tp: mysql.TypeVarchar, size: 12, flag: mysql.NotNullFlag}, - {name: "RRU", tp: mysql.TypeLonglong, size: 21}, - {name: "RRU_TOKEN", tp: mysql.TypeLonglong, size: 21}, - {name: "WRU", tp: mysql.TypeLonglong, size: 21}, - {name: "WRU_TOKEN", tp: mysql.TypeLonglong, size: 21}, - {name: "CPU", tp: mysql.TypeLonglong, size: 21}, - {name: "READ_BANDWIDTH", tp: mysql.TypeLonglong, size: 21}, - {name: "WRITE_BANDWIDTH", tp: mysql.TypeLonglong, size: 21}, - {name: "BURSTABLE", tp: mysql.TypeVarchar, size: 5}, + //{name: "MODE", tp: mysql.TypeVarchar, size: 12, flag: mysql.NotNullFlag}, + {name: "RU", tp: mysql.TypeLonglong, size: 21}, + {name: "RU_TOKEN", tp: mysql.TypeLonglong, size: 21}, + //{name: "CPU", tp: mysql.TypeLonglong, size: 21}, + //{name: "READ_BANDWIDTH", tp: mysql.TypeLonglong, size: 21}, + //{name: "WRITE_BANDWIDTH", tp: mysql.TypeLonglong, size: 21}, + {name: "BURSTABLE", tp: mysql.TypeBit}, } // GetShardingInfo returns a nil or description string for the sharding information of given TableInfo.