Skip to content

Commit

Permalink
*: rebase
Browse files Browse the repository at this point in the history
Signed-off-by: BornChanger <dawn_catcher@126.com>
  • Loading branch information
BornChanger committed Feb 2, 2023
1 parent 62d39c4 commit 04c03e7
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 56 deletions.
98 changes: 51 additions & 47 deletions executor/infoschema_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 7 additions & 9 deletions infoschema/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 04c03e7

Please sign in to comment.