diff --git a/ddl/resource_group_test.go b/ddl/resource_group_test.go index a0921037c475d..2627e93415d5e 100644 --- a/ddl/resource_group_test.go +++ b/ddl/resource_group_test.go @@ -88,7 +88,7 @@ func TestResourceGroupBasic(t *testing.T) { re.Equal(uint64(2000), g.RURate) re.Equal(int64(-1), g.BurstLimit) - tk.MustQuery("select * from information_schema.resource_groups where name = 'x'").Check(testkit.Rows("x 2000 0 YES")) + tk.MustQuery("select * from information_schema.resource_groups where name = 'x'").Check(testkit.Rows("x 2000 YES")) tk.MustExec("drop resource group x") g = testResourceGroupNameFromIS(t, tk.Session(), "x") @@ -137,15 +137,15 @@ func TestResourceGroupBasic(t *testing.T) { // Check information schema table information_schema.resource_groups tk.MustExec("create resource group x RU_PER_SEC=1000") - tk.MustQuery("select * from information_schema.resource_groups where name = 'x'").Check(testkit.Rows("x 1000 0 NO")) + tk.MustQuery("select * from information_schema.resource_groups where name = 'x'").Check(testkit.Rows("x 1000 NO")) tk.MustQuery("show create resource group x").Check(testkit.Rows("x CREATE RESOURCE GROUP `x` RU_PER_SEC=1000")) tk.MustExec("create resource group y RU_PER_SEC=2000") - tk.MustQuery("select * from information_schema.resource_groups where name = 'y'").Check(testkit.Rows("y 2000 0 NO")) + tk.MustQuery("select * from information_schema.resource_groups where name = 'y'").Check(testkit.Rows("y 2000 NO")) tk.MustQuery("show create resource group y").Check(testkit.Rows("y CREATE RESOURCE GROUP `y` RU_PER_SEC=2000")) tk.MustExec("alter resource group y RU_PER_SEC=4000 BURSTABLE") - tk.MustQuery("select * from information_schema.resource_groups where name = 'y'").Check(testkit.Rows("y 4000 0 YES")) + tk.MustQuery("select * from information_schema.resource_groups where name = 'y'").Check(testkit.Rows("y 4000 YES")) tk.MustQuery("show create resource group y").Check(testkit.Rows("y CREATE RESOURCE GROUP `y` RU_PER_SEC=4000 BURSTABLE")) tk.MustQuery("select count(*) from information_schema.resource_groups").Check(testkit.Rows("2")) diff --git a/ddl/resourcegroup/group.go b/ddl/resourcegroup/group.go index 17c4a0afd407a..640986c1ba88b 100644 --- a/ddl/resourcegroup/group.go +++ b/ddl/resourcegroup/group.go @@ -39,11 +39,15 @@ func NewGroupFromOptions(groupName string, options *model.ResourceGroupSettings) if options.RURate > 0 { isRUMode = true group.Mode = rmpb.GroupMode_RUMode + burstLimit := options.BurstLimit + if burstLimit >= 0 { + burstLimit = int64(options.RURate) + } group.RUSettings = &rmpb.GroupRequestUnitSettings{ RU: &rmpb.TokenBucket{ Settings: &rmpb.TokenLimitSettings{ FillRate: options.RURate, - BurstLimit: options.BurstLimit, + BurstLimit: burstLimit, }, }, } @@ -76,23 +80,31 @@ func NewGroupFromOptions(groupName string, options *model.ResourceGroupSettings) } group.Mode = rmpb.GroupMode_RawMode + cpuBurst := options.BurstLimit + ioReadBurst := options.BurstLimit + ioWriteBurst := options.BurstLimit + if options.BurstLimit >= 0 { + cpuBurst = int64(cpuRate) + ioReadBurst = int64(ioReadRate) + ioWriteBurst = int64(ioWriteRate) + } group.RawResourceSettings = &rmpb.GroupRawResourceSettings{ Cpu: &rmpb.TokenBucket{ Settings: &rmpb.TokenLimitSettings{ FillRate: cpuRate, - BurstLimit: options.BurstLimit, + BurstLimit: cpuBurst, }, }, IoRead: &rmpb.TokenBucket{ Settings: &rmpb.TokenLimitSettings{ FillRate: ioReadRate, - BurstLimit: options.BurstLimit, + BurstLimit: ioReadBurst, }, }, IoWrite: &rmpb.TokenBucket{ Settings: &rmpb.TokenLimitSettings{ FillRate: ioWriteRate, - BurstLimit: options.BurstLimit, + BurstLimit: ioWriteBurst, }, }, } diff --git a/executor/infoschema_reader.go b/executor/infoschema_reader.go index 39666333762ab..00efce5ae36e7 100644 --- a/executor/infoschema_reader.go +++ b/executor/infoschema_reader.go @@ -3406,7 +3406,6 @@ func (e *memtableRetriever) setDataFromResourceGroups() error { row := types.MakeDatums( group.Name, group.RUSettings.RU.Settings.FillRate, - uint64(group.RUSettings.RU.Tokens), burstable, ) rows = append(rows, row) @@ -3416,7 +3415,6 @@ func (e *memtableRetriever) setDataFromResourceGroups() error { group.Name, nil, nil, - nil, ) rows = append(rows, row) } diff --git a/infoschema/tables.go b/infoschema/tables.go index 3cbf9ee1b464f..7a2631b4abe13 100644 --- a/infoschema/tables.go +++ b/infoschema/tables.go @@ -1595,7 +1595,6 @@ var tableMemoryUsageOpsHistoryCols = []columnInfo{ var tableResourceGroupsCols = []columnInfo{ {name: "NAME", tp: mysql.TypeVarchar, size: resourcegroup.MaxGroupNameLength, flag: mysql.NotNullFlag}, {name: "RU_PER_SEC", tp: mysql.TypeLonglong, size: 21}, - {name: "RU_TOKENS", tp: mysql.TypeLonglong, size: 21}, {name: "BURSTABLE", tp: mysql.TypeVarchar, size: 3}, }