| -- ---------------------------------------------------------------------- |
| -- Test: assign/alter a role to a resource group |
| -- ---------------------------------------------------------------------- |
| |
| DROP ROLE IF EXISTS rg_test_role; |
| DROP |
| |
| -- positive |
| CREATE ROLE rg_test_role; |
| CREATE |
| SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; |
| rolresgroup |
| ------------- |
| 6437 |
| (1 row) |
| CREATE ROLE rg_test_role_super SUPERUSER; |
| CREATE |
| SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; |
| rolresgroup |
| ------------- |
| 6438 |
| (1 row) |
| ALTER ROLE rg_test_role_super NOSUPERUSER; |
| ALTER |
| SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; |
| rolresgroup |
| ------------- |
| 6437 |
| (1 row) |
| ALTER ROLE rg_test_role_super SUPERUSER; |
| ALTER |
| SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; |
| rolresgroup |
| ------------- |
| 6438 |
| (1 row) |
| |
| ALTER ROLE rg_test_role RESOURCE GROUP none; |
| ALTER |
| SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; |
| rolresgroup |
| ------------- |
| 6437 |
| (1 row) |
| ALTER ROLE rg_test_role_super RESOURCE GROUP none; |
| ALTER |
| SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; |
| rolresgroup |
| ------------- |
| 6438 |
| (1 row) |
| |
| ALTER ROLE rg_test_role RESOURCE GROUP default_group; |
| ALTER |
| SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; |
| rolresgroup |
| ------------- |
| 6437 |
| (1 row) |
| ALTER ROLE rg_test_role_super RESOURCE GROUP admin_group; |
| ALTER |
| SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; |
| rolresgroup |
| ------------- |
| 6438 |
| (1 row) |
| |
| |
| -- negative |
| ALTER ROLE rg_test_role RESOURCE GROUP non_exist_group; |
| ERROR: resource group "non_exist_group" does not exist |
| ALTER ROLE rg_test_role RESOURCE GROUP admin_group; |
| ERROR: only superuser can be assigned to admin resgroup |
| |
| CREATE ROLE rg_test_role1 RESOURCE GROUP non_exist_group; |
| ERROR: resource group "non_exist_group" does not exist |
| -- nonsuper user should not be assigned to admin group |
| CREATE ROLE rg_test_role1 RESOURCE GROUP admin_group; |
| ERROR: only superuser can be assigned to admin resgroup |
| |
| -- cleanup |
| DROP ROLE rg_test_role; |
| DROP |
| DROP ROLE rg_test_role_super; |
| DROP |
| |
| -- ---------------------------------------------------------------------- |
| -- Test: create/drop a resource group |
| -- ---------------------------------------------------------------------- |
| |
| --start_ignore |
| DROP RESOURCE GROUP rg_test_group; |
| ERROR: resource group "rg_test_group" does not exist |
| --end_ignore |
| |
| SELECT * FROM gp_toolkit.gp_resgroup_config; |
| groupid | groupname | concurrency | cpu_rate_limit | memory_limit | memory_shared_quota | memory_spill_ratio | memory_auditor | cpuset |
| ---------+---------------+-------------+----------------+--------------+---------------------+--------------------+----------------+-------- |
| 6437 | default_group | 20 | 30 | 30 | 80 | 10 | vmtracker | -1 |
| 6438 | admin_group | 2 | 10 | 10 | 80 | 10 | vmtracker | -1 |
| (2 rows) |
| |
| -- negative |
| |
| -- can't create the reserved resource groups |
| CREATE RESOURCE GROUP default_group WITH (cpu_rate_limit=10, memory_limit=10); |
| ERROR: resource group "default_group" already exists |
| CREATE RESOURCE GROUP admin_group WITH (cpu_rate_limit=10, memory_limit=10); |
| ERROR: resource group "admin_group" already exists |
| CREATE RESOURCE GROUP none WITH (cpu_rate_limit=10, memory_limit=10); |
| ERROR: resource group name "none" is reserved |
| -- multiple resource groups can't share the same name |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10); |
| ERROR: resource group "rg_test_group" already exists |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| -- must specify cpu_rate_limit or cpuset |
| CREATE RESOURCE GROUP rg_test_group WITH (memory_limit=10); |
| ERROR: must specify cpu_rate_limit or cpuset |
| -- can't specify the resource limit type multiple times |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=5, memory_limit=5, concurrency=1); |
| ERROR: found duplicate resource group resource type: concurrency |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5, cpu_rate_limit=5); |
| ERROR: found duplicate resource group resource type: cpu_rate_limit |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5, memory_limit=5); |
| ERROR: found duplicate resource group resource type: memory_limit |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5, memory_shared_quota=70, memory_shared_quota=80); |
| ERROR: found duplicate resource group resource type: memory_shared_quota |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0', cpuset='0', memory_limit=5); |
| ERROR: found duplicate resource group resource type: cpuset |
| -- can't specify both cpu_rate_limit and cpuset |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, cpuset='0', memory_limit=5); |
| ERROR: can't specify both cpu_rate_limit and cpuset |
| -- can't specify invalid cpuset |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='', memory_limit=5); |
| ERROR: cpuset invalid |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset=',', memory_limit=5); |
| ERROR: cpuset invalid |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='-', memory_limit=5); |
| ERROR: cpuset invalid |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='a', memory_limit=5); |
| ERROR: cpuset invalid |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='12a', memory_limit=5); |
| ERROR: cpuset invalid |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0-,', memory_limit=5); |
| ERROR: cpuset invalid |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='-1', memory_limit=5); |
| ERROR: cpuset invalid |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='3-1', memory_limit=5); |
| ERROR: cpuset invalid |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset=' 0 ', memory_limit=5); |
| ERROR: cpuset invalid |
| ---- suppose the core numbered 1024 is not exist |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='1024', memory_limit=5); |
| ERROR: cpu cores 1024 are unavailable on the system |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', memory_limit=5); |
| ERROR: the length of cpuset reached the upper limit 1024 |
| -- can't alter to invalid cpuset |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0', memory_limit=5); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group set CPUSET ''; |
| ERROR: cpuset invalid |
| ALTER RESOURCE GROUP rg_test_group set CPUSET ','; |
| ERROR: cpuset invalid |
| ALTER RESOURCE GROUP rg_test_group set CPUSET '-'; |
| ERROR: cpuset invalid |
| ALTER RESOURCE GROUP rg_test_group set CPUSET 'a'; |
| ERROR: cpuset invalid |
| ALTER RESOURCE GROUP rg_test_group set CPUSET '12a'; |
| ERROR: cpuset invalid |
| ALTER RESOURCE GROUP rg_test_group set CPUSET '0-'; |
| ERROR: cpuset invalid |
| ALTER RESOURCE GROUP rg_test_group set CPUSET '-1'; |
| ERROR: cpuset invalid |
| ALTER RESOURCE GROUP rg_test_group set CPUSET '3-1'; |
| ERROR: cpuset invalid |
| ALTER RESOURCE GROUP rg_test_group set CPUSET ' 0 '; |
| ERROR: cpuset invalid |
| ---- suppose the core numbered 1024 is not exist |
| ALTER RESOURCE GROUP rg_test_group set CPUSET '1024'; |
| ERROR: cpu cores 1024 are unavailable on the system |
| ALTER RESOURCE GROUP rg_test_group set CPUSET '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'; |
| ERROR: the length of cpuset reached the upper limit 1024 |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| -- can't drop non-exist resource group |
| DROP RESOURCE GROUP non_exist_group; |
| ERROR: resource group "non_exist_group" does not exist |
| -- can't drop reserved resource groups |
| DROP RESOURCE GROUP default_group; |
| ERROR: cannot drop default resource group "default_group" |
| DROP RESOURCE GROUP admin_group; |
| ERROR: cannot drop default resource group "admin_group" |
| DROP RESOURCE GROUP none; |
| ERROR: resource group "none" does not exist |
| |
| -- positive |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| SELECT groupname,concurrency,cpu_rate_limit,memory_limit,memory_shared_quota,memory_spill_ratio FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; |
| groupname | concurrency | cpu_rate_limit | memory_limit | memory_shared_quota | memory_spill_ratio |
| ---------------+-------------+----------------+--------------+---------------------+-------------------- |
| rg_test_group | 20 | 10 | 10 | 80 | 0 |
| (1 row) |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpuset='0', memory_limit=10, memory_shared_quota=70, memory_spill_ratio=30); |
| CREATE |
| SELECT groupname,concurrency,cpu_rate_limit,memory_limit,memory_shared_quota,memory_spill_ratio FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; |
| groupname | concurrency | cpu_rate_limit | memory_limit | memory_shared_quota | memory_spill_ratio |
| ---------------+-------------+----------------+--------------+---------------------+-------------------- |
| rg_test_group | 1 | -1 | 10 | 70 | 30 |
| (1 row) |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10); |
| CREATE |
| SELECT groupname,concurrency,cpu_rate_limit,memory_limit,memory_shared_quota,memory_spill_ratio FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; |
| groupname | concurrency | cpu_rate_limit | memory_limit | memory_shared_quota | memory_spill_ratio |
| ---------------+-------------+----------------+--------------+---------------------+-------------------- |
| rg_test_group | 20 | 10 | 0 | 80 | 0 |
| (1 row) |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0'); |
| CREATE |
| SELECT groupname,concurrency,cpu_rate_limit,memory_limit,memory_shared_quota,memory_spill_ratio FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; |
| groupname | concurrency | cpu_rate_limit | memory_limit | memory_shared_quota | memory_spill_ratio |
| ---------------+-------------+----------------+--------------+---------------------+-------------------- |
| rg_test_group | 20 | -1 | 0 | 80 | 0 |
| (1 row) |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- ---------------------------------------------------------------------- |
| -- Test: boundary check in create resource group syntax |
| -- ---------------------------------------------------------------------- |
| |
| -- negative: cpu_rate_limit & memory_limit should be in [1, 100] |
| -- if cpu_rate_limit equals -1, it will not be involved in sum |
| CREATE RESOURCE GROUP rg_test_group1 WITH (memory_limit=10, cpuset='0'); |
| CREATE |
| CREATE RESOURCE GROUP rg_test_group2 WITH (cpu_rate_limit=60, memory_limit=10); |
| CREATE |
| CREATE RESOURCE GROUP rg_test_group3 WITH (cpu_rate_limit=1, memory_limit=10); |
| ERROR: total cpu_rate_limit exceeded the limit of 100 |
| DROP RESOURCE GROUP rg_test_group1; |
| DROP |
| DROP RESOURCE GROUP rg_test_group2; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=61, memory_limit=10); |
| ERROR: total cpu_rate_limit exceeded the limit of 100 |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=91); |
| ERROR: total memory_limit exceeded the limit of 100 |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=0, memory_limit=10); |
| ERROR: cpu_rate_limit range is [1, 100] |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=-1); |
| ERROR: memory_limit range is [0, 100] |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=0.9); |
| ERROR: invalid input syntax for type bigint: "0.9" |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=1.9); |
| ERROR: invalid input syntax for type bigint: "1.9" |
| -- negative: concurrency should be in [1, max_connections] |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=-1, cpu_rate_limit=10, memory_limit=10); |
| ERROR: concurrency range is [0, 'max_connections'] |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=26, cpu_rate_limit=10, memory_limit=10); |
| ERROR: concurrency range is [0, 'max_connections'] |
| -- negative: memory_auditor should be 'vmtracker' or 'cgroup' |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=0, cpu_rate_limit=10, memory_limit=10, memory_auditor="randomtext"); |
| ERROR: memory_auditor should be "vmtracker" or "cgroup" |
| -- negative: concurrency should be zero for cgroup audited resource group |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=10, memory_limit=10, memory_auditor="cgroup"); |
| ERROR: resource group concurrency must be 0 when group memory_auditor is cgroup |
| -- negative: the cores of cpuset in different groups mustn't overlap |
| CREATE RESOURCE GROUP rg_test_group1 WITH (cpuset='0', memory_limit=10); |
| CREATE |
| CREATE RESOURCE GROUP rg_test_group2 WITH (cpuset='0', memory_limit=10); |
| ERROR: cpu cores 0 are used by resource group rg_test_group1 |
| DROP RESOURCE GROUP rg_test_group1; |
| DROP |
| |
| -- memory_spill_ratio range is [0, 100] |
| -- no limit on the sum of memory_shared_quota and memory_spill_ratio |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=10, memory_spill_ratio=0); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=50, memory_spill_ratio=51); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=10, memory_spill_ratio=-1); |
| ERROR: memory_spill_ratio range is [0, 100] |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=-1, memory_spill_ratio=10); |
| ERROR: memory_shared_quota range is [0, 100] |
| |
| -- positive: cpu_rate_limit & memory_limit should be in [1, 100] |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=60, memory_limit=10); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=60); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=1, memory_limit=10); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=1); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| -- positive: concurrency should be in [0, max_connections] |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=0, cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=25, cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg1_test_group WITH (concurrency=1, cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=50, memory_limit=50); |
| CREATE |
| DROP RESOURCE GROUP rg1_test_group; |
| DROP |
| DROP RESOURCE GROUP rg2_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg1_test_group WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); |
| CREATE |
| CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=40, memory_limit=40); |
| CREATE |
| DROP RESOURCE GROUP rg1_test_group; |
| DROP |
| DROP RESOURCE GROUP rg2_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg1_test_group WITH (concurrency=1, cpu_rate_limit=30, memory_limit=30); |
| CREATE |
| CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=30, memory_limit=30); |
| CREATE |
| DROP RESOURCE GROUP rg1_test_group; |
| DROP |
| DROP RESOURCE GROUP rg2_test_group; |
| DROP |
| -- positive: concurrency should be zero for cgroup audited resource group |
| CREATE RESOURCE GROUP rg_test_group WITH (concurrency=0, cpu_rate_limit=10, memory_limit=10, memory_auditor="cgroup"); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- memory_spill_ratio range is [0, 100] |
| -- no limit on the sum of memory_shared_quota and memory_spill_ratio |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=0, memory_spill_ratio=1); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=50, memory_spill_ratio=50); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=0, memory_spill_ratio=100); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=99, memory_spill_ratio=1); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- negative: memory_spill_ratio does not accept out of range percentage values |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=-1); |
| ERROR: memory_spill_ratio range is [0, 100] |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=101); |
| ERROR: memory_spill_ratio range is [0, 100] |
| |
| -- negative: memory_spill_ratio does not accept string values |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio='0'); |
| ERROR: memory_spill_ratio requires a numeric value |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio='10'); |
| ERROR: memory_spill_ratio requires a numeric value |
| |
| -- negative: memory_spill_ratio does not accept float values |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=10.5); |
| ERROR: invalid input syntax for type bigint: "10.5" |
| |
| -- negative: when memory_limit is unlimited memory_spill_ratio must be set to 0 |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=0, memory_spill_ratio=10); |
| ERROR: when memory_limit is unlimited memory_spill_ratio must be set to 0 |
| |
| -- positive |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=0, memory_spill_ratio=0); |
| CREATE |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- ---------------------------------------------------------------------- |
| -- Test: alter a resource group |
| -- ---------------------------------------------------------------------- |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); |
| CREATE |
| |
| -- ALTER RESOURCE GROUP SET CONCURRENCY N |
| -- negative: concurrency should be in [1, max_connections] |
| ALTER RESOURCE GROUP admin_group SET CONCURRENCY 0; |
| ERROR: admin_group must have at least one concurrency |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -1; |
| ERROR: concurrency range is [0, 'max_connections'] |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 26; |
| ERROR: concurrency range is [0, 'max_connections'] |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -0.5; |
| ERROR: syntax error at or near "0.5" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -0.5; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 0.5; |
| ERROR: syntax error at or near "0.5" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 0.5; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY a; |
| ERROR: syntax error at or near "a" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY a; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 'abc'; |
| ERROR: syntax error at or near "'abc'" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 'abc'; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY '1'; |
| ERROR: syntax error at or near "'1'" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY '1'; |
| ^ |
| -- positive: concurrency should be in [1, max_connections] |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 0; |
| ALTER |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 1; |
| ALTER |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 2; |
| ALTER |
| ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 25; |
| ALTER |
| |
| -- ALTER RESOURCE GROUP SET CPU_RATE_LIMIT VALUE |
| -- negative: cpu_rate_limit & memory_limit should be in [1, 100] |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT -0.1; |
| ERROR: syntax error at or near "0.1" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT -0.1; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT -1; |
| ERROR: cpu_rate_limit range is [1, 100] |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 0; |
| ERROR: cpu_rate_limit range is [1, 100] |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 0.7; |
| ERROR: syntax error at or near "0.7" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 0.7; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 1.7; |
| ERROR: syntax error at or near "1.7" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 1.7; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 61; |
| ERROR: total cpu_rate_limit exceeded the limit of 100 |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT a; |
| ERROR: syntax error at or near "a" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT a; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 'abc'; |
| ERROR: syntax error at or near "'abc'" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 'abc'; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 20%; |
| ERROR: syntax error at or near "%" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 20%; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 0.2%; |
| ERROR: syntax error at or near "0.2" |
| LINE 1: ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 0.2%; |
| ^ |
| -- positive: cpu_rate_limit & memory_limit should be in [1, 100] |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 1; |
| ALTER |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 2; |
| ALTER |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 60; |
| ALTER |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| -- positive: total cpu_rate_limit & memory_limit should be in [1, 100] |
| CREATE RESOURCE GROUP rg1_test_group WITH (cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| CREATE RESOURCE GROUP rg2_test_group WITH (cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| ALTER RESOURCE GROUP rg1_test_group SET CPU_RATE_LIMIT 50; |
| ALTER |
| ALTER RESOURCE GROUP rg1_test_group SET CPU_RATE_LIMIT 40; |
| ALTER |
| ALTER RESOURCE GROUP rg2_test_group SET CPU_RATE_LIMIT 20; |
| ALTER |
| ALTER RESOURCE GROUP rg1_test_group SET CPU_RATE_LIMIT 30; |
| ALTER |
| ALTER RESOURCE GROUP rg2_test_group SET CPU_RATE_LIMIT 30; |
| ALTER |
| DROP RESOURCE GROUP rg1_test_group; |
| DROP |
| DROP RESOURCE GROUP rg2_test_group; |
| DROP |
| -- positive: cpuset and cpu_rate_limit are exclusive, |
| -- if cpu_rate_limit is set, cpuset is empty |
| -- if cpuset is set, cpuset is -1 |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group SET CPUSET '0'; |
| ALTER |
| SELECT groupname,cpu_rate_limit,memory_limit,cpuset FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; |
| groupname | cpu_rate_limit | memory_limit | cpuset |
| ---------------+----------------+--------------+-------- |
| rg_test_group | -1 | 10 | 0 |
| (1 row) |
| ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 10; |
| ALTER |
| SELECT groupname,cpu_rate_limit,memory_limit,cpuset FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; |
| groupname | cpu_rate_limit | memory_limit | cpuset |
| ---------------+----------------+--------------+-------- |
| rg_test_group | 10 | 10 | -1 |
| (1 row) |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| CREATE RESOURCE GROUP cgroup_audited_group WITH (concurrency=0, cpu_rate_limit=10, memory_limit=10, memory_auditor="cgroup"); |
| CREATE |
| -- negative: memory_auditor cannot be altered |
| ALTER RESOURCE GROUP cgroup_audited_group SET MEMORY_AUDITOR "default"; |
| ERROR: syntax error at or near "MEMORY_AUDITOR" |
| LINE 1: ALTER RESOURCE GROUP cgroup_audited_group SET MEMORY_AUDITOR... |
| ^ |
| -- negative: concurrency should be zero for cgroup audited resource group |
| ALTER RESOURCE GROUP cgroup_audited_group SET CONCURRENCY 10; |
| ERROR: resource group concurrency must be 0 when group memory_auditor is cgroup |
| -- negative: role should not be assigned to a cgroup audited resource group |
| CREATE ROLE cgroup_audited_role RESOURCE GROUP cgroup_audited_group; |
| ERROR: you cannot assign a role to this resource group |
| DETAIL: The memory_auditor property for this group is not the default. |
| DROP RESOURCE GROUP cgroup_audited_group; |
| DROP |
| |
| -- positive: memory_spill_ratio accepts integer values |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=20); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10; |
| ALTER |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- negative: memory_spill_ratio only accepts integer values |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=20); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio '10'; |
| ERROR: syntax error at or near "'10'" |
| LINE 1: ...ER RESOURCE GROUP rg_test_group SET memory_spill_ratio '10'; |
| ^ |
| ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10.5; |
| ERROR: syntax error at or near "10.5" |
| LINE 1: ...ER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10.5; |
| ^ |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- negative: memory_spill_ratio does not accept out of range values |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=20); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio -1; |
| ERROR: memory_spill_ratio range is [0, 100] |
| ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 101; |
| ERROR: memory_spill_ratio range is [0, 100] |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- positive: memory_limit can be altered to unlimited if memory_spill_ratio is 0 |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=0); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group SET memory_limit 0; |
| ALTER |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- negative: memory_spill_ratio can only be set to 0 if memory_limit is unlimited |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=0, memory_spill_ratio=0); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10; |
| ERROR: when memory_limit is unlimited memory_spill_ratio must be set to 0 |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- positive: memory_spill_ratio accepts a percentage value only if |
| -- memory_limit is limited |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=0); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10; |
| ALTER |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |
| |
| -- negative: memory_limit must be limited if memory_spill_ratio > 0 |
| CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=10); |
| CREATE |
| ALTER RESOURCE GROUP rg_test_group SET memory_limit 0; |
| ERROR: when memory_limit is unlimited memory_spill_ratio must be set to 0 |
| DROP RESOURCE GROUP rg_test_group; |
| DROP |