From 0c42fbbe9f1e5f2d45c507d3090b890fbc6c32a3 Mon Sep 17 00:00:00 2001 From: Victor Kremensky Date: Mon, 4 Aug 2025 08:23:30 +0000 Subject: [PATCH] delete resgroup test --- src/test/isolation2/Makefile | 4 - src/test/isolation2/init_file_resgroup | 21 - .../isolation2/isolation2_resgroup_schedule | 61 --- src/test/isolation2/sql/resgroup/.gitignore | 2 - .../resgroup/resgroup_alter_concurrency.sql | 405 --------------- .../resgroup_alter_memory_spill_ratio.sql | 39 -- .../resgroup/resgroup_assign_slot_fail.sql | 28 - .../sql/resgroup/resgroup_bypass_catalog.sql | 61 --- .../resgroup/resgroup_bypass_memory_limit.sql | 482 ------------------ .../resgroup_cancel_terminate_concurrency.sql | 144 ------ .../sql/resgroup/resgroup_concurrency.sql | 265 ---------- .../resgroup_cpuset_empty_default.sql | 32 -- .../sql/resgroup/resgroup_dumpinfo.sql | 92 ---- .../sql/resgroup/resgroup_functions.sql | 11 - .../sql/resgroup/resgroup_large_group_id.sql | 15 - .../resgroup_memory_hashagg_spill.sql | 127 ----- .../resgroup_memory_hashjoin_spill.sql | 72 --- .../resgroup_memory_materialize_spill.sql | 104 ---- .../resgroup_memory_sisc_mat_sort.sql | 101 ---- .../resgroup_memory_sisc_sort_spill.sql | 105 ---- .../resgroup/resgroup_memory_sort_spill.sql | 68 --- .../resgroup/resgroup_memory_spilltodisk.sql | 70 --- .../sql/resgroup/resgroup_name_convention.sql | 219 -------- .../sql/resgroup/resgroup_operator_memory.sql | 193 ------- .../resgroup/resgroup_parallel_queries.sql | 286 ----------- .../sql/resgroup/resgroup_query_mem.sql | 68 --- .../sql/resgroup/resgroup_recreate.sql | 24 - .../sql/resgroup/resgroup_seg_down_2pc.sql | 58 --- .../resgroup_set_memory_spill_ratio.sql | 83 --- .../sql/resgroup/resgroup_syntax.sql | 336 ------------ .../sql/resgroup/resgroup_transaction.sql | 136 ----- .../resgroup/resgroup_unassign_entrydb.sql | 50 -- .../resgroup_unlimit_memory_spill_ratio.sql | 85 --- .../sql/resgroup/resgroup_views.sql | 45 -- .../sql/resgroup/restore_default_resgroup.sql | 20 - 35 files changed, 3912 deletions(-) delete mode 100644 src/test/isolation2/init_file_resgroup delete mode 100644 src/test/isolation2/isolation2_resgroup_schedule delete mode 100644 src/test/isolation2/sql/resgroup/.gitignore delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_alter_concurrency.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_alter_memory_spill_ratio.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_assign_slot_fail.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_bypass_catalog.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_bypass_memory_limit.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_cancel_terminate_concurrency.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_concurrency.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_cpuset_empty_default.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_dumpinfo.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_functions.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_large_group_id.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_memory_hashagg_spill.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_memory_hashjoin_spill.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_memory_materialize_spill.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_memory_sisc_mat_sort.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_memory_sisc_sort_spill.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_memory_sort_spill.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_memory_spilltodisk.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_name_convention.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_operator_memory.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_parallel_queries.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_query_mem.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_recreate.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_seg_down_2pc.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_set_memory_spill_ratio.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_syntax.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_transaction.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_unassign_entrydb.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_unlimit_memory_spill_ratio.sql delete mode 100644 src/test/isolation2/sql/resgroup/resgroup_views.sql delete mode 100644 src/test/isolation2/sql/resgroup/restore_default_resgroup.sql diff --git a/src/test/isolation2/Makefile b/src/test/isolation2/Makefile index 87c54fd4307..e48b2cbe818 100644 --- a/src/test/isolation2/Makefile +++ b/src/test/isolation2/Makefile @@ -76,10 +76,6 @@ installcheck: install installcheck-parallel-retrieve-cursor installcheck-ic-tcp installcheck-mdb: install ./pg_isolation2_regress $(EXTRA_REGRESS_OPTS) --init-file=$(top_builddir)/src/test/regress/init_file --init-file=./init_file_isolation2 --psqldir='$(PSQLDIR)' --inputdir=$(srcdir) --schedule=$(srcdir)/isolation2_schedule_mdb - -installcheck-resgroup: install - ./pg_isolation2_regress $(EXTRA_REGRESS_OPTS) --init-file=$(top_builddir)/src/test/regress/init_file --init-file=./init_file_resgroup --psqldir='$(PSQLDIR)' --inputdir=$(srcdir) --dbname=isolation2resgrouptest --schedule=$(srcdir)/isolation2_resgroup_schedule - installcheck-expandshrink: install ./pg_isolation2_regress $(EXTRA_REGRESS_OPTS) --init-file=$(top_builddir)/src/test/regress/init_file --init-file=./init_file_isolation2 --dbname=isolation2expandshrinktest --schedule=$(srcdir)/isolation2_expandshrink_schedule diff --git a/src/test/isolation2/init_file_resgroup b/src/test/isolation2/init_file_resgroup deleted file mode 100644 index 747b4c776df..00000000000 --- a/src/test/isolation2/init_file_resgroup +++ /dev/null @@ -1,21 +0,0 @@ --- start_matchignore -m/^CONTEXT: SQL function ".+" statement \d+$/ -m/^ERROR: Canceling query because of high VMEM .+/ --- end_matchignore - --- start_matchsubs -m/^[0-9:]+\sgpconfig:[^:]+:/ -s/^[0-9:]+\sgpconfig:[^:]+:[^-]*-\[/TIMESTAMP gpconfig:SEGMENT:USER-[/ - -m/\[\S+:cgroup is not properly configured:/ -s/\[\S+:cgroup is not properly configured:/\[SEGMENT:cgroup is not properly configured:/ - -m/^ERROR: Resource group [0-9]+ was concurrently dropped$/ -s/group [0-9]+ was/group OID was/ - -m/^ERROR: Out of memory (seg\d slice\d \d+.\d+.\d+.\d+:\d+ pid=\d+)$/ -s/(seg\d+ slice\d+ \d+.\d+.\d+.\d+:\d+ pid=\d+)/(SEG SLICE ADDR:PORT pid=PID)/ - -m/^ERROR: role with Oid \d+ was dropped$/ -s/Oid \d+ was/Oid OID was/ --- end_matchsubs diff --git a/src/test/isolation2/isolation2_resgroup_schedule b/src/test/isolation2/isolation2_resgroup_schedule deleted file mode 100644 index 02d4fd408f1..00000000000 --- a/src/test/isolation2/isolation2_resgroup_schedule +++ /dev/null @@ -1,61 +0,0 @@ -# test: resgroup/enable_resgroup_validate -test: resgroup/enable_resgroup - -# bypass catalog -test: resgroup/resgroup_bypass_catalog - -# basic syntax -test: resgroup/resgroup_views -test: resgroup/resgroup_syntax -test: resgroup/resgroup_transaction -test: resgroup/resgroup_name_convention - -# fault injection tests -test: resgroup/resgroup_assign_slot_fail -test: resgroup/resgroup_unassign_entrydb -test: resgroup/resgroup_seg_down_2pc -test: resgroup/resgroup_query_mem - -# functions -test: resgroup/resgroup_concurrency -test: resgroup/resgroup_bypass -test: resgroup/resgroup_bypass_memory_limit -test: resgroup/resgroup_alter_concurrency -test: resgroup/resgroup_memory_statistic -test: resgroup/resgroup_memory_limit -test: resgroup/resgroup_memory_runaway -test: resgroup/resgroup_alter_memory -test: resgroup/resgroup_cpu_rate_limit -test: resgroup/resgroup_alter_memory_spill_ratio -test: resgroup/resgroup_cpuset -test: resgroup/resgroup_cpuset_empty_default -test: resgroup/resgroup_set_memory_spill_ratio -test: resgroup/resgroup_unlimit_memory_spill_ratio -test: resgroup/resgroup_cancel_terminate_concurrency -test: resgroup/resgroup_move_query - -# memory spill tests -#test: resgroup/resgroup_memory_hashagg_spill -#test: resgroup/resgroup_memory_hashjoin_spill -#test: resgroup/resgroup_memory_materialize_spill -#test: resgroup/resgroup_memory_sisc_mat_sort -#test: resgroup/resgroup_memory_sisc_sort_spill -#test: resgroup/resgroup_memory_sort_spill -#test: resgroup/resgroup_memory_spilltodisk - -# regression tests -test: resgroup/resgroup_recreate -test: resgroup/resgroup_operator_memory -test: resgroup/resgroup_functions - -# parallel tests -#test: resgroup/restore_default_resgroup -#test: resgroup/resgroup_parallel_queries - -# dump info -test: resgroup/resgroup_dumpinfo - -# test larget group id -test: resgroup/resgroup_large_group_id - -test: resgroup/disable_resgroup diff --git a/src/test/isolation2/sql/resgroup/.gitignore b/src/test/isolation2/sql/resgroup/.gitignore deleted file mode 100644 index b9ca196e52b..00000000000 --- a/src/test/isolation2/sql/resgroup/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -resgroup_memory_runaway.sql -resgroup_move_query.sql diff --git a/src/test/isolation2/sql/resgroup/resgroup_alter_concurrency.sql b/src/test/isolation2/sql/resgroup/resgroup_alter_concurrency.sql deleted file mode 100644 index 9aa3df7f91c..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_alter_concurrency.sql +++ /dev/null @@ -1,405 +0,0 @@ --- create a resource group when gp_resource_manager is queue -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore -CREATE RESOURCE GROUP rg_concurrency_test WITH -(concurrency=1, cpu_rate_limit=20, memory_limit=60, memory_shared_quota=0, memory_spill_ratio=10); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; - --- After a 'q' command the client connection is disconnected but the --- QD may still be alive, if we then query pg_stat_activity quick enough --- we might still see this session with query ''. --- A filter is put to filter out this kind of quitted sessions. -CREATE OR REPLACE VIEW rg_activity_status AS - SELECT rsgname, waiting_reason, state, query - FROM pg_stat_activity - WHERE rsgname='rg_concurrency_test' - AND query <> ''; - --- --- 1. increase concurrency after pending queries --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; - -11:SET ROLE role_concurrency_test; -11:BEGIN; - -21:SET ROLE role_concurrency_test; -22:SET ROLE role_concurrency_test; -21&:BEGIN; -22&:BEGIN; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2; - -SELECT * FROM rg_activity_status; - -11:END; -11q: -21<: -22<: - -SELECT * FROM rg_activity_status; - -21:END; -22:END; -21q: -22q: - -SELECT * FROM rg_activity_status; - --- --- 2. increase concurrency before pending queries --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; - -11:SET ROLE role_concurrency_test; -11:BEGIN; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2; - -21:SET ROLE role_concurrency_test; -22:SET ROLE role_concurrency_test; -21&:BEGIN; -22&:BEGIN; - -SELECT * FROM rg_activity_status; - -11:END; -11q: -21<: -22<: - -SELECT * FROM rg_activity_status; - -21:END; -22:END; -21q: -22q: - -SELECT * FROM rg_activity_status; - --- --- 3. increase both concurrency & memory_shared_quota after pending queries --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_SHARED_QUOTA 60; - -11:SET ROLE role_concurrency_test; -11:BEGIN; - -21:SET ROLE role_concurrency_test; -22:SET ROLE role_concurrency_test; -21&:BEGIN; -22&:BEGIN; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2; - -SELECT * FROM rg_activity_status; - -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_SHARED_QUOTA 20; - -21<: - -SELECT * FROM rg_activity_status; - -11:END; -11q: -22<: - -SELECT * FROM rg_activity_status; - -21:END; -22:END; -21q: -22q: - -SELECT * FROM rg_activity_status; - --- --- 4. increase both concurrency & memory_shared_quota before pending queries --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_SHARED_QUOTA 60; - -11:SET ROLE role_concurrency_test; -11:BEGIN; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2; -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_SHARED_QUOTA 20; - -21:SET ROLE role_concurrency_test; -22:SET ROLE role_concurrency_test; -21:BEGIN; -22&:BEGIN; - -SELECT * FROM rg_activity_status; - -11:END; -11q: -22<: - -SELECT * FROM rg_activity_status; - -21:END; -22:END; -21q: -22q: - -SELECT * FROM rg_activity_status; - --- --- 5. increase both concurrency & memory_limit after pending queries --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_SHARED_QUOTA 0; -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_LIMIT 30; - --- proc 11 gets a quota of 30/1=30 -11:SET ROLE role_concurrency_test; -11:BEGIN; - -21:SET ROLE role_concurrency_test; -22:SET ROLE role_concurrency_test; -21&:BEGIN; -22&:BEGIN; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2; --- now a new query needs a quota of 30/2=15 to run, --- there is no free quota at the moment, so 21 & 22 are still pending -SELECT * FROM rg_activity_status; - -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_LIMIT 50; --- now a new query needs a quota of 50/2=25 to run, --- but there is only 50-30=20 free quota, so 21 & 22 are still pending -SELECT * FROM rg_activity_status; - -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_LIMIT 60; --- now a new query needs a quota of 60/2=30 to run, --- and there is 60-30=30 free quota, so 21 gets executed and 22 is still pending - -21<: - -SELECT * FROM rg_activity_status; - -11:END; --- 11 releases its quota, so there is now 30 free quota, --- so 22 gets executed -11q: -22<: - -SELECT * FROM rg_activity_status; - -21:END; -22:END; -21q: -22q: - -SELECT * FROM rg_activity_status; - --- --- 6. increase both concurrency & memory_limit before pending queries --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_SHARED_QUOTA 0; -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_LIMIT 30; - --- proc 11 gets a quota of 30/1=30 -11:SET ROLE role_concurrency_test; -11:BEGIN; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2; --- now a new query needs a quota of 30/2=15 to run, --- there is no free quota at the moment -SELECT * FROM rg_activity_status; - -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_LIMIT 60; --- now a new query needs a quota of 60/2=30 to run, --- and there is 60-30=30 free quota, --- so one new query can get executed immediately - -21:SET ROLE role_concurrency_test; -22:SET ROLE role_concurrency_test; -21:BEGIN; --- proc 21 gets executed, there is no free quota now, --- so proc 22 is pending -22&:BEGIN; - -SELECT * FROM rg_activity_status; - -11:END; --- 11 releases its quota, so there is now 30 free quota, --- so 22 gets executed -11q: -22<: - -SELECT * FROM rg_activity_status; - -21:END; -22:END; -21q: -22q: - -SELECT * FROM rg_activity_status; - --- --- 7. decrease concurrency --- -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_LIMIT 50; -ALTER RESOURCE GROUP rg_concurrency_test SET MEMORY_SHARED_QUOTA 0; -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 10; -11:SET ROLE role_concurrency_test; -11:BEGIN; - -12:SET ROLE role_concurrency_test; -12:BEGIN; - -13:SET ROLE role_concurrency_test; -13:BEGIN; - -14:SET ROLE role_concurrency_test; -14:BEGIN; - -15:SET ROLE role_concurrency_test; -15:BEGIN; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; - -11q: -12q: -13q: -14q: -15q: --- start_ignore --- The 'q' command returns before the underlying segments all actually quit, --- so a following DROP command might fail. Add a delay here as a workaround. -SELECT pg_sleep(1); --- end_ignore - --- --- 8. increase concurrency from 0 --- -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; -CREATE RESOURCE GROUP rg_concurrency_test WITH -(concurrency=0, cpu_rate_limit=20, memory_limit=60, memory_shared_quota=0, memory_spill_ratio=10); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; - -11:SET ROLE role_concurrency_test; -11&:BEGIN; -SELECT * FROM rg_activity_status; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; - -11<: -SELECT * FROM rg_activity_status; - -11:END; -11q: - --- --- 9.1 decrease concurrency to 0, --- without running queries, --- without pending queries. --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; -SELECT * FROM rg_activity_status; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 0; -SELECT * FROM rg_activity_status; - --- --- 9.2 decrease concurrency to 0, --- with running queries, --- without pending queries. --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; -SELECT * FROM rg_activity_status; - -11:SET ROLE role_concurrency_test; -11:BEGIN; -SELECT * FROM rg_activity_status; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 0; -SELECT * FROM rg_activity_status; - -11:END; -11q: - --- --- 9.3 decrease concurrency to 0, --- with running queries, --- with pending queries. --- - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 1; -SELECT * FROM rg_activity_status; - -11:SET ROLE role_concurrency_test; -11:BEGIN; -12:SET ROLE role_concurrency_test; -12&:BEGIN; -SELECT * FROM rg_activity_status; - -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 0; -SELECT * FROM rg_activity_status; - -11:END; -11q: -SELECT * FROM rg_activity_status; - -SELECT pg_cancel_backend(pid) FROM pg_stat_activity -WHERE waiting_reason='resgroup' AND rsgname='rg_concurrency_test'; -12<: -12q: -SELECT * FROM rg_activity_status; - --- 10: drop a resgroup with concurrency=0 and pending queries -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=0, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -61:SET ROLE role_concurrency_test; -61&:BEGIN; - -ALTER ROLE role_concurrency_test RESOURCE GROUP none; -DROP RESOURCE GROUP rg_concurrency_test; - -61<: -61:END; -61q: - --- 11: drop a role with concurrency=0 and pending queries -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=0, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -61:SET ROLE role_concurrency_test; -61&:BEGIN; - -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - -61<: -61q: - --- cleanup --- start_ignore -DROP VIEW rg_activity_status; -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_alter_memory_spill_ratio.sql b/src/test/isolation2/sql/resgroup/resgroup_alter_memory_spill_ratio.sql deleted file mode 100644 index cd86cbccc80..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_alter_memory_spill_ratio.sql +++ /dev/null @@ -1,39 +0,0 @@ --- start_ignore -DROP RESOURCE GROUP rg_spill_test; --- end_ignore -CREATE RESOURCE GROUP rg_spill_test WITH -(concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=20, memory_spill_ratio=10); - -CREATE OR REPLACE VIEW rg_spill_status AS - SELECT groupname, memory_shared_quota, memory_spill_ratio - FROM gp_toolkit.gp_resgroup_config - WHERE groupname='rg_spill_test'; - --- ALTER MEMORY_SPILL_RATIO - -SELECT * FROM rg_spill_status; - --- positive -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 20; -SELECT * FROM rg_spill_status; - --- positive, memory_spill_ratio range is [0, 100] -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 0; -SELECT * FROM rg_spill_status; - --- positive: no limit on the sum of shared and spill -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 81; -SELECT * FROM rg_spill_status; - --- negative: memory_spill_ratio is invalid -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 20.0; -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO a; -SELECT * FROM rg_spill_status; - --- negative: memory_spill_ratio is larger than RESGROUP_MAX_MEMORY_SPILL_RATIO -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 101; -SELECT * FROM rg_spill_status; - --- cleanup -DROP VIEW rg_spill_status; -DROP RESOURCE GROUP rg_spill_test; diff --git a/src/test/isolation2/sql/resgroup/resgroup_assign_slot_fail.sql b/src/test/isolation2/sql/resgroup/resgroup_assign_slot_fail.sql deleted file mode 100644 index b88a26c1e1c..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_assign_slot_fail.sql +++ /dev/null @@ -1,28 +0,0 @@ --- If the function AssignResGroupOnMaster() fails after getting a slot, --- test the slot will be unassigned correctly. -CREATE EXTENSION IF NOT EXISTS gp_inject_fault; - -DROP ROLE IF EXISTS role_test; --- start_ignore -DROP RESOURCE GROUP rg_test; --- end_ignore -CREATE RESOURCE GROUP rg_test WITH (concurrency=2, cpu_rate_limit=10, memory_limit=10); -CREATE ROLE role_test RESOURCE GROUP rg_test; - -1: SET ROLE role_test; -1: BEGIN; -2: SET ROLE role_test; --- start_ignore -SELECT gp_inject_fault('resgroup_assigned_on_master', 'reset', 1); -SELECT gp_inject_fault('resgroup_assigned_on_master', 'error', 1); --- end_ignore -2: BEGIN; -2: BEGIN; -1: END; -2: END; -1q: -2q: - ---clean up -DROP ROLE role_test; -DROP RESOURCE GROUP rg_test; diff --git a/src/test/isolation2/sql/resgroup/resgroup_bypass_catalog.sql b/src/test/isolation2/sql/resgroup/resgroup_bypass_catalog.sql deleted file mode 100644 index fd2e5c553e1..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_bypass_catalog.sql +++ /dev/null @@ -1,61 +0,0 @@ -CREATE RESOURCE GROUP rg_test_catalog WITH (CONCURRENCY=2, cpu_rate_limit=10); -CREATE ROLE role_test_catalog RESOURCE GROUP rg_test_catalog; - -CREATE FUNCTION rg_test_udf() -RETURNS integer AS $$ SELECT 1; $$ LANGUAGE SQL; - --- take 1 slot -1: SET ROLE role_test_catalog; -1: BEGIN; - --- take another slot -2: SET ROLE role_test_catalog; -2: BEGIN; - --- two slot have all been taken, so this query will be hung up. -3: SET ROLE role_test_catalog; -3&: BEGIN; - --- It's a catalog only query, so it will be bypassed. -4: SET ROLE role_test_catalog; -4: SELECT 1 FROM pg_catalog.pg_rules; - --- It's a udf only query, will be hung up. --- Because there is no RangeVar, it doesn't belong to catalog only query. -5: SET ROLE role_test_catalog; -5&: SELECT rg_test_udf(); - --- turn of bypass catalog query -6: SET ROLE role_test_catalog; -6: SET gp_resource_group_bypass_catalog_query = false; -6&: SELECT 1 FROM pg_catalog.pg_rules; - -1: COMMIT; -2: COMMIT; -3<: -3: COMMIT; -5<: -5: COMMIT; -6<: - --- test for Github Issue 15416 --- following SQLs should not throw "unrecognized node type" error. -create table t_15416(s int); --- test for T_GroupingFunc -select count(), grouping(s) from t_15416 group by s; --- test for T_GroupingClause -select 1 from pg_catalog.pg_class group by rollup(1); --- test for T_TableValueExpr --- don't want spend time on create a UDF below, the below SQL --- should not throw "unrecognized node type" error, this is the test point. -select count(1) from anytable_out( table(select * from t_15416 scatter by s) ); --- test for T_GroupId -select group_id() from t_15416; - --- cleanup --- start_ignore -DROP ROLE role_test_catalog; -DROP RESOURCE GROUP rg_test_catalog; -DROP FUNCTION rg_test_udf(); -DROP TABLE t_15416; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_bypass_memory_limit.sql b/src/test/isolation2/sql/resgroup/resgroup_bypass_memory_limit.sql deleted file mode 100644 index 15eac23c04e..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_bypass_memory_limit.sql +++ /dev/null @@ -1,482 +0,0 @@ --- --- set timezone will accumulate the memory usage in session. --- here is used to test bypass memory limit is query level instead of session level. --- -SET TIMEZONE TO 'Japan'; -SET TIMEZONE TO 'Portugal'; -SET TIMEZONE TO 'Canada/Eastern'; -SET TIMEZONE TO 'Canada/Central'; -SET TIMEZONE TO 'Canada/Newfoundland'; -SET TIMEZONE TO 'Canada/Mountain'; -SET TIMEZONE TO 'Canada/Saskatchewan'; -SET TIMEZONE TO 'Canada/Yukon'; -SET TIMEZONE TO 'Canada/Pacific'; -SET TIMEZONE TO 'Canada/Atlantic'; -SET TIMEZONE TO 'CET'; -SET TIMEZONE TO 'ROK'; -SET TIMEZONE TO 'Arctic/Longyearbyen'; -SET TIMEZONE TO 'PRC'; -SET TIMEZONE TO 'GMT-0'; -SET TIMEZONE TO 'Iran'; -SET TIMEZONE TO 'GB-Eire'; -SET TIMEZONE TO 'Jamaica'; -SET TIMEZONE TO 'Europe/Tiraspol'; -SET TIMEZONE TO 'Europe/Vaduz'; -SET TIMEZONE TO 'Europe/Berlin'; -SET TIMEZONE TO 'Europe/San_Marino'; -SET TIMEZONE TO 'Europe/Guernsey'; -SET TIMEZONE TO 'Europe/Ljubljana'; -SET TIMEZONE TO 'Europe/Simferopol'; -SET TIMEZONE TO 'Europe/Belgrade'; -SET TIMEZONE TO 'Europe/Chisinau'; -SET TIMEZONE TO 'Europe/London'; -SET TIMEZONE TO 'Europe/Vatican'; -SET TIMEZONE TO 'Europe/Skopje'; -SET TIMEZONE TO 'Europe/Saratov'; -SET TIMEZONE TO 'Europe/Jersey'; -SET TIMEZONE TO 'Europe/Samara'; -SET TIMEZONE TO 'Europe/Oslo'; -SET TIMEZONE TO 'Europe/Helsinki'; -SET TIMEZONE TO 'Europe/Luxembourg'; -SET TIMEZONE TO 'Europe/Bucharest'; -SET TIMEZONE TO 'Europe/Podgorica'; -SET TIMEZONE TO 'Europe/Madrid'; -SET TIMEZONE TO 'Europe/Sarajevo'; -SET TIMEZONE TO 'Europe/Busingen'; -SET TIMEZONE TO 'Europe/Monaco'; -SET TIMEZONE TO 'Europe/Belfast'; -SET TIMEZONE TO 'Europe/Zagreb'; -SET TIMEZONE TO 'Europe/Warsaw'; -SET TIMEZONE TO 'Europe/Sofia'; -SET TIMEZONE TO 'Europe/Tallinn'; -SET TIMEZONE TO 'Europe/Brussels'; -SET TIMEZONE TO 'Europe/Isle_of_Man'; -SET TIMEZONE TO 'Europe/Stockholm'; -SET TIMEZONE TO 'Europe/Lisbon'; -SET TIMEZONE TO 'Europe/Istanbul'; -SET TIMEZONE TO 'Europe/Copenhagen'; -SET TIMEZONE TO 'Europe/Tirane'; -SET TIMEZONE TO 'Europe/Dublin'; -SET TIMEZONE TO 'Europe/Gibraltar'; -SET TIMEZONE TO 'Europe/Athens'; -SET TIMEZONE TO 'Europe/Zurich'; -SET TIMEZONE TO 'Europe/Vilnius'; -SET TIMEZONE TO 'Europe/Malta'; -SET TIMEZONE TO 'Europe/Riga'; -SET TIMEZONE TO 'Europe/Vienna'; -SET TIMEZONE TO 'Europe/Moscow'; -SET TIMEZONE TO 'Europe/Ulyanovsk'; -SET TIMEZONE TO 'Europe/Rome'; -SET TIMEZONE TO 'Europe/Kirov'; -SET TIMEZONE TO 'Europe/Uzhgorod'; -SET TIMEZONE TO 'Europe/Kaliningrad'; -SET TIMEZONE TO 'Europe/Mariehamn'; -SET TIMEZONE TO 'Europe/Budapest'; -SET TIMEZONE TO 'Europe/Astrakhan'; -SET TIMEZONE TO 'Europe/Volgograd'; -SET TIMEZONE TO 'Europe/Kiev'; -SET TIMEZONE TO 'Europe/Paris'; -SET TIMEZONE TO 'Europe/Andorra'; -SET TIMEZONE TO 'Europe/Amsterdam'; -SET TIMEZONE TO 'Europe/Nicosia'; -SET TIMEZONE TO 'Europe/Bratislava'; -SET TIMEZONE TO 'Europe/Minsk'; -SET TIMEZONE TO 'Europe/Prague'; -SET TIMEZONE TO 'Europe/Zaporozhye'; -SET TIMEZONE TO 'Egypt'; -SET TIMEZONE TO 'Zulu'; -SET TIMEZONE TO 'Etc/GMT+6'; -SET TIMEZONE TO 'Etc/GMT-8'; -SET TIMEZONE TO 'Etc/GMT-0'; -SET TIMEZONE TO 'Etc/GMT+3'; -SET TIMEZONE TO 'Etc/GMT-12'; -SET TIMEZONE TO 'Etc/GMT+7'; -SET TIMEZONE TO 'Etc/GMT-14'; -SET TIMEZONE TO 'Etc/GMT-10'; -SET TIMEZONE TO 'Etc/Zulu'; -SET TIMEZONE TO 'Etc/GMT-4'; -SET TIMEZONE TO 'Etc/GMT+5'; -SET TIMEZONE TO 'Etc/GMT'; -SET TIMEZONE TO 'Etc/GMT-11'; -SET TIMEZONE TO 'Etc/GMT-5'; -SET TIMEZONE TO 'Etc/GMT+1'; -SET TIMEZONE TO 'Etc/GMT+10'; -SET TIMEZONE TO 'Etc/UCT'; -SET TIMEZONE TO 'Etc/GMT+11'; -SET TIMEZONE TO 'Etc/GMT-3'; -SET TIMEZONE TO 'Etc/Greenwich'; -SET TIMEZONE TO 'Etc/GMT-13'; -SET TIMEZONE TO 'Etc/GMT-9'; -SET TIMEZONE TO 'Etc/GMT-7'; -SET TIMEZONE TO 'Etc/GMT-6'; -SET TIMEZONE TO 'Etc/GMT+4'; -SET TIMEZONE TO 'Etc/GMT+2'; -SET TIMEZONE TO 'Etc/Universal'; -SET TIMEZONE TO 'Etc/GMT+9'; -SET TIMEZONE TO 'Etc/GMT+0'; -SET TIMEZONE TO 'Etc/GMT-2'; -SET TIMEZONE TO 'Etc/GMT+12'; -SET TIMEZONE TO 'Etc/GMT-1'; -SET TIMEZONE TO 'Etc/UTC'; -SET TIMEZONE TO 'Etc/GMT+8'; -SET TIMEZONE TO 'Etc/GMT0'; -SET TIMEZONE TO 'Australia/Currie'; -SET TIMEZONE TO 'Australia/Lindeman'; -SET TIMEZONE TO 'Australia/Melbourne'; -SET TIMEZONE TO 'Australia/Yancowinna'; -SET TIMEZONE TO 'Australia/Eucla'; -SET TIMEZONE TO 'Australia/South'; -SET TIMEZONE TO 'Australia/Lord_Howe'; -SET TIMEZONE TO 'Australia/Perth'; -SET TIMEZONE TO 'Australia/Canberra'; -SET TIMEZONE TO 'Australia/Hobart'; -SET TIMEZONE TO 'Australia/North'; -SET TIMEZONE TO 'Australia/Broken_Hill'; -SET TIMEZONE TO 'Australia/NSW'; -SET TIMEZONE TO 'Australia/Victoria'; -SET TIMEZONE TO 'Australia/Adelaide'; -SET TIMEZONE TO 'Australia/Queensland'; -SET TIMEZONE TO 'Australia/Darwin'; -SET TIMEZONE TO 'Australia/West'; -SET TIMEZONE TO 'Australia/LHI'; -SET TIMEZONE TO 'Australia/ACT'; -SET TIMEZONE TO 'Australia/Sydney'; -SET TIMEZONE TO 'Australia/Brisbane'; -SET TIMEZONE TO 'Australia/Tasmania'; -SET TIMEZONE TO 'W-SU'; -SET TIMEZONE TO 'Africa/Kigali'; -SET TIMEZONE TO 'Africa/Dar_es_Salaam'; -SET TIMEZONE TO 'Africa/Niamey'; -SET TIMEZONE TO 'Africa/Brazzaville'; -SET TIMEZONE TO 'Africa/Addis_Ababa'; -SET TIMEZONE TO 'Africa/Kampala'; -SET TIMEZONE TO 'Africa/Kinshasa'; -SET TIMEZONE TO 'Africa/Lagos'; -SET TIMEZONE TO 'Africa/Accra'; -SET TIMEZONE TO 'Africa/Bangui'; -SET TIMEZONE TO 'Africa/Maputo'; -SET TIMEZONE TO 'Africa/Asmara'; -SET TIMEZONE TO 'Africa/Juba'; -SET TIMEZONE TO 'Africa/Tunis'; -SET TIMEZONE TO 'Africa/Bissau'; -SET TIMEZONE TO 'Africa/Freetown'; -SET TIMEZONE TO 'Africa/Tripoli'; -SET TIMEZONE TO 'Africa/Windhoek'; -SET TIMEZONE TO 'Africa/Casablanca'; -SET TIMEZONE TO 'Africa/Mbabane'; -SET TIMEZONE TO 'Africa/Harare'; -SET TIMEZONE TO 'Africa/Mogadishu'; -SET TIMEZONE TO 'Africa/Banjul'; -SET TIMEZONE TO 'Africa/Djibouti'; -SET TIMEZONE TO 'Africa/Malabo'; -SET TIMEZONE TO 'Africa/Nouakchott'; -SET TIMEZONE TO 'Africa/Lubumbashi'; -SET TIMEZONE TO 'Africa/Luanda'; -SET TIMEZONE TO 'Africa/Bamako'; -SET TIMEZONE TO 'Africa/Nairobi'; -SET TIMEZONE TO 'Africa/Lusaka'; -SET TIMEZONE TO 'Africa/Ouagadougou'; -SET TIMEZONE TO 'Africa/Asmera'; -SET TIMEZONE TO 'Africa/Douala'; -SET TIMEZONE TO 'Africa/Dakar'; -SET TIMEZONE TO 'Africa/Khartoum'; -SET TIMEZONE TO 'Africa/Libreville'; -SET TIMEZONE TO 'Africa/Maseru'; -SET TIMEZONE TO 'Africa/Lome'; -SET TIMEZONE TO 'Africa/Abidjan'; -SET TIMEZONE TO 'Africa/Ceuta'; -SET TIMEZONE TO 'Africa/El_Aaiun'; -SET TIMEZONE TO 'Africa/Algiers'; -SET TIMEZONE TO 'Africa/Ndjamena'; -SET TIMEZONE TO 'Africa/Gaborone'; -SET TIMEZONE TO 'Africa/Blantyre'; -SET TIMEZONE TO 'Africa/Sao_Tome'; -SET TIMEZONE TO 'Africa/Monrovia'; -SET TIMEZONE TO 'Africa/Johannesburg'; -SET TIMEZONE TO 'Africa/Timbuktu'; -SET TIMEZONE TO 'Africa/Cairo'; -SET TIMEZONE TO 'Africa/Porto-Novo'; -SET TIMEZONE TO 'Africa/Bujumbura'; -SET TIMEZONE TO 'Africa/Conakry'; -SET TIMEZONE TO 'PST8PDT'; -SET TIMEZONE TO 'Indian/Maldives'; -SET TIMEZONE TO 'Indian/Mahe'; -SET TIMEZONE TO 'Indian/Christmas'; -SET TIMEZONE TO 'Indian/Mauritius'; -SET TIMEZONE TO 'Indian/Chagos'; -SET TIMEZONE TO 'Indian/Mayotte'; -SET TIMEZONE TO 'Indian/Reunion'; -SET TIMEZONE TO 'Indian/Antananarivo'; -SET TIMEZONE TO 'Indian/Kerguelen'; -SET TIMEZONE TO 'Indian/Cocos'; -SET TIMEZONE TO 'Indian/Comoro'; -SET TIMEZONE TO 'MET'; -SET TIMEZONE TO 'ROC'; -SET TIMEZONE TO 'EET'; -SET TIMEZONE TO 'GMT'; -SET TIMEZONE TO 'EST'; -SET TIMEZONE TO 'Hongkong'; -SET TIMEZONE TO 'Turkey'; -SET TIMEZONE TO 'Iceland'; -SET TIMEZONE TO 'Poland'; -SET TIMEZONE TO 'GB'; -SET TIMEZONE TO 'Israel'; -SET TIMEZONE TO 'UCT'; -SET TIMEZONE TO 'Navajo'; -SET TIMEZONE TO 'Greenwich'; -SET TIMEZONE TO 'Antarctica/Davis'; -SET TIMEZONE TO 'Antarctica/Casey'; -SET TIMEZONE TO 'Antarctica/Troll'; -SET TIMEZONE TO 'Antarctica/DumontDUrville'; -SET TIMEZONE TO 'Antarctica/South_Pole'; -SET TIMEZONE TO 'Antarctica/Vostok'; -SET TIMEZONE TO 'Antarctica/Syowa'; -SET TIMEZONE TO 'Antarctica/Mawson'; -SET TIMEZONE TO 'Antarctica/McMurdo'; -SET TIMEZONE TO 'Antarctica/Palmer'; -SET TIMEZONE TO 'Antarctica/Macquarie'; -SET TIMEZONE TO 'Antarctica/Rothera'; -SET TIMEZONE TO 'CST6CDT'; -SET TIMEZONE TO 'Libya'; -SET TIMEZONE TO 'Kwajalein'; -SET TIMEZONE TO 'Cuba'; -SET TIMEZONE TO 'Mexico/BajaNorte'; -SET TIMEZONE TO 'Mexico/General'; -SET TIMEZONE TO 'Mexico/BajaSur'; -SET TIMEZONE TO 'WET'; -SET TIMEZONE TO 'Singapore'; -SET TIMEZONE TO 'Brazil/DeNoronha'; -SET TIMEZONE TO 'Brazil/Acre'; -SET TIMEZONE TO 'Brazil/West'; -SET TIMEZONE TO 'Brazil/East'; -SET TIMEZONE TO 'MST7MDT'; -SET TIMEZONE TO 'US/Aleutian'; -SET TIMEZONE TO 'US/Samoa'; -SET TIMEZONE TO 'US/Eastern'; -SET TIMEZONE TO 'US/Alaska'; -SET TIMEZONE TO 'US/Indiana-Starke'; -SET TIMEZONE TO 'US/Michigan'; -SET TIMEZONE TO 'US/Central'; -SET TIMEZONE TO 'US/East-Indiana'; -SET TIMEZONE TO 'US/Mountain'; -SET TIMEZONE TO 'US/Hawaii'; -SET TIMEZONE TO 'US/Pacific'; -SET TIMEZONE TO 'US/Arizona'; -SET TIMEZONE TO 'Universal'; -SET TIMEZONE TO 'Asia/Dushanbe'; -SET TIMEZONE TO 'Asia/Oral'; -SET TIMEZONE TO 'Asia/Magadan'; -SET TIMEZONE TO 'Asia/Hong_Kong'; -SET TIMEZONE TO 'Asia/Aden'; -SET TIMEZONE TO 'Asia/Tomsk'; -SET TIMEZONE TO 'Asia/Aqtobe'; -SET TIMEZONE TO 'Asia/Pontianak'; -SET TIMEZONE TO 'Asia/Kuching'; -SET TIMEZONE TO 'Asia/Tbilisi'; -SET TIMEZONE TO 'Asia/Novosibirsk'; -SET TIMEZONE TO 'Asia/Chita'; -SET TIMEZONE TO 'Asia/Hebron'; -SET TIMEZONE TO 'Asia/Choibalsan'; -SET TIMEZONE TO 'Asia/Qyzylorda'; -SET TIMEZONE TO 'Asia/Jakarta'; -SET TIMEZONE TO 'Asia/Colombo'; -SET TIMEZONE TO 'Asia/Dili'; -SET TIMEZONE TO 'Asia/Thimphu'; -SET TIMEZONE TO 'Asia/Tashkent'; -SET TIMEZONE TO 'Asia/Ujung_Pandang'; -SET TIMEZONE TO 'Asia/Ulaanbaatar'; -SET TIMEZONE TO 'Asia/Jerusalem'; -SET TIMEZONE TO 'Asia/Pyongyang'; -SET TIMEZONE TO 'Asia/Vladivostok'; -SET TIMEZONE TO 'Asia/Samarkand'; -SET TIMEZONE TO 'Asia/Beirut'; -SET TIMEZONE TO 'Asia/Shanghai'; -SET TIMEZONE TO 'Asia/Kabul'; -SET TIMEZONE TO 'Asia/Bangkok'; -SET TIMEZONE TO 'Asia/Almaty'; -SET TIMEZONE TO 'Asia/Kathmandu'; -SET TIMEZONE TO 'Asia/Ust-Nera'; -SET TIMEZONE TO 'Asia/Yangon'; -SET TIMEZONE TO 'Asia/Novokuznetsk'; -SET TIMEZONE TO 'Asia/Qatar'; -SET TIMEZONE TO 'Asia/Baghdad'; -SET TIMEZONE TO 'Asia/Srednekolymsk'; -SET TIMEZONE TO 'Asia/Hovd'; -SET TIMEZONE TO 'Asia/Istanbul'; -SET TIMEZONE TO 'Asia/Omsk'; -SET TIMEZONE TO 'Asia/Macau'; -SET TIMEZONE TO 'Asia/Yekaterinburg'; -SET TIMEZONE TO 'Asia/Vientiane'; -SET TIMEZONE TO 'Asia/Famagusta'; -SET TIMEZONE TO 'Asia/Urumqi'; -SET TIMEZONE TO 'Asia/Kuwait'; -SET TIMEZONE TO 'Asia/Dhaka'; -SET TIMEZONE TO 'Asia/Ulan_Bator'; -SET TIMEZONE TO 'Asia/Dubai'; -SET TIMEZONE TO 'Asia/Saigon'; -SET TIMEZONE TO 'Asia/Muscat'; -SET TIMEZONE TO 'Asia/Tehran'; -SET TIMEZONE TO 'Asia/Ho_Chi_Minh'; -SET TIMEZONE TO 'Asia/Aqtau'; -SET TIMEZONE TO 'Asia/Bishkek'; -SET TIMEZONE TO 'Asia/Kashgar'; -SET TIMEZONE TO 'Asia/Gaza'; -SET TIMEZONE TO 'Asia/Riyadh'; -SET TIMEZONE TO 'Asia/Ashkhabad'; -SET TIMEZONE TO 'Asia/Khandyga'; -SET TIMEZONE TO 'Asia/Anadyr'; -SET TIMEZONE TO 'Asia/Brunei'; -SET TIMEZONE TO 'Asia/Phnom_Penh'; -SET TIMEZONE TO 'Asia/Baku'; -SET TIMEZONE TO 'Asia/Sakhalin'; -SET TIMEZONE TO 'Asia/Atyrau'; -SET TIMEZONE TO 'Asia/Ashgabat'; -SET TIMEZONE TO 'Asia/Thimbu'; -SET TIMEZONE TO 'Asia/Damascus'; -SET TIMEZONE TO 'Asia/Kolkata'; -SET TIMEZONE TO 'Asia/Jayapura'; -SET TIMEZONE TO 'Asia/Tokyo'; -SET TIMEZONE TO 'Asia/Katmandu'; -SET TIMEZONE TO 'Asia/Bahrain'; -SET TIMEZONE TO 'Asia/Tel_Aviv'; -SET TIMEZONE TO 'Asia/Singapore'; -SET TIMEZONE TO 'Asia/Krasnoyarsk'; -SET TIMEZONE TO 'Asia/Seoul'; -SET TIMEZONE TO 'Asia/Barnaul'; -SET TIMEZONE TO 'Asia/Yakutsk'; -SET TIMEZONE TO 'Asia/Irkutsk'; -SET TIMEZONE TO 'Asia/Macao'; -SET TIMEZONE TO 'Asia/Taipei'; -SET TIMEZONE TO 'Asia/Kamchatka'; -SET TIMEZONE TO 'Asia/Yerevan'; -SET TIMEZONE TO 'Asia/Harbin'; -SET TIMEZONE TO 'Asia/Manila'; -SET TIMEZONE TO 'Asia/Qostanay'; -SET TIMEZONE TO 'Asia/Amman'; -SET TIMEZONE TO 'Asia/Nicosia'; -SET TIMEZONE TO 'Asia/Karachi'; -SET TIMEZONE TO 'Asia/Rangoon'; -SET TIMEZONE TO 'Asia/Chungking'; -SET TIMEZONE TO 'Asia/Chongqing'; -SET TIMEZONE TO 'Asia/Makassar'; -SET TIMEZONE TO 'Asia/Dacca'; -SET TIMEZONE TO 'Asia/Kuala_Lumpur'; -SET TIMEZONE TO 'Asia/Calcutta'; -SET TIMEZONE TO 'EST5EDT'; -SET TIMEZONE TO 'GMT+0'; -SET TIMEZONE TO 'Pacific/Wake'; -SET TIMEZONE TO 'Pacific/Samoa'; -SET TIMEZONE TO 'Pacific/Efate'; -SET TIMEZONE TO 'Pacific/Niue'; -SET TIMEZONE TO 'Pacific/Pago_Pago'; -SET TIMEZONE TO 'Pacific/Pitcairn'; -SET TIMEZONE TO 'Pacific/Saipan'; -SET TIMEZONE TO 'Pacific/Norfolk'; -SET TIMEZONE TO 'Pacific/Yap'; -SET TIMEZONE TO 'Pacific/Enderbury'; -SET TIMEZONE TO 'Pacific/Port_Moresby'; -SET TIMEZONE TO 'Pacific/Funafuti'; -SET TIMEZONE TO 'Pacific/Apia'; -SET TIMEZONE TO 'Pacific/Rarotonga'; -SET TIMEZONE TO 'Pacific/Ponape'; -SET TIMEZONE TO 'Pacific/Wallis'; -SET TIMEZONE TO 'Pacific/Johnston'; -SET TIMEZONE TO 'Pacific/Guam'; -SET TIMEZONE TO 'Pacific/Guadalcanal'; -SET TIMEZONE TO 'Pacific/Chatham'; -SET TIMEZONE TO 'Pacific/Truk'; -SET TIMEZONE TO 'Pacific/Fakaofo'; -SET TIMEZONE TO 'Pacific/Kosrae'; -SET TIMEZONE TO 'Pacific/Kiritimati'; -SET TIMEZONE TO 'Pacific/Gambier'; -SET TIMEZONE TO 'Pacific/Kwajalein'; -SET TIMEZONE TO 'Pacific/Midway'; -SET TIMEZONE TO 'Pacific/Pohnpei'; -SET TIMEZONE TO 'Pacific/Majuro'; -SET TIMEZONE TO 'Pacific/Tahiti'; -SET TIMEZONE TO 'Pacific/Fiji'; -SET TIMEZONE TO 'Pacific/Tongatapu'; -SET TIMEZONE TO 'Pacific/Palau'; -SET TIMEZONE TO 'Pacific/Galapagos'; -SET TIMEZONE TO 'Pacific/Marquesas'; -SET TIMEZONE TO 'Pacific/Bougainville'; -SET TIMEZONE TO 'Pacific/Honolulu'; -SET TIMEZONE TO 'Pacific/Noumea'; -SET TIMEZONE TO 'Pacific/Auckland'; -SET TIMEZONE TO 'Pacific/Chuuk'; -SET TIMEZONE TO 'Pacific/Nauru'; -SET TIMEZONE TO 'Pacific/Easter'; -SET TIMEZONE TO 'Pacific/Tarawa'; -SET TIMEZONE TO 'America/Detroit'; -SET TIMEZONE TO 'America/Barbados'; -SET TIMEZONE TO 'America/North_Dakota/New_Salem'; -SET TIMEZONE TO 'America/North_Dakota/Center'; -SET TIMEZONE TO 'America/North_Dakota/Beulah'; -SET TIMEZONE TO 'America/Thunder_Bay'; -SET TIMEZONE TO 'America/Panama'; -SET TIMEZONE TO 'America/Cancun'; -SET TIMEZONE TO 'America/Santo_Domingo'; -SET TIMEZONE TO 'America/Matamoros'; -SET TIMEZONE TO 'America/Port-au-Prince'; -SET TIMEZONE TO 'America/Atikokan'; -SET TIMEZONE TO 'America/Knox_IN'; -SET TIMEZONE TO 'America/Cayenne'; -SET TIMEZONE TO 'America/Kralendijk'; -SET TIMEZONE TO 'America/Iqaluit'; -SET TIMEZONE TO 'America/Paramaribo'; -SET TIMEZONE TO 'America/Aruba'; -SET TIMEZONE TO 'America/Vancouver'; -SET TIMEZONE TO 'America/Noronha'; -SET TIMEZONE TO 'America/Ojinaga'; -SET TIMEZONE TO 'America/Atka'; -SET TIMEZONE TO 'America/St_Johns'; -SET TIMEZONE TO 'America/Mexico_City'; -SET TIMEZONE TO 'America/Rosario'; -SET TIMEZONE TO 'America/Nipigon'; -SET TIMEZONE TO 'America/Costa_Rica'; -SET TIMEZONE TO 'America/Regina'; -SET TIMEZONE TO 'America/La_Paz'; -SET TIMEZONE TO 'America/Jamaica'; -SET TIMEZONE TO 'America/Anchorage'; -SET TIMEZONE TO 'America/St_Kitts'; -SET TIMEZONE TO 'America/Godthab'; -SET TIMEZONE TO 'America/Swift_Current'; -SET TIMEZONE TO 'America/Danmarkshavn'; -SET TIMEZONE TO 'America/Phoenix'; -SET TIMEZONE TO 'America/Lower_Princes'; -SET TIMEZONE TO 'America/Yakutat'; -SET TIMEZONE TO 'America/Menominee'; -SET TIMEZONE TO 'America/Bahia'; -SET TIMEZONE TO 'America/Montserrat'; -SET TIMEZONE TO 'America/Miquelon'; -SET TIMEZONE TO 'America/Anguilla'; -SET TIMEZONE TO 'America/Grand_Turk'; -SET TIMEZONE TO 'America/Coral_Harbour'; -SET TIMEZONE TO 'America/Glace_Bay'; -SET TIMEZONE TO 'America/Boa_Vista'; -SET TIMEZONE TO 'America/Dominica'; -SET TIMEZONE TO 'America/Goose_Bay'; -SET TIMEZONE TO 'America/Caracas'; -SET TIMEZONE TO 'America/Boise'; -SET TIMEZONE TO 'America/Cayman'; -SET TIMEZONE TO 'America/Puerto_Rico'; -SET TIMEZONE TO 'America/Guyana'; -SET TIMEZONE TO 'America/Metlakatla'; -SET TIMEZONE TO 'America/Cuiaba'; -SET TIMEZONE TO 'America/Virgin'; -SET TIMEZONE TO 'America/Campo_Grande'; -SET TIMEZONE TO 'America/Maceio'; -SET TIMEZONE TO 'America/Scoresbysund'; -SET TIMEZONE TO 'America/Guadeloupe'; -SET TIMEZONE TO 'America/Indiana/Vevay'; -SET TIMEZONE TO 'America/Indiana/Winamac'; -SET TIMEZONE TO 'America/Indiana/Petersburg'; -SET TIMEZONE TO 'America/Indiana/Marengo'; -SET TIMEZONE TO 'America/Indiana/Knox'; -SET TIMEZONE TO 'America/Indiana/Indianapolis'; -SET TIMEZONE TO 'America/Indiana/Vincennes'; -SET TIMEZONE TO 'America/Indiana/Tell_City'; -SET TIMEZONE TO 'America/Manaus'; -SET TIMEZONE TO 'America/Resolute'; -SET TIMEZONE TO 'America/Pangnirtung'; -SET TIMEZONE TO 'America/Winnipeg'; diff --git a/src/test/isolation2/sql/resgroup/resgroup_cancel_terminate_concurrency.sql b/src/test/isolation2/sql/resgroup/resgroup_cancel_terminate_concurrency.sql deleted file mode 100644 index 6b224fbb0f1..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_cancel_terminate_concurrency.sql +++ /dev/null @@ -1,144 +0,0 @@ --- test1: cancel a query that is waiting for a slot -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE OR REPLACE VIEW rg_concurrency_view AS - SELECT waiting, waiting_reason, state, query, rsgname - FROM pg_stat_activity - WHERE rsgname='rg_concurrency_test'; - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -1:SET ROLE role_concurrency_test; -1:BEGIN; -2:SET ROLE role_concurrency_test; -2&:BEGIN; -3:SET ROLE role_concurrency_test; -3&:BEGIN; -SELECT * FROM rg_concurrency_view; -SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE waiting_reason='resgroup' AND rsgname='rg_concurrency_test'; -1:END; -2<: -3<: -SELECT * FROM rg_concurrency_view; -1q: -2q: -3q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test2: terminate a query that is waiting for a slot -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -1:SET ROLE role_concurrency_test; -1:BEGIN; -2:SET ROLE role_concurrency_test; -2&:BEGIN; -3:SET ROLE role_concurrency_test; -3&:BEGIN; -SELECT * FROM rg_concurrency_view; -SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE waiting_reason='resgroup' AND rsgname='rg_concurrency_test'; -1:END; -2<: -3<: -SELECT * FROM rg_concurrency_view; -1q: -2q: -3q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test3: cancel a query that is running -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=2, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -1:SET ROLE role_concurrency_test; -1&:SELECT pg_sleep(10000); -2:SET ROLE role_concurrency_test; -2&:SELECT pg_sleep(10000); -6:SET ROLE role_concurrency_test; -6&:BEGIN; -7:SET ROLE role_concurrency_test; -7&:BEGIN; -SELECT * FROM rg_concurrency_view; -SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE waiting='f' AND rsgname='rg_concurrency_test'; -1<: -2<: -6<: -7<: -SELECT * FROM rg_concurrency_view; -1q: -2q: -6q: -7q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test4: terminate a query that is running -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=2, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -1:SET ROLE role_concurrency_test; -1&:SELECT pg_sleep(10000); -2:SET ROLE role_concurrency_test; -2&:SELECT pg_sleep(10000); -6:SET ROLE role_concurrency_test; -6&:BEGIN; -7:SET ROLE role_concurrency_test; -7&:BEGIN; -SELECT * FROM rg_concurrency_view; -SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE waiting='f' AND rsgname='rg_concurrency_test'; -1<: -2<: -6<: -7<: -SELECT * FROM rg_concurrency_view; -1q: -2q: -6q: -7q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test5: terminate a query waiting for a slot, that opens a transaction on exit callback -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -1:SET ROLE role_concurrency_test; -1:CREATE TEMP TABLE tmp(a INT); -2:SET ROLE role_concurrency_test; -2:BEGIN; -1&:SELECT 1; -SELECT * FROM rg_concurrency_view; --- Upon receiving the terminate request, session 1 should start a new transaction to cleanup temp table. --- Note, that session 1 has already been waiting for resource group slot, its new transaction will bypass --- resource group since it's exiting. -SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE waiting_reason='resgroup' AND rsgname='rg_concurrency_test'; -1<: -2:COMMIT; -SELECT * FROM rg_concurrency_view; -1q: -2q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - -DROP VIEW rg_concurrency_view; diff --git a/src/test/isolation2/sql/resgroup/resgroup_concurrency.sql b/src/test/isolation2/sql/resgroup/resgroup_concurrency.sql deleted file mode 100644 index 0cdaf2e4dd1..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_concurrency.sql +++ /dev/null @@ -1,265 +0,0 @@ --- test1: test gp_toolkit.gp_resgroup_status and pg_stat_activity --- create a resource group when gp_resource_manager is queue -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=2, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; - --- no query has been assigned to the this group - -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; -2:SET ROLE role_concurrency_test; -2:BEGIN; -3:SET ROLE role_concurrency_test; -3:BEGIN; -4:SET ROLE role_concurrency_test; -4&:BEGIN; - --- new transaction will be blocked when the concurrency limit of the resource group is reached. -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; -SELECT waiting_reason, rsgqueueduration > '0'::interval as time from pg_stat_activity where query = 'BEGIN;' and state = 'active' and rsgname = 'rg_concurrency_test'; -2:END; -3:END; -4<: -4:END; -2q: -3q: -4q: -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test2: test alter concurrency --- Create a resource group with concurrency=2. Prepare 2 running transactions and 1 queueing transactions. --- Alter concurrency 2->3, the queueing transaction will be woken up, the 'value' of pg_resgroupcapability will be set to 3. -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=2, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -12:SET ROLE role_concurrency_test; -12:BEGIN; -13:SET ROLE role_concurrency_test; -13:BEGIN; -14:SET ROLE role_concurrency_test; -14&:BEGIN; -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; -SELECT concurrency FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_concurrency_test'; -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 3; -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; -SELECT concurrency FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_concurrency_test'; -12:END; -13:END; -14<: -14:END; -12q: -13q: -14q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test3: test alter concurrency --- Create a resource group with concurrency=3. Prepare 3 running transactions, and 1 queueing transaction. -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=3, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -22:SET ROLE role_concurrency_test; -22:BEGIN; -23:SET ROLE role_concurrency_test; -23:BEGIN; -24:SET ROLE role_concurrency_test; -24:BEGIN; -25:SET ROLE role_concurrency_test; -25&:BEGIN; -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; -SELECT concurrency FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_concurrency_test'; --- Alter concurrency 3->2, the 'value' of pg_resgroupcapability will be set to 2. -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2; -SELECT concurrency FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_concurrency_test'; --- When one transaction is finished, queueing transaction won't be woken up. There're 2 running transactions and 1 queueing transaction. -24:END; -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; --- New transaction will be queued, there're 2 running and 2 queueing transactions. -24&:BEGIN; -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; --- Finish another transaction, one queueing transaction will be woken up, there're 2 running transactions and 1 queueing transaction. -22:END; -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; --- Alter concurrency 2->2, the 'value' of pg_resgroupcapability will be set to 2. -ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2; -SELECT concurrency FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_concurrency_test'; --- Finish another transaction, one queueing transaction will be woken up, there're 2 running transactions and 0 queueing transaction. -23:END; -SELECT r.rsgname, num_running, num_queueing, num_queued, num_executed FROM gp_toolkit.gp_resgroup_status s, pg_resgroup r WHERE s.groupid=r.oid AND r.rsgname='rg_concurrency_test'; -24<: -25<: -25:END; -24:END; -22q: -23q: -24q: -25q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test4: concurrently drop resource group - -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=2, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; - --- DROP should fail if there're running transactions -32:SET ROLE role_concurrency_test; -32:BEGIN; -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; -32:END; - -DROP ROLE IF EXISTS role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test5: QD exit before QE -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -51:SET ROLE role_concurrency_test; -51:BEGIN; -52:SET ROLE role_concurrency_test; -52&:BEGIN; -SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE waiting_reason='resgroup' AND rsgname='rg_concurrency_test'; -52<: -52&:BEGIN; -SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE waiting_reason='resgroup' AND rsgname='rg_concurrency_test'; -52<: -51q: -52q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test6: cancel a query that is waiting for a slot -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -51:SET ROLE role_concurrency_test; -51:BEGIN; -52:SET ROLE role_concurrency_test; -52&:BEGIN; -51q: -52<: -52q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - - --- test7: terminate a query that is waiting for a slot -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -61:SET ROLE role_concurrency_test; -61:BEGIN; -62:SET ROLE role_concurrency_test; -62&:BEGIN; -SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE waiting_reason='resgroup' AND rsgname='rg_concurrency_test'; -62<: -61q: -62q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- test8: create a resgroup with concurrency=0 -DROP ROLE IF EXISTS role_concurrency_test; --- start_ignore -DROP RESOURCE GROUP rg_concurrency_test; --- end_ignore - -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=0, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; -61:SET ROLE role_concurrency_test; -61&:BEGIN; -SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE waiting_reason='resgroup' AND rsgname='rg_concurrency_test'; -61<: -61q: -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; - --- --- Test cursors, pl/* functions only take one slot. --- --- set concurrency to 1 -CREATE RESOURCE GROUP rg_concurrency_test WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test; - --- declare cursors and verify that it only takes one resource group slot -71:SET ROLE TO role_concurrency_test; -71:CREATE TABLE foo_concurrency_test as select i as c1 , i as c2 from generate_series(1, 1000) i; -71:CREATE TABLE bar_concurrency_test as select i as c1 , i as c2 from generate_series(1, 1000) i; -71:BEGIN; -71:DECLARE c1 CURSOR for select c1, c2 from foo_concurrency_test order by c1 limit 10; -71:DECLARE c2 CURSOR for select c1, c2 from bar_concurrency_test order by c1 limit 10; -71:DECLARE c3 CURSOR for select count(*) from foo_concurrency_test t1, bar_concurrency_test t2 where t1.c2 = t2.c2; -71:Fetch ALL FROM c1; -71:Fetch ALL FROM c2; -71:Fetch ALL FROM c3; -71:END; - --- create a pl function and verify that it only takes one resource group slot. -CREATE OR REPLACE FUNCTION func_concurrency_test () RETURNS integer as /*in func*/ -$$ /*in func*/ -DECLARE /*in func*/ - tmprecord RECORD; /*in func*/ - ret integer; /*in func*/ -BEGIN /*in func*/ - SELECT count(*) INTO ret FROM foo_concurrency_test; /*in func*/ - FOR tmprecord IN SELECT * FROM bar_concurrency_test LOOP /*in func*/ - SELECT count(*) INTO ret FROM foo_concurrency_test; /*in func*/ - END LOOP; /*in func*/ - /*in func*/ - select 1/0; /*in func*/ -EXCEPTION /*in func*/ - WHEN division_by_zero THEN /*in func*/ - SELECT count(*) INTO ret FROM foo_concurrency_test; /*in func*/ - raise NOTICE 'divided by zero'; /*in func*/ - RETURN ret; /*in func*/ -END; /*in func*/ -$$ /*in func*/ -LANGUAGE plpgsql; - -71: select func_concurrency_test(); - --- Prepare/execute statements and verify that it only takes one resource group slot. -71:BEGIN; -71:PREPARE p1 (integer) as select * from foo_concurrency_test where c2=$1; -71:PREPARE p2 (integer) as select * from bar_concurrency_test where c2=$1; -71:EXECUTE p1(1); -71:EXECUTE p2(2); -71:END; -71:PREPARE p3 (integer) as select * from foo_concurrency_test where c2=$1; -71:PREPARE p4 (integer) as select * from bar_concurrency_test where c2=$1; -71:EXECUTE p3(1); -71:EXECUTE p4(2); - -DROP TABLE foo_concurrency_test; -DROP TABLE bar_concurrency_test; -DROP ROLE role_concurrency_test; -DROP RESOURCE GROUP rg_concurrency_test; diff --git a/src/test/isolation2/sql/resgroup/resgroup_cpuset_empty_default.sql b/src/test/isolation2/sql/resgroup/resgroup_cpuset_empty_default.sql deleted file mode 100644 index fb2811f3865..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_cpuset_empty_default.sql +++ /dev/null @@ -1,32 +0,0 @@ --- A regression test for cpuset. --- --- When all the cpu cores are allocated the default cpuset group should --- fallback to core 0. However this fallback logic was only added on --- CREATE / ALTER RESOURCE GROUP, but missing in startup logic, an empty cpu --- core list "" is set to cgroup and cause a runtime error: --- --- can't write data to file '/sys/fs/cgroup/cpuset/gpdb/1/cpuset.cpus': --- No space left on device (resgroup-ops-linux.c:916) --- --- To trigger the issue we create a resource group, allocate all the cpu cores --- to it, and restart the cluster. - --- start_ignore -DROP RESOURCE GROUP rg1_cpuset_test; --- end_ignore - --- Create a resource group with all the cpu cores. --- The isolation2 test framework does not support \set so we have to plan with --- some tricks. -! psql -d isolation2resgrouptest -Ac "CREATE RESOURCE GROUP rg1_cpuset_test WITH (memory_limit=10, cpuset='0-$(($(nproc)-1))')"; - --- Alter a resource group from / to all the cpu cores should also work. -ALTER RESOURCE GROUP rg1_cpuset_test SET cpuset '0'; -! psql -d isolation2resgrouptest -Ac "ALTER RESOURCE GROUP rg1_cpuset_test SET cpuset '0-$(($(nproc)-1))'"; - --- start_ignore -! gpstop -rai; --- end_ignore - --- Cleanup in a new connection as the default one is disconnected by gpstop -10: DROP RESOURCE GROUP rg1_cpuset_test; diff --git a/src/test/isolation2/sql/resgroup/resgroup_dumpinfo.sql b/src/test/isolation2/sql/resgroup/resgroup_dumpinfo.sql deleted file mode 100644 index 96581441a01..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_dumpinfo.sql +++ /dev/null @@ -1,92 +0,0 @@ -DROP ROLE IF EXISTS role_dumpinfo_test; -DROP ROLE IF EXISTS role_permission; --- start_ignore -DROP RESOURCE GROUP rg_dumpinfo_test; -CREATE LANGUAGE plpythonu; --- end_ignore - -CREATE FUNCTION dump_test_check() RETURNS bool -as $$ -import json -import pygresql.pg as pg - -def validate(json_obj, segnum): - array = json_obj.get("info") - #validate segnum - if len(array) != segnum: - return False - qd_info = [j for j in array if j["segid"] == -1][0] - #validate keys - keys = ["segid", "segmentsOnMaster", "loaded", "totalChunks", - "freeChunks", "chunkSizeInBits", "groups"] - for key in keys: - if key not in qd_info: - return False - - groups = [g for g in qd_info["groups"] if g["group_id"] > 6438] - #validate user created group - if len(groups) != 1: - return False - group = groups[0] - #validate group keys - keys = ["group_id", "nRunning", "locked_for_drop", "memExpected", - "memQuotaGranted", "memSharedGranted", "memQuotaUsed", - "memUsage", "memSharedUsage"] - for key in keys: - if key not in group: - return False - - #validate waitqueue - wait_queue = group["wait_queue"] - if wait_queue["wait_queue_size"] != 1: - return False - #validate nrunning - nrunning = group["nRunning"] - if nrunning != 2: - return False - - return True - -conn = pg.connect(dbname="postgres") - -r = conn.query("select count(*) from gp_segment_configuration where role = 'p';") -n = r.getresult()[0][0] - -r = conn.query("select value from pg_resgroup_get_status_kv('dump');") -json_text = r.getresult()[0][0] -json_obj = json.loads(json_text) - -return validate(json_obj, n) - -$$ LANGUAGE plpythonu; - -CREATE RESOURCE GROUP rg_dumpinfo_test WITH (concurrency=2, cpu_rate_limit=20, memory_limit=20); -CREATE ROLE role_dumpinfo_test RESOURCE GROUP rg_dumpinfo_test; - -2:SET ROLE role_dumpinfo_test; -2:BEGIN; -3:SET ROLE role_dumpinfo_test; -3:BEGIN; -4:SET ROLE role_dumpinfo_test; -4&:BEGIN; - -SELECT dump_test_check(); - -2:END; -3:END; -4<: -4:END; -2q: -3q: -4q: - -CREATE ROLE role_permission; -SET ROLE role_permission; -select value from pg_resgroup_get_status_kv('dump'); - -RESET ROLE; - -DROP ROLE role_dumpinfo_test; -DROP ROLE role_permission; -DROP RESOURCE GROUP rg_dumpinfo_test; -DROP LANGUAGE plpythonu CASCADE; diff --git a/src/test/isolation2/sql/resgroup/resgroup_functions.sql b/src/test/isolation2/sql/resgroup/resgroup_functions.sql deleted file mode 100644 index e9d08e6c54f..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_functions.sql +++ /dev/null @@ -1,11 +0,0 @@ --- start_ignore -SELECT s.groupid, s.num_running, s.num_queueing, s.num_queued, s.num_executed -FROM pg_resgroup_get_status(NULL::oid) s(groupid, num_running, num_queueing, num_queued, num_executed, total_queue_duration, cpu_usage, memory_usage); --- end_ignore -CREATE TEMP TABLE resgroup_function_test(LIKE gp_toolkit.gp_resgroup_status); - -INSERT INTO resgroup_function_test(groupid, num_running, num_queueing, num_queued, num_executed) -SELECT s.groupid, s.num_running, s.num_queueing, s.num_queued, s.num_executed -FROM pg_resgroup_get_status(NULL::oid) s(groupid, num_running, num_queueing, num_queued, num_executed, total_queue_duration, cpu_usage, memory_usage) LIMIT 1; - -SELECT count(num_executed)>0 FROM resgroup_function_test WHERE num_executed IS NOT NULL; diff --git a/src/test/isolation2/sql/resgroup/resgroup_large_group_id.sql b/src/test/isolation2/sql/resgroup/resgroup_large_group_id.sql deleted file mode 100644 index db7fda0be9b..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_large_group_id.sql +++ /dev/null @@ -1,15 +0,0 @@ --- Test resgroup oid larger than int32. -create extension if not exists gp_inject_fault; - -select gp_inject_fault('bump_oid', 'skip', dbid) from gp_segment_configuration where role = 'p' and content = -1; - -create resource group rg_large_oid with (cpu_rate_limit=20, memory_limit=10); - -select gp_inject_fault('bump_oid', 'reset', dbid) from gp_segment_configuration where role = 'p' and content = -1; - -select max(oid)::bigint > (power(2,31) + 1)::bigint from pg_resgroup; - --- count(*) > 0 to run the SQL but do not display the result -select count(*) > 0 from pg_resgroup_get_status(NULL); - -drop resource group rg_large_oid; diff --git a/src/test/isolation2/sql/resgroup/resgroup_memory_hashagg_spill.sql b/src/test/isolation2/sql/resgroup/resgroup_memory_hashagg_spill.sql deleted file mode 100644 index 363dfaa5157..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_memory_hashagg_spill.sql +++ /dev/null @@ -1,127 +0,0 @@ --- start_matchsubs --- m/INSERT \d+/ --- s/INSERT \d+/INSERT/ --- end_matchsubs -create schema hashagg_spill; -set search_path to hashagg_spill; - --- start_ignore -create language plpythonu; --- end_ignore - --- set workfile is created to true if all segment did it. -create or replace function hashagg_spill.is_workfile_created(explain_query text) -returns setof int as -$$ -import re -query = "select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0;" -rv = plpy.execute(query) -nsegments = int(rv[0]['nsegments']) -rv = plpy.execute(explain_query) -search_text = 'Work_mem used' -result = [] -for i in range(len(rv)): - cur_line = rv[i]['QUERY PLAN'] - if search_text.lower() in cur_line.lower(): - p = re.compile('.+\((seg[\d]+).+ Workfile: \(([\d+]) spilling\)') - m = p.match(cur_line) - if not m: - continue - workfile_created = int(m.group(2)) - cur_row = int(workfile_created == nsegments) - result.append(cur_row) -return result -$$ -language plpythonu; - -create table testhagg (i1 int, i2 int, i3 int, i4 int); -insert into testhagg select i,i,i,i from - (select generate_series(1, nsegments * 17000) as i from - (select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0) foo) bar; - - --- start_ignore -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore -CREATE ROLE role1_memory_test SUPERUSER; -CREATE RESOURCE GROUP rg1_memory_test WITH -(concurrency=2, cpu_rate_limit=10, memory_limit=30, memory_shared_quota=0, memory_spill_ratio=10); -SET ROLE TO role1_memory_test; - -0: ALTER RESOURCE GROUP rg1_memory_test SET MEMORY_SPILL_RATIO 2; -0: ALTER ROLE role1_memory_test RESOURCE GROUP rg1_memory_test; -set gp_resgroup_print_operator_memory_limits=on; - --- the number of rows returned by the query varies depending on the number of segments, so --- only print the first 10 -select * from (select max(i1) from testhagg group by i2) foo order by 1 limit 10; -select * from hashagg_spill.is_workfile_created('explain analyze select max(i1) from testhagg group by i2;'); -select * from hashagg_spill.is_workfile_created('explain analyze select max(i1) from testhagg group by i2 limit 45000;'); - - --- Test HashAgg with increasing amount of overflows - -reset all; - --- Returns the number of overflows from EXPLAIN ANALYZE output -create or replace function hashagg_spill.num_hashagg_overflows(explain_query text) -returns setof int as -$$ -import re -query = "select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0;" -rv = plpy.execute(query) -rv = plpy.execute(explain_query) -result = [] -for i in range(len(rv)): - cur_line = rv[i]['QUERY PLAN'] - p = re.compile('.+\((seg[\d]+).+ ([\d+]) overflows;') - m = p.match(cur_line) - if m: - overflows = int(m.group(2)) - result.append(overflows) -return result -$$ -language plpythonu; - --- Test agg spilling scenarios -drop table if exists aggspill; -create table aggspill (i int, j int, t text) distributed by (i); -insert into aggspill select i, i*2, i::text from generate_series(1, 10000) i; -insert into aggspill select i, i*2, i::text from generate_series(1, 100000) i; -insert into aggspill select i, i*2, i::text from generate_series(1, 1000000) i; - --- No spill with large statement memory -0: ALTER ROLE role1_memory_test RESOURCE GROUP none; -0: DROP RESOURCE GROUP rg1_memory_test; -0: CREATE RESOURCE GROUP rg1_memory_test WITH (concurrency=1, cpu_rate_limit=10, memory_limit=60, memory_shared_quota=0, memory_spill_ratio=30); -0: ALTER ROLE role1_memory_test RESOURCE GROUP rg1_memory_test; -select count(*) from (select i, count(*) from aggspill group by i,j having count(*) = 1) g; - --- Reduce the statement memory to induce spilling -0: ALTER ROLE role1_memory_test RESOURCE GROUP none; -0: DROP RESOURCE GROUP rg1_memory_test; -0: CREATE RESOURCE GROUP rg1_memory_test WITH (concurrency=2, cpu_rate_limit=10, memory_limit=30, memory_shared_quota=0, memory_spill_ratio=10); -0: ALTER ROLE role1_memory_test RESOURCE GROUP rg1_memory_test; -select overflows >= 1 from hashagg_spill.num_hashagg_overflows('explain analyze -select count(*) from (select i, count(*) from aggspill group by i,j having count(*) = 2) g') overflows; -select count(*) from (select i, count(*) from aggspill group by i,j having count(*) = 2) g; - --- Reduce the statement memory, nbatches and entrysize even further to cause multiple overflows -set gp_hashagg_default_nbatches = 4; -0: ALTER RESOURCE GROUP rg1_memory_test SET MEMORY_SPILL_RATIO 5; -0: ALTER ROLE role1_memory_test RESOURCE GROUP rg1_memory_test; - -select overflows > 1 from hashagg_spill.num_hashagg_overflows('explain analyze -select count(*) from (select i, count(*) from aggspill group by i,j,t having count(*) = 3) g') overflows; - -select count(*) from (select i, count(*) from aggspill group by i,j,t having count(*) = 3) g; - -drop schema hashagg_spill cascade; -drop table aggspill; - --- start_ignore -RESET ROLE; -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_memory_hashjoin_spill.sql b/src/test/isolation2/sql/resgroup/resgroup_memory_hashjoin_spill.sql deleted file mode 100644 index 27632b10cec..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_memory_hashjoin_spill.sql +++ /dev/null @@ -1,72 +0,0 @@ --- start_matchsubs --- m/INSERT \d+/ --- s/INSERT \d+/INSERT/ --- end_matchsubs -create schema hashjoin_spill; -set search_path to hashjoin_spill; - --- start_ignore -create language plpythonu; --- end_ignore - --- set workfile is created to true if all segment did it. -create or replace function hashjoin_spill.is_workfile_created(explain_query text) -returns setof int as -$$ -import re -query = "select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0;" -rv = plpy.execute(query) -nsegments = int(rv[0]['nsegments']) -rv = plpy.execute(explain_query) -search_text = 'Work_mem used' -result = [] -for i in range(len(rv)): - cur_line = rv[i]['QUERY PLAN'] - if search_text.lower() in cur_line.lower(): - p = re.compile('.+\((seg[\d]+).+ Workfile: \(([\d+]) spilling\)') - m = p.match(cur_line) - workfile_created = int(m.group(2)) - cur_row = int(workfile_created == nsegments) - result.append(cur_row) -return result -$$ -language plpythonu; - --- start_ignore -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore -CREATE RESOURCE GROUP rg1_memory_test WITH -(concurrency=2, cpu_rate_limit=10, memory_limit=30, memory_shared_quota=0, memory_spill_ratio=1); -CREATE ROLE role1_memory_test SUPERUSER RESOURCE GROUP rg1_memory_test; -SET ROLE TO role1_memory_test; - -CREATE TABLE test_hj_spill (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int); -insert into test_hj_spill SELECT i,i,i%1000,i,i,i,i,i from - (select generate_series(1, nsegments * 15000) as i from - (select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0) foo) bar; -set gp_resgroup_print_operator_memory_limits=on; - -set gp_workfile_type_hashjoin=buffile; -select avg(i3) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; -select * from hashjoin_spill.is_workfile_created('explain analyze SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2;'); -select * from hashjoin_spill.is_workfile_created('explain analyze SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2 LIMIT 15000;'); - -set gp_workfile_type_hashjoin=bfz; -set gp_workfile_compress_algorithm=zlib; -select avg(i3) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; -select * from hashjoin_spill.is_workfile_created('explain analyze SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2'); -select * from hashjoin_spill.is_workfile_created('explain analyze SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2 LIMIT 15000;'); - -set gp_workfile_compress_algorithm=NONE; -select avg(i3) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; -select * from hashjoin_spill.is_workfile_created('explain analyze SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2'); -select * from hashjoin_spill.is_workfile_created('explain analyze SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2 LIMIT 15000;'); - -drop schema hashjoin_spill cascade; - --- start_ignore -RESET ROLE; -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_memory_materialize_spill.sql b/src/test/isolation2/sql/resgroup/resgroup_memory_materialize_spill.sql deleted file mode 100644 index 73f13e72a95..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_memory_materialize_spill.sql +++ /dev/null @@ -1,104 +0,0 @@ --- start_matchsubs --- m/INSERT \d+/ --- s/INSERT \d+/INSERT/ --- end_matchsubs -create schema materialize_spill; -set search_path to materialize_spill; - --- start_ignore -create language plpythonu; --- end_ignore - --- Helper function to verify that a plan spilled to disk. For each node --- in the plan that used Workfiles (Materialize or Sort nodes, currently), --- return the number of segments where the node spilled to disk. -create or replace function num_workfiles_created(explain_query text) -returns setof int as -$$ -import re -rv = plpy.execute(explain_query) -search_text = 'Work_mem used' -result = [] -for i in range(len(rv)): - cur_line = rv[i]['QUERY PLAN'] - if search_text.lower() in cur_line.lower(): - p = re.compile('.+\((seg[\d]+).+ Workfile: \(([\d+]) spilling\)') - m = p.match(cur_line) - workfile_created = int(m.group(2)) - result.append(workfile_created) -return result -$$ -language plpythonu; - --- Run a query that contains a Materialize node that spills to disk. --- --- The expected plan is something like this: --- --- Gather Motion 3:1 --- -> Nested Loop Left Join --- Join Filter: t1.i1 = t2.i2 --- -> Seq Scan on test_mat_small t1 --- -> Materialize --- -> Redistribute Motion 3:3 --- Hash Key: t2.i2 --- -> Seq Scan on test_mat_large t2 --- --- The planner will put a Materialize node on the inner side, to shield --- the Motion node from rewinding. Because the larger table doesn't fit --- in memory, the Materialize will spill to disk. --- -CREATE TABLE test_mat_small (i1 int); -INSERT INTO test_mat_small SELECT i from generate_series(101, 105) i; - --- Scale the larger table's size with the number of segments, so that there is enough --- data on every segment to cause spilling. -CREATE TABLE test_mat_large (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int); -INSERT INTO test_mat_large SELECT i,i,i,i,i,i,i,i from - (select generate_series(1, nsegments * 50000) as i from - (select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0) foo) bar; - --- start_ignore -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore -CREATE RESOURCE GROUP rg1_memory_test WITH -(concurrency=2, cpu_rate_limit=10, memory_limit=30, memory_shared_quota=0, memory_spill_ratio=1); -CREATE ROLE role1_memory_test SUPERUSER RESOURCE GROUP rg1_memory_test; -SET ROLE TO role1_memory_test; - -set gp_resgroup_print_operator_memory_limits=on; -set enable_hashjoin = false; -set enable_nestloop = true; --- ORCA doesn't honor enable_nestloop/enable_hashjoin, so this won't produce --- the kind of plan we're looking for. -set optimizer=off; - --- This is the actual test query. -select * FROM test_mat_small as t1 left outer join test_mat_large AS t2 on t1.i1=t2.i2; - --- Check that the Materialize node spilled to disk, to make sure we're testing spilling --- as intended. The inner side of the join with the Materialize will not get executed on --- segments that have no data for the outer side. Therefore, we expect the Materialize --- node to only be executed, and spilled, on as many segments as there nodes that hold --- data from test_mat_small. -select n - (select count (distinct gp_segment_id) from test_mat_small) as difference -from num_workfiles_created($$ - explain analyze - select * FROM test_mat_small as t1 left outer join test_mat_large AS t2 on t1.i1=t2.i2 -$$) as n; - --- Repeat, with a LIMIT. This causes the underlying scan to finish earlier. -select * FROM test_mat_small as t1 left outer join test_mat_large AS t2 on t1.i1=t2.i2 limit 10; -select n - (select count (distinct gp_segment_id) from test_mat_small) as difference -from num_workfiles_created($$ - explain analyze - select * FROM test_mat_small as t1 left outer join test_mat_large AS t2 on t1.i1=t2.i2 limit 10 -$$) as n; - -drop schema materialize_spill cascade; - --- start_ignore -RESET ROLE; -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_memory_sisc_mat_sort.sql b/src/test/isolation2/sql/resgroup/resgroup_memory_sisc_mat_sort.sql deleted file mode 100644 index 6e2e17f04bb..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_memory_sisc_mat_sort.sql +++ /dev/null @@ -1,101 +0,0 @@ --- start_matchsubs --- m/INSERT \d+/ --- s/INSERT \d+/INSERT/ --- end_matchsubs -create schema sisc_mat_sort; -set search_path to sisc_mat_sort; - --- start_ignore -create language plpythonu; --- end_ignore - --- set workfile is created to true if all segment did it. -create or replace function sisc_mat_sort.is_workfile_created(explain_query text) -returns setof int as -$$ -import re -query = "select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0;" -rv = plpy.execute(query) -nsegments = int(rv[0]['nsegments']) -rv = plpy.execute(explain_query) -search_text = 'Work_mem used' -result = [] -for i in range(len(rv)): - cur_line = rv[i]['QUERY PLAN'] - if search_text.lower() in cur_line.lower(): - p = re.compile('.+\((seg[\d]+).+ Workfile: \(([\d+]) spilling\)') - m = p.match(cur_line) - workfile_created = int(m.group(2)) - cur_row = int(workfile_created == nsegments) - result.append(cur_row) -return result -$$ -language plpythonu; - -create table testsiscm (i1 int, i2 int, i3 int, i4 int); -insert into testsiscm select i, i % 1000, i % 100000, i % 75 from - (select generate_series(1, nsegments * 150000) as i from - (select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0) foo) bar; - --- start_ignore -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore -CREATE RESOURCE GROUP rg1_memory_test WITH -(concurrency=2, cpu_rate_limit=10, memory_limit=30, memory_shared_quota=0, memory_spill_ratio=3); -CREATE ROLE role1_memory_test SUPERUSER RESOURCE GROUP rg1_memory_test; -SET ROLE TO role1_memory_test; - - -set gp_resgroup_print_operator_memory_limits=on; -set gp_cte_sharing=on; -set gp_enable_mk_sort=on; --- The expected output is very sensitive to the kind of plan this produces. --- We're testing the executor, not the planner, so force ORCA off, to get --- the particular plan -set optimizer=off; - -select count(*) from (with ctesisc as - (select count(i1) as c1, i2 as c2, i3 as c3 from testsiscm group by i2, i3) -select * -from ctesisc as t1, ctesisc as t2 -where t1.c1 = t2.c1 and t1.c3 = t2.c3) foo; -select * from sisc_mat_sort.is_workfile_created('explain analyze -with ctesisc as - (select count(i1) as c1, i2 as c2, i3 as c3 from testsiscm group by i2, i3) -select * -from ctesisc as t1, ctesisc as t2 -where t1.c1 = t2.c1 and t1.c3 = t2.c3;'); -select * from sisc_mat_sort.is_workfile_created('explain analyze -with ctesisc as - (select count(i1) as c1, i2 as c2, i3 as c3 from testsiscm group by i2, i3) -select * -from ctesisc as t1, ctesisc as t2 -where t1.c1 = t2.c1 and t1.c3 = t2.c3 limit 50000;'); - -set gp_enable_mk_sort=off; -select count(*) from (with ctesisc as - (select count(i1) as c1, i2 as c2, i3 as c3 from testsiscm group by i2, i3) -select * -from ctesisc as t1, ctesisc as t2 -where t1.c1 = t2.c1 and t1.c3 = t2.c3) foo; -select * from sisc_mat_sort.is_workfile_created('explain analyze -with ctesisc as - (select count(i1) as c1, i2 as c2, i3 as c3 from testsiscm group by i2, i3) -select * -from ctesisc as t1, ctesisc as t2 -where t1.c1 = t2.c1 and t1.c3 = t2.c3;'); -select * from sisc_mat_sort.is_workfile_created('explain analyze -with ctesisc as - (select count(i1) as c1, i2 as c2, i3 as c3 from testsiscm group by i2, i3) -select * -from ctesisc as t1, ctesisc as t2 -where t1.c1 = t2.c1 and t1.c3 = t2.c3 limit 50000;'); - -drop schema sisc_mat_sort cascade; - --- start_ignore -RESET ROLE; -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_memory_sisc_sort_spill.sql b/src/test/isolation2/sql/resgroup/resgroup_memory_sisc_sort_spill.sql deleted file mode 100644 index cc585c7b3f2..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_memory_sisc_sort_spill.sql +++ /dev/null @@ -1,105 +0,0 @@ --- start_matchsubs --- m/INSERT \d+/ --- s/INSERT \d+/INSERT/ --- end_matchsubs -create schema sisc_sort_spill; -set search_path to sisc_sort_spill; - --- start_ignore -create language plpythonu; --- end_ignore - --- set workfile is created to true if all segment did it. -create or replace function sisc_sort_spill.is_workfile_created(explain_query text) -returns setof int as -$$ -import re -query = "select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0;" -rv = plpy.execute(query) -nsegments = int(rv[0]['nsegments']) -rv = plpy.execute(explain_query) -search_text = 'Work_mem used' -result = [] -for i in range(len(rv)): - cur_line = rv[i]['QUERY PLAN'] - if search_text.lower() in cur_line.lower(): - p = re.compile('.+\((seg[\d]+).+ Workfile: \(([\d+]) spilling\)') - m = p.match(cur_line) - workfile_created = int(m.group(2)) - cur_row = int(workfile_created == nsegments) - result.append(cur_row) -return result -$$ -language plpythonu; - -create table testsisc (i1 int, i2 int, i3 int, i4 int); -insert into testsisc select i, i % 1000, i % 100000, i % 75 from - (select generate_series(1, nsegments * 50000) as i from - (select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0) foo) bar; - --- start_ignore -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore -CREATE RESOURCE GROUP rg1_memory_test WITH -(concurrency=2, cpu_rate_limit=10, memory_limit=30, memory_shared_quota=0, memory_spill_ratio=2); -CREATE ROLE role1_memory_test SUPERUSER RESOURCE GROUP rg1_memory_test; -SET ROLE TO role1_memory_test; - -set gp_resgroup_print_operator_memory_limits=on; -set gp_cte_sharing=on; --- ORCA optimizes away the ORDER BY in our test query, and therefore doesn't exercise --- a Sort that spills. -set optimizer=off; - -set gp_enable_mk_sort=on; -select avg(i3) from ( - with ctesisc as (select * from testsisc order by i2) - select t1.i3, t2.i2 - from ctesisc as t1, ctesisc as t2 - where t1.i1 = t2.i2 -) foo; - -select * from sisc_sort_spill.is_workfile_created('explain analyze - with ctesisc as (select * from testsisc order by i2) - select t1.i3, t2.i2 - from ctesisc as t1, ctesisc as t2 - where t1.i1 = t2.i2 -;'); -select * from sisc_sort_spill.is_workfile_created('explain analyze - with ctesisc as (select * from testsisc order by i2) - select t1.i3, t2.i2 - from ctesisc as t1, ctesisc as t2 - where t1.i1 = t2.i2 -limit 50000;'); - - -set gp_enable_mk_sort=off; -select avg(i3) from ( - with ctesisc as (select * from testsisc order by i2) - select t1.i3, t2.i2 - from ctesisc as t1, ctesisc as t2 - where t1.i1 = t2.i2 -) foo; - -select * from sisc_sort_spill.is_workfile_created('explain analyze - with ctesisc as (select * from testsisc order by i2) - select t1.i3, t2.i2 - from ctesisc as t1, ctesisc as t2 - where t1.i1 = t2.i2 -;'); - -select * from sisc_sort_spill.is_workfile_created('explain analyze - with ctesisc as (select * from testsisc order by i2) - select t1.i3, t2.i2 - from ctesisc as t1, ctesisc as t2 - where t1.i1 = t2.i2 -limit 50000;'); - -drop schema sisc_sort_spill cascade; - --- start_ignore -RESET ROLE; -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_memory_sort_spill.sql b/src/test/isolation2/sql/resgroup/resgroup_memory_sort_spill.sql deleted file mode 100644 index e8aa42be65d..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_memory_sort_spill.sql +++ /dev/null @@ -1,68 +0,0 @@ --- start_matchsubs --- m/INSERT \d+/ --- s/INSERT \d+/INSERT/ --- end_matchsubs -create schema sort_spill; -set search_path to sort_spill; - --- start_ignore -create language plpythonu; --- end_ignore - --- set workfile is created to true if all segment did it. -create or replace function sort_spill.is_workfile_created(explain_query text) -returns setof int as -$$ -import re -query = "select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0;" -rv = plpy.execute(query) -nsegments = int(rv[0]['nsegments']) -rv = plpy.execute(explain_query) -search_text = 'Work_mem used' -result = [] -for i in range(len(rv)): - cur_line = rv[i]['QUERY PLAN'] - if search_text.lower() in cur_line.lower(): - p = re.compile('.+\((seg[\d]+).+ Workfile: \(([\d+]) spilling\)') - m = p.match(cur_line) - workfile_created = int(m.group(2)) - cur_row = int(workfile_created == nsegments) - result.append(cur_row) -return result -$$ -language plpythonu; - - -create table testsort (i1 int, i2 int, i3 int, i4 int); -insert into testsort select i, i % 1000, i % 100000, i % 75 from - (select generate_series(1, nsegments * 50000) as i from - (select count(*) as nsegments from gp_segment_configuration where role='p' and content >= 0) foo) bar; - --- start_ignore -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore -CREATE RESOURCE GROUP rg1_memory_test WITH -(concurrency=2, cpu_rate_limit=10, memory_limit=30, memory_shared_quota=0, memory_spill_ratio=1); -CREATE ROLE role1_memory_test SUPERUSER RESOURCE GROUP rg1_memory_test; -SET ROLE TO role1_memory_test; - -set gp_resgroup_print_operator_memory_limits=on; - -set gp_enable_mk_sort=on; -select avg(i2) from (select i1,i2 from testsort order by i2) foo; -select * from sort_spill.is_workfile_created('explain analyze select i1,i2 from testsort order by i2;'); -select * from sort_spill.is_workfile_created('explain analyze select i1,i2 from testsort order by i2 limit 50000;'); - -set gp_enable_mk_sort=off; -select avg(i2) from (select i1,i2 from testsort order by i2) foo; -select * from sort_spill.is_workfile_created('explain analyze select i1,i2 from testsort order by i2;'); -select * from sort_spill.is_workfile_created('explain analyze select i1,i2 from testsort order by i2 limit 50000;'); - -drop schema sort_spill cascade; - --- start_ignore -RESET ROLE; -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_memory_spilltodisk.sql b/src/test/isolation2/sql/resgroup/resgroup_memory_spilltodisk.sql deleted file mode 100644 index eba39b45037..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_memory_spilltodisk.sql +++ /dev/null @@ -1,70 +0,0 @@ --- up the admin_group memory limits -ALTER RESOURCE GROUP admin_group SET memory_limit 30; - --- Test Mark/Restore in Material Node -create table spilltest1 (a integer); -create table spilltest2 (a integer); -insert into spilltest1 select a from generate_series(1,400000) a; -insert into spilltest2 select a from generate_series(1,400000) a; - --- go back to the default admin_group limit -ALTER RESOURCE GROUP admin_group SET memory_limit 10; - --- start_ignore -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore -CREATE RESOURCE GROUP rg1_memory_test WITH -(concurrency=2, cpu_rate_limit=10, memory_limit=60, memory_shared_quota=0, memory_spill_ratio=10); -CREATE ROLE role1_memory_test SUPERUSER RESOURCE GROUP rg1_memory_test; -SET ROLE TO role1_memory_test; - -set enable_hashagg=off; -set enable_mergejoin=on; -set enable_hashjoin=off; -set enable_nestloop=off; - -create temporary table spilltestresult1 as -select t1.a as t1a, t2.a as t2a -from (select a from spilltest1 group by a) t1, - (select a from spilltest2 group by a) t2 -where t1.a = t2.a; - --- check that the result looks sane -select count(*), sum(t1a), sum(t2a), sum(t1a - t2a) from spilltestresult1; - --- Test Hash Aggregation when the work mem is too small for the hash table -create table spilltest (a integer, b integer); -insert into spilltest select a, a%25 from generate_series(1,8000) a; -analyze; -set enable_hashagg=on; -set enable_groupagg=off; - -select b,count(*) from spilltest group by b order by b; - -select b,count(*) from spilltest group by b order by b; --- Test Hash Join when the work mem is too small for the hash table -drop table if exists spilltest; -create table spilltest (a integer, b integer); -insert into spilltest select a, a%25 from generate_series(1,800000) a; -analyze; -- We have to do an analyze to force a hash join -set enable_mergejoin=off; -set enable_nestloop=off; -set enable_hashjoin=on; - -create temporary table spilltestresult2 as -select t1.a as t1a, t1.b as t1b, t2.a as t2a, t2.b as t2b from spilltest t1, spilltest t2 where t1.a = t2.a; --- check that the result looks sane -select count(*), sum(t1a), sum(t2a), sum(t2a), sum(t2b), sum(t1a * t1b) from spilltestresult2; - -drop table spilltest1; -drop table spilltest2; -drop table spilltest; -drop table spilltestresult1; -drop table spilltestresult2; - --- start_ignore -RESET ROLE; -DROP ROLE IF EXISTS role1_memory_test; -DROP RESOURCE GROUP rg1_memory_test; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/resgroup_name_convention.sql b/src/test/isolation2/sql/resgroup/resgroup_name_convention.sql deleted file mode 100644 index 662128bad35..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_name_convention.sql +++ /dev/null @@ -1,219 +0,0 @@ --- --- Test the resource group name convention. --- --- Resource group names follow the general object name convention: --- https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS --- --- Besides that there are 3 reserved names: --- * default_group, admin_group: names of the 2 default resource groups; --- * none: a special name usually used in ALTER ROLE command to reset --- to the proper default resource group; --- --- This case is put under isolation2 dir as other resource group cases, --- although it does not require any extended feature of the isolation2 --- test framework. --- - --- --- setup --- - -CREATE OR REPLACE VIEW rg_name_view AS - SELECT S.rsgname, C.concurrency - FROM gp_toolkit.gp_resgroup_config C, gp_toolkit.gp_resgroup_status S - WHERE C.groupid = S.groupid - AND C.groupname != 'default_group' - AND C.groupname != 'admin_group' - ORDER BY C.groupid; - --- TODO: need to cleanup all existing resgroups - --- --- positive --- - --- by default resgroup names have the form of [_a-zA-Z][_a-zA-Z0-9]* -CREATE RESOURCE GROUP rgNameTest01 WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP rgNameTest01 SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP rgNameTest01; -CREATE RESOURCE GROUP __rg_name_test_01__ WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP __rg_name_test_01__ SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP __rg_name_test_01__; - --- min length is 1 character -CREATE RESOURCE GROUP Z WITH (cpu_rate_limit=10, memory_limit=10); -DROP RESOURCE GROUP Z; - --- max length is 63 characters -CREATE RESOURCE GROUP max012345678901234567890123456789012345678901234567890123456789 WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP max012345678901234567890123456789012345678901234567890123456789 SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP max012345678901234567890123456789012345678901234567890123456789; --- characters exceed the max length are ignored -CREATE RESOURCE GROUP max012345678901234567890123456789012345678901234567890123456789further WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP max012345678901234567890123456789012345678901234567890123456789are SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP max012345678901234567890123456789012345678901234567890123456789ignored; - --- special characters are allowed with double quotation marks --- white spaces -CREATE RESOURCE GROUP "newlines -s p a c e s -t a b s" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "newlines -s p a c e s -t a b s" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "newlines -s p a c e s -t a b s"; --- punctuations -CREATE RESOURCE GROUP "!#$%&`()*+,-./:;<=>?@[]^_{|}~" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "!#$%&`()*+,-./:;<=>?@[]^_{|}~" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "!#$%&`()*+,-./:;<=>?@[]^_{|}~"; --- quotation marks -CREATE RESOURCE GROUP "'' are 2 single quotation marks" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "'' are 2 single quotation marks" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "'' are 2 single quotation marks"; -CREATE RESOURCE GROUP """ is 1 double quotation mark" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP """ is 1 double quotation mark" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP """ is 1 double quotation mark"; - --- nothing special with leading character -CREATE RESOURCE GROUP "0 as prefix" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "0 as prefix" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "0 as prefix"; -CREATE RESOURCE GROUP " leading space" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP " leading space" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP " leading space"; - --- backslash is not used as the escape character -CREATE RESOURCE GROUP "\\ are two backslashes" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "\\ are two backslashes" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "\\ are two backslashes"; --- below are octal, hex and unicode representations of "rg1" -CREATE RESOURCE GROUP "\o162\o147\o61" WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP "\x72\x67\x31" WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP "\u0072\u0067\u0031" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "\o162\o147\o61" SET concurrency 2; -ALTER RESOURCE GROUP "\x72\x67\x31" SET concurrency 2; -ALTER RESOURCE GROUP "\u0072\u0067\u0031" SET concurrency 2; -SELECT * FROM rg_name_view; --- but as \o, \x and \u are not supported, --- so they are just 3 different names, --- none of them equals to "rg1". -DROP RESOURCE GROUP "rg1"; -DROP RESOURCE GROUP "\o162\o147\o61"; -DROP RESOURCE GROUP "\x72\x67\x31"; -DROP RESOURCE GROUP "\u0072\u0067\u0031"; - --- unicode escapes are supported -CREATE RESOURCE GROUP U&"\0441\043B\043E\043D" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP U&"\0441\043B\043E\043D" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP U&"\0441\043B\043E\043D"; --- unicode representation of "rg1" -CREATE RESOURCE GROUP U&"\0072\0067\0031" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "rg1" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "rg1"; - --- CJK characters are allowed with or without double quotation marks -CREATE RESOURCE GROUP 资源组 WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "资源组" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP 资源组; -CREATE RESOURCE GROUP リソース・グループ WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "リソース・グループ" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP リソース・グループ; -CREATE RESOURCE GROUP 자원그룹 WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "자원그룹" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP 자원그룹; - --- names are case sensitive, --- but are always converted to lower case unless around with quotation marks -CREATE RESOURCE GROUP "RG_NAME_TEST" WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP rg_Name_Test WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP "rg_name_test" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP Rg_NaMe_TeSt SET concurrency 2; -ALTER RESOURCE GROUP "RG_NAME_TEST" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "RG_NAME_TEST"; -DROP RESOURCE GROUP RG_nAME_tEST; - --- reserved names are all lower case: "default_group", "admin_group", "none", --- they can be used by users with at least one upper case character. -CREATE RESOURCE GROUP "None" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "None" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "None"; -CREATE RESOURCE GROUP "NONE" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "NONE" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "NONE"; -CREATE RESOURCE GROUP "DEFAULT_GROup" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "DEFAULT_GROup" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "DEFAULT_GROup"; -CREATE RESOURCE GROUP "ADMIN_GROUP" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "ADMIN_GROUP" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "ADMIN_GROUP"; - -CREATE RESOURCE GROUP "with" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "with" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "with"; -CREATE RESOURCE GROUP "WITH" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "WITH" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "WITH"; -CREATE RESOURCE GROUP "group" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "group" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "group"; -CREATE RESOURCE GROUP "create" WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP "create" SET concurrency 2; -SELECT * FROM rg_name_view; -DROP RESOURCE GROUP "create"; - --- --- negative --- - --- does not support single quotation marks around the name -CREATE RESOURCE GROUP 'must_fail' WITH (cpu_rate_limit=10, memory_limit=10); - --- does not support leading numbers -CREATE RESOURCE GROUP 0_must_fail WITH (cpu_rate_limit=10, memory_limit=10); - --- reserved names are not allowed even with double quotation marks -CREATE RESOURCE GROUP "default_group" WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP "admin_group" WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP "none" WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP default_group WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP admin_group WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP none WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP DEFAULT_GROUP WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP Admin_Group WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP NONE WITH (cpu_rate_limit=10, memory_limit=10); - --- keywords are not allowed without quotation marks -CREATE RESOURCE GROUP with WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP WITH WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP group WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP CREATE WITH (cpu_rate_limit=10, memory_limit=10); - --- min length is 1 character -CREATE RESOURCE GROUP "" WITH (cpu_rate_limit=10, memory_limit=10); - diff --git a/src/test/isolation2/sql/resgroup/resgroup_operator_memory.sql b/src/test/isolation2/sql/resgroup/resgroup_operator_memory.sql deleted file mode 100644 index 10cfad537ff..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_operator_memory.sql +++ /dev/null @@ -1,193 +0,0 @@ -SET optimizer TO off; - --- --- setup --- - ---start_ignore -DROP VIEW IF EXISTS many_ops; -DROP ROLE r1_opmem_test; -DROP RESOURCE GROUP rg1_opmem_test; -DROP RESOURCE GROUP rg2_opmem_test; -CREATE LANGUAGE plpythonu; ---end_ignore - --- a helper function to run query via SPI -CREATE OR REPLACE FUNCTION f1_opmem_test() RETURNS void AS $$ - plpy.execute("""select * from gp_dist_random('gp_id')""") -$$ LANGUAGE plpythonu; - --- this view contains many operators in the plan, which is used to trigger --- the issue. gp_toolkit.gp_resgroup_config is a large JOIN view of many --- relations, to prevent the source relations being optimized out from the plan --- we have to keep the columns provided by them in the target list, instead of --- composing a long SELECT c1,c2,... list we use SELECT * here, but we should --- not output the groupid as it changes each time. --- --- hashagg may not work with a small operator memory, so we use UNION ALL --- instead of UNION to prevent putting a hashagg on top of the append node, --- and we use a always-false WHERE condition to prevent too much output. -CREATE OR REPLACE VIEW many_ops AS - SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -UNION ALL SELECT * FROM gp_toolkit.gp_resgroup_config WHERE groupid=0 -; - --- we must ensure spill to be small enough but still > 0. --- - rg1's memory quota is 682 * 1% = 6; --- - per-xact quota is 6/3=2; --- - spill memory is 2 * 60% = 1; -CREATE RESOURCE GROUP rg1_opmem_test - WITH (cpu_rate_limit=10, memory_limit=1, memory_shared_quota=0, - concurrency=3, memory_spill_ratio=60); - -CREATE ROLE r1_opmem_test RESOURCE GROUP rg1_opmem_test; -GRANT ALL ON many_ops TO r1_opmem_test; - --- rg1 has very low per-xact memory quota, there will be no enough operator --- memory reserved, however in resource group mode we assign at least 100KB to --- each operator, no matter it is memory intensive or not. As long as there is --- enough shared memory the query should be executed successfully. - --- --- positive: there is enough global shared memory --- - -SET gp_resgroup_memory_policy TO none; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - -SET gp_resgroup_memory_policy TO eager_free; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - -SET gp_resgroup_memory_policy TO auto; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - --- --- negative: there is not enough shared memory --- - --- rg1 has no group level shared memory, and most memory are granted to rg2, --- there is only very little global shared memory due to integer rounding. -CREATE RESOURCE GROUP rg2_opmem_test - WITH (cpu_rate_limit=10, memory_limit=59); - --- this query can execute but will raise OOM error. - -SET gp_resgroup_memory_policy TO none; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - -SET gp_resgroup_memory_policy TO eager_free; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - -SET gp_resgroup_memory_policy TO auto; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - --- --- positive: there is enough group shared memory --- - -ALTER RESOURCE GROUP rg2_opmem_test SET memory_limit 40; -ALTER RESOURCE GROUP rg1_opmem_test SET memory_limit 20; -ALTER RESOURCE GROUP rg1_opmem_test SET memory_shared_quota 100; -ALTER RESOURCE GROUP rg1_opmem_test SET memory_spill_ratio 20; - -SET gp_resgroup_memory_policy TO none; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - -SET gp_resgroup_memory_policy TO eager_free; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - -SET gp_resgroup_memory_policy TO auto; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - --- --- positive: the spill memory is large enough, no adjustment is needed --- - -DROP RESOURCE GROUP rg2_opmem_test; -ALTER RESOURCE GROUP rg1_opmem_test SET memory_limit 40; -ALTER RESOURCE GROUP rg1_opmem_test SET memory_shared_quota 50; -ALTER RESOURCE GROUP rg1_opmem_test SET memory_spill_ratio 30; -ALTER RESOURCE GROUP rg1_opmem_test SET concurrency 1; - -SET gp_resgroup_memory_policy TO none; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - -SET gp_resgroup_memory_policy TO eager_free; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - -SET gp_resgroup_memory_policy TO auto; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -RESET role; - --- --- positive: when spill memory is zero, work memory is used --- - -ALTER RESOURCE GROUP rg1_opmem_test SET memory_spill_ratio 0; - -SET gp_resgroup_memory_policy TO none; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -SELECT f1_opmem_test(); -RESET role; - -SET gp_resgroup_memory_policy TO eager_free; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -SELECT f1_opmem_test(); -RESET role; - -SET gp_resgroup_memory_policy TO auto; -SET ROLE TO r1_opmem_test; -SELECT * FROM many_ops; -SELECT f1_opmem_test(); -RESET role; - --- --- cleanup --- - -DROP VIEW many_ops; -DROP ROLE r1_opmem_test; -DROP RESOURCE GROUP rg1_opmem_test; diff --git a/src/test/isolation2/sql/resgroup/resgroup_parallel_queries.sql b/src/test/isolation2/sql/resgroup/resgroup_parallel_queries.sql deleted file mode 100644 index 3f589517653..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_parallel_queries.sql +++ /dev/null @@ -1,286 +0,0 @@ --- start_matchsubs --- m/ERROR: tuple concurrently updated \(heapam\.c\:\d+\)/ --- s/\(heapam\.c:\d+\)// --- end_matchsubs -CREATE EXTENSION dblink; - --- This function execute commands N times. --- % in command will be replaced by number specified by range1 sequentially --- # in command will be replaced by number specified by range2 randomly --- range, eg: 1-10 --- Notice: now it only support SELECT statement return single integer -CREATE or replace FUNCTION exec_commands_n /*in func*/ - (dl_name text, command1 text, /*in func*/ - command2 text, command3 text, /*in func*/ - times integer, range1 text, range2 text, fail_on_error bool) /*in func*/ -RETURNS integer AS $$ /*in func*/ -DECLARE /*in func*/ - cmd text; /*in func*/ - res int; /*in func*/ - s_r1 int; /*in func*/ - e_r1 int; /*in func*/ - s_r2 int; /*in func*/ - e_r2 int; /*in func*/ -BEGIN /*in func*/ - s_r1 = 0; /*in func*/ - e_r1 = 0; /*in func*/ - s_r2 = 0; /*in func*/ - e_r2 = 0; /*in func*/ - IF length(range1) > 0 THEN /*in func*/ - select t[1]::int, t[2]::int into s_r1, e_r1 from regexp_split_to_array(range1, '-') t; /*in func*/ - END IF; /*in func*/ - IF length(range2) > 0 THEN /*in func*/ - select t[1]::int, t[2]::int into s_r2, e_r2 from regexp_split_to_array(range2, '-') t; /*in func*/ - END IF; /*in func*/ - FOR i IN 0..(times - 1) LOOP /*in func*/ - IF length(command1) > 0 THEN /*in func*/ - cmd = regexp_replace(command1, '%', (s_r1 + i % (e_r1 - s_r1 + 1))::text, 'g'); /*in func*/ - cmd = regexp_replace(cmd, '#', (s_r2 + ((random()*100)::int) % (e_r2 - s_r2 + 1))::text, 'g'); /*in func*/ - RAISE NOTICE '%', cmd; /*in func*/ - IF lower(cmd) like 'select %' THEN /*in func*/ - select * into res from dblink(dl_name, cmd, fail_on_error) t(c1 integer); /*in func*/ - ELSE /*in func*/ - perform dblink_exec(dl_name, cmd , fail_on_error); /*in func*/ - END IF; /*in func*/ - END IF; /*in func*/ - IF length(command2) > 0 THEN /*in func*/ - cmd = regexp_replace(command2, '%', (s_r1 + i % (e_r1 - s_r1 + 1))::text, 'g'); /*in func*/ - cmd = regexp_replace(cmd, '#', (s_r2 + ((random()*100)::int) % (e_r2 - s_r2 + 1))::text, 'g'); /*in func*/ - RAISE NOTICE '%', cmd; /*in func*/ - IF lower(cmd) like 'select %' THEN /*in func*/ - select * into res from dblink(dl_name, cmd, fail_on_error) t(c1 integer); /*in func*/ - ELSE /*in func*/ - perform dblink_exec(dl_name, cmd, fail_on_error); /*in func*/ - END IF; /*in func*/ - END IF; /*in func*/ - IF length(command3) > 0 THEN /*in func*/ - cmd = regexp_replace(command3, '%', (s_r1 + i % (e_r1 - s_r1 + 1))::text, 'g'); /*in func*/ - cmd = regexp_replace(cmd, '#', (s_r2 + ((random()*100)::int) % (e_r2 - s_r2 + 1))::text, 'g'); /*in func*/ - RAISE NOTICE '%', cmd; /*in func*/ - IF lower(cmd) like 'select %' THEN /*in func*/ - select * into res from dblink(dl_name, cmd, fail_on_error) t(c1 integer); /*in func*/ - ELSE /*in func*/ - perform dblink_exec(dl_name, cmd, fail_on_error); /*in func*/ - END IF; /*in func*/ - END IF; /*in func*/ - END LOOP; /*in func*/ - return times; /*in func*/ -END;$$ /*in func*/ -LANGUAGE 'plpgsql'; - --- --- DDLs vs DDLs --- -1:select dblink_connect('dblink_rg_test1', 'dbname=isolation2resgrouptest'); -2:select dblink_connect('dblink_rg_test2', 'dbname=isolation2resgrouptest'); -3:select dblink_connect('dblink_rg_test3', 'dbname=isolation2resgrouptest'); -4:select dblink_connect('dblink_rg_test4', 'dbname=isolation2resgrouptest'); -5:select dblink_connect('dblink_rg_test5', 'dbname=isolation2resgrouptest'); -6:select dblink_connect('dblink_rg_test6', 'dbname=isolation2resgrouptest'); - -1>:select exec_commands_n('dblink_rg_test1','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set concurrency #', 60, '', '1-6', false); -2>:select exec_commands_n('dblink_rg_test2','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set concurrency#', 60, '', '1-6', false); -3>:select exec_commands_n('dblink_rg_test3','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set cpu_rate_limit #', 60, '', '1-6', false); -4>:select exec_commands_n('dblink_rg_test4','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set memory_limit #', 60, '', '1-6', false); -5>:select exec_commands_n('dblink_rg_test5','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set memory_shared_quota #', 60, '', '1-6', false); -6>:select exec_commands_n('dblink_rg_test6','CREATE RESOURCE GROUP rg_test_g# WITH (concurrency=#, cpu_rate_limit=#, memory_limit=#)', 'DROP RESOURCE GROUP rg_test_g#', 'ALTER RESOURCE GROUP rg_test_g# set memory_limit #', 60, '', '1-6', false); - -1<: -2<: -3<: -4<: -5<: -6<: - -1: select dblink_disconnect('dblink_rg_test1'); -2: select dblink_disconnect('dblink_rg_test2'); -3: select dblink_disconnect('dblink_rg_test3'); -4: select dblink_disconnect('dblink_rg_test4'); -5: select dblink_disconnect('dblink_rg_test5'); -6: select dblink_disconnect('dblink_rg_test6'); - - -1q: -2q: -3q: -4q: -5q: -6q: --- --- DDLs vs DMLs --- --- Prepare resource groups and roles and tables -create table rg_test_foo as select i as c1, i as c2 from generate_series(1,1000) i; -create table rg_test_bar as select i as c1, i as c2 from generate_series(1,1000) i; -grant all on rg_test_foo to public; -grant all on rg_test_bar to public; - --- start_ignore -select dblink_connect('dblink_rg_test', 'dbname=isolation2resgrouptest'); -select exec_commands_n('dblink_rg_test','DROP ROLE rg_test_r%', '', '', 7, '1-7', '', false); -select exec_commands_n('dblink_rg_test','DROP RESOURCE GROUP rg_test_g%', '', '', 7, '1-7', '', false); --- end_ignore - --- create 6 roles and 6 resource groups -select exec_commands_n('dblink_rg_test','CREATE RESOURCE GROUP rg_test_g% WITH (concurrency=9, cpu_rate_limit=1, memory_limit=7)', '', '', 6, '1-6', '', true); -select exec_commands_n('dblink_rg_test','CREATE ROLE rg_test_r% login resource group rg_test_g%;', '', '', 6, '1-6', '', true); -select exec_commands_n('dblink_rg_test','GRANT ALL ON rg_test_foo to rg_test_r%;', '', '', 6, '1-6', '', true); -select exec_commands_n('dblink_rg_test','GRANT ALL ON rg_test_bar to rg_test_r%;', '', '', 6, '1-6', '', true); - -select dblink_disconnect('dblink_rg_test'); - -select groupname, concurrency, cpu_rate_limit from gp_toolkit.gp_resgroup_config where groupname like 'rg_test_g%' order by groupname; - --- --- 2* : DMLs --- --- start 6 session to concurrently change resource group and run simple queries randomly --- BEGIN/END -21: select dblink_connect('dblink_rg_test21', 'dbname=isolation2resgrouptest'); -21>: select exec_commands_n('dblink_rg_test21', 'set role rg_test_r#', 'BEGIN', 'END', 24000, '', '1-6', true); --- BEGIN/ABORT -22: select dblink_connect('dblink_rg_test22', 'dbname=isolation2resgrouptest'); -22>: select exec_commands_n('dblink_rg_test22', 'set role rg_test_r#', 'BEGIN', 'ABORT', 24000, '', '1-6', true); --- query with memory sensitive node -23: select dblink_connect('dblink_rg_test23', 'dbname=isolation2resgrouptest'); -23>: select exec_commands_n('dblink_rg_test23', 'set role rg_test_r#', 'insert into rg_test_foo values (#, #)', 'select count(*) from rg_test_bar t1, rg_test_foo t2 where t1.c2=t2.c2 group by t1.c2', 3000, '', '1-6', true); --- high cpu -24: select dblink_connect('dblink_rg_test24', 'dbname=isolation2resgrouptest'); -24>: select exec_commands_n('dblink_rg_test24', 'set role rg_test_r#', 'insert into rg_test_bar values (#, #)', 'select count(*) from rg_test_bar where c2! = 1000', 60, '', '1-6', true); --- simple select -25: select dblink_connect('dblink_rg_test25', 'dbname=isolation2resgrouptest'); -25>: select exec_commands_n('dblink_rg_test25', 'set role rg_test_r#', 'select count(*) from rg_test_foo', 'select count(*) from rg_test_bar', 6000, '', '1-6', true); --- vacuum -26: select dblink_connect('dblink_rg_test26', 'dbname=isolation2resgrouptest'); -26>: select exec_commands_n('dblink_rg_test26', 'set role rg_test_r#', 'vacuum rg_test_bar', 'vacuum rg_test_foo', 6000, '', '1-6', true); - --- --- 3* : Alter groups --- --- start a new session to alter concurrency randomly -31: select dblink_connect('dblink_rg_test31', 'dbname=isolation2resgrouptest'); -31>: select exec_commands_n('dblink_rg_test31', 'alter resource group rg_test_g% set concurrency #', 'select 1 from pg_sleep(0.1)', '', 1000, '1-6', '0-5', true); - --- start a new session to alter cpu_rate_limit randomly -32: select dblink_connect('dblink_rg_test32', 'dbname=isolation2resgrouptest'); -32>: select exec_commands_n('dblink_rg_test32', 'alter resource group rg_test_g% set cpu_rate_limit #', 'select 1 from pg_sleep(0.1)', '', 1000, '1-6', '1-6', true); - --- start a new session to alter memory_limit randomly -33: select dblink_connect('dblink_rg_test33', 'dbname=isolation2resgrouptest'); -33>: select exec_commands_n('dblink_rg_test33', 'alter resource group rg_test_g% set memory_limit #', 'select 1 from pg_sleep(0.1)', '', 1000, '1-6', '1-7', true); - --- start a new session to alter memory_shared_quota randomly -34: select dblink_connect('dblink_rg_test34', 'dbname=isolation2resgrouptest'); -34>: select exec_commands_n('dblink_rg_test34', 'alter resource group rg_test_g% set memory_shared_quota #', 'select 1 from pg_sleep(0.1)', '', 1000, '1-6', '1-80', true); - --- --- 4* : CREATE/DROP tables & groups --- --- start a new session to create and drop table, it will cause massive catchup interrupt. -41: select dblink_connect('dblink_rg_test41', 'dbname=isolation2resgrouptest'); -41>: select exec_commands_n('dblink_rg_test41', 'drop table if exists rg_test_t%', 'create table rg_test_t% (c1 int, c2 int)' ,'', 3000, '1-6', '', true); - --- start a new session to create & drop resource group -42: select dblink_connect('dblink_rg_test42', 'dbname=isolation2resgrouptest'); -42>: select exec_commands_n('dblink_rg_test42', 'create resource group rg_test_g7 with (cpu_rate_limit=1, memory_limit=1)', 'drop resource group rg_test_g7', '', 1000, '', '', true); - -31<: -31: select exec_commands_n('dblink_rg_test31', 'alter resource group rg_test_g% set concurrency #', 'select 1 from pg_sleep(0.1)', '', 6, '1-6', '1-5', true); - --- start a new session to acquire the status of resource groups -44: select dblink_connect('dblink_rg_test44', 'dbname=isolation2resgrouptest'); -44>: select exec_commands_n('dblink_rg_test44', 'select count(*) from gp_toolkit.gp_resgroup_status;', '', '', 100, '', '', true); - --- wait all sessions to finish -21<: -22<: -23<: -24<: -25<: -26<: -32<: -33<: -34<: -41<: -42<: -44<: - -21: select dblink_disconnect('dblink_rg_test21'); -22: select dblink_disconnect('dblink_rg_test22'); -23: select dblink_disconnect('dblink_rg_test23'); -24: select dblink_disconnect('dblink_rg_test24'); -25: select dblink_disconnect('dblink_rg_test25'); -26: select dblink_disconnect('dblink_rg_test26'); -31: select dblink_disconnect('dblink_rg_test31'); -32: select dblink_disconnect('dblink_rg_test32'); -33: select dblink_disconnect('dblink_rg_test33'); -34: select dblink_disconnect('dblink_rg_test34'); -41: select dblink_disconnect('dblink_rg_test41'); -42: select dblink_disconnect('dblink_rg_test42'); -44: select dblink_disconnect('dblink_rg_test44'); - -21q: -22q: -23q: -24q: -25q: -26q: -31q: -32q: -33q: -34q: -41q: -42q: - -select groupname, concurrency::int < 7, cpu_rate_limit::int < 7 from gp_toolkit.gp_resgroup_config where groupname like 'rg_test_g%' order by groupname; - --- Beacuse concurrency of each resource group is changed between 1..6, so the num_queued must be larger than 0 -select num_queued > 0 from gp_toolkit.gp_resgroup_status where rsgname like 'rg_test_g%' order by rsgname; - --- After all queries finished in each resource group, the memory_usage should be zero, no memory leak -with t_1 as -( - select rsgname, row_to_json(json_each(memory_usage::json)) as j from gp_toolkit.gp_resgroup_status where rsgname like 'rg_test_g%' order by rsgname -) -select rsgname, sum(((j->'value')->>'used')::int) from t_1 group by rsgname ; - --- start_ignore -drop table rg_test_foo; -drop table rg_test_bar; -select dblink_connect('dblink_rg_test', 'dbname=isolation2resgrouptest'); -select exec_commands_n('dblink_rg_test','DROP ROLE rg_test_r%', '', '', 6, '1-6', '', true); -select exec_commands_n('dblink_rg_test','DROP RESOURCE GROUP rg_test_g%', '', '', 6, '1-6', '', true); -select dblink_disconnect('dblink_rg_test'); --- end_ignore - --- --- 5*: Test connections in utility mode are not governed by resource group --- -create resource group rg_test_g8 with (concurrency= 1, cpu_rate_limit=1, memory_limit=1); -create role rg_test_r8 login resource group rg_test_g8; -51:select dblink_connect('dblink_rg_test51', 'dbname=isolation2resgrouptest user=rg_test_r8 options=''-c gp_session_role=utility'''); -52:select dblink_connect('dblink_rg_test52', 'dbname=isolation2resgrouptest user=rg_test_r8 options=''-c gp_session_role=utility'''); -53:select dblink_connect('dblink_rg_test53', 'dbname=isolation2resgrouptest user=rg_test_r8 options=''-c gp_session_role=utility'''); - -51>:select exec_commands_n('dblink_rg_test51', 'select 1', 'begin', 'end', 100, '', '', true); -51<: -52>:select exec_commands_n('dblink_rg_test52', 'select 1', 'select 1', 'select 1', 100, '', '', true); -52<: -53>:select exec_commands_n('dblink_rg_test53', 'select 1', 'begin', 'abort', 100, '', '', true); -53<: - -51: select dblink_disconnect('dblink_rg_test51'); -52: select dblink_disconnect('dblink_rg_test52'); -53: select dblink_disconnect('dblink_rg_test53'); - -51q: -52q: -53q: - --- num_executed and num_queued must be zero -select num_queued, num_executed from gp_toolkit.gp_resgroup_status where rsgname = 'rg_test_g8'; -drop role rg_test_r8; -drop resource group rg_test_g8; - --- clean up -select * from gp_toolkit.gp_resgroup_config; diff --git a/src/test/isolation2/sql/resgroup/resgroup_query_mem.sql b/src/test/isolation2/sql/resgroup/resgroup_query_mem.sql deleted file mode 100644 index 7a0fbdfe88a..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_query_mem.sql +++ /dev/null @@ -1,68 +0,0 @@ --- This test is to verify that query_mem is set correctly in QEs. --- Previously, resgroup does not consider that different number of --- segments among coordinator and segments. Now we let QEs to re-calculate --- query_mem in each segment locally. This test case use the following --- steps to verify the new method's correctness: --- 1. fetch available memory in coordinator and a single segment, --- compute the ratio --- 2. use fault inject and plpython invokes pygresql with notice, --- get a distributed plan's sort's operator memory in a QE --- 3. Get sort's operator memory in a pure QD's plan (catalog order by) --- 4. compute the ratio of two operator memorys --- 5. these two ratios should be the same. - -create extension if not exists gp_inject_fault; -create or replace language plpythonu; - -create table t_qmem(a int); -select gp_inject_fault('rg_qmem_qd_qe', 'skip', dbid) from gp_segment_configuration where role = 'p' and content = 0; - -create function rg_qmem_test() returns boolean as $$ -from pygresql.pg import DB -from copy import deepcopy -import re - -# 1: get resgroup available mem in QD and QE and compute ratio -sql = ("select memory_available m from " - "gp_toolkit.gp_resgroup_status_per_segment " - "where segment_id = %d and rsgname = 'admin_group'") -qd_mem = int(plpy.execute(sql % -1)[0]["m"]) -qe_mem = int(plpy.execute(sql % 0)[0]["m"]) -ratio1 = int(round(float(qd_mem) / qe_mem)) - -# 2. use notice to get qe operator mem -dbname = plpy.execute("select current_database() db")[0]["db"] -db = DB(dbname=dbname) -db.query("set gp_resource_group_enable_recalculate_query_mem = on;") - -sql = "select * from t_qmem order by 1" -db.query(sql) -qe_opmem_info = db.notices() -qe_opmem = int(re.findall(r"op_mem=(\d+)", qe_opmem_info[0])[0]) - -# 3. get qd operator mem -sql = "explain analyze select * from pg_class order by relpages limit 10" -db.query("set gp_resgroup_print_operator_memory_limits = on;") -r = db.query(sql).getresult() -for (line, ) in r: - if "-> Sort" not in line: continue - qd_opmem = int(re.findall(r"operatorMem: (\d+)", line)[0]) - break - -db.query("set gp_resource_group_enable_recalculate_query_mem = off;") - -db.close() - -ratio2 = int(round(float(qd_opmem) / qe_opmem)) - -return ratio1 == ratio2 - -$$ language plpythonu; - -select rg_qmem_test(); -select gp_inject_fault('rg_qmem_qd_qe', 'reset', dbid) from gp_segment_configuration where role = 'p' and content = 0; -drop function rg_qmem_test(); -drop table t_qmem; - -set gp_resource_group_enable_recalculate_query_mem = off; - diff --git a/src/test/isolation2/sql/resgroup/resgroup_recreate.sql b/src/test/isolation2/sql/resgroup/resgroup_recreate.sql deleted file mode 100644 index d49bbd3025b..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_recreate.sql +++ /dev/null @@ -1,24 +0,0 @@ --- start_ignore -DROP ROLE IF EXISTS r1; -DROP RESOURCE GROUP rg1; --- end_ignore - -CREATE RESOURCE GROUP rg1 WITH (concurrency=2, cpu_rate_limit=10, - memory_limit=50, memory_shared_quota=0); -CREATE ROLE r1 RESOURCE GROUP rg1; - -1: SET ROLE r1; -1: BEGIN; -1: END; - -ALTER ROLE r1 RESOURCE GROUP none; -DROP RESOURCE GROUP rg1; -CREATE RESOURCE GROUP rg1 WITH (concurrency=2, cpu_rate_limit=10, - memory_limit=50, memory_shared_quota=0); -ALTER ROLE r1 RESOURCE GROUP rg1; - -1: BEGIN; -1: END; - -DROP ROLE r1; -DROP RESOURCE GROUP rg1; diff --git a/src/test/isolation2/sql/resgroup/resgroup_seg_down_2pc.sql b/src/test/isolation2/sql/resgroup/resgroup_seg_down_2pc.sql deleted file mode 100644 index c9673eb95b9..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_seg_down_2pc.sql +++ /dev/null @@ -1,58 +0,0 @@ --- This test performs segment reconfiguration when "alter resource group" is executed in the two phase commit. --- The steps are, when run "alter resource group", before QD broadcasts commit prepared command to QEs(the --- second phase of 2PC), we trigger an error and cause one primary segment down. --- The expectation is "alter resource group" can run successfully since the mirror segment is UP. --- After recover the segment, there is no error or blocking. - -include: helpers/server_helpers.sql; - -create extension if not exists gp_inject_fault; - --- set these values purely to cut down test time, as default fts trigger is --- every min and 5 retries -alter system set gp_fts_probe_interval to 10; -alter system set gp_fts_probe_retries to 0; -select pg_reload_conf(); - -1:create resource group rgroup_seg_down with (CPU_RATE_LIMIT=35, MEMORY_LIMIT=35, CONCURRENCY=10); - --- inject an error in function dtm_broadcast_commit_prepared, that is before QD broadcasts commit prepared command to QEs -2:select gp_inject_fault_infinite('dtm_broadcast_commit_prepared', 'suspend', dbid) from gp_segment_configuration where role='p' and content=-1; --- this session will pend here since the above injected fault -1&:alter resource group rgroup_seg_down set CONCURRENCY 20; --- this injected fault can make dispatcher think the primary is down -2:select gp_inject_fault('fts_conn_startup_packet', 'error', dbid) from gp_segment_configuration where role='p' and content=0; -2:select gp_request_fts_probe_scan(); --- make sure one primary segment is down. -2:select status = 'd' from gp_segment_configuration where content = 0 and role = 'm'; --- reset the injected fault on QD and the "alter resource group" in session1 can continue -2:select gp_inject_fault('dtm_broadcast_commit_prepared', 'reset', dbid) from gp_segment_configuration where role='p' and content=-1; --- No need to reset fts_conn_startup_packet fault inject because the segment we have set --- is down now, and later we will full recover it back with new init clean shared memory. -1<: --- make sure "alter resource group" has taken effect. -1:select concurrency from gp_toolkit.gp_resgroup_config where groupname = 'rgroup_seg_down'; -2q: - -!\retcode gprecoverseg -aF --no-progress; - --- loop while segments come in sync -1:select wait_until_all_segments_synchronized(); - -!\retcode gprecoverseg -ar; - --- loop while segments come in sync -1:select wait_until_all_segments_synchronized(); - --- verify no segment is down after recovery -1:select count(*) from gp_segment_configuration where status = 'd'; - --- verify resource group -1:select concurrency from gp_toolkit.gp_resgroup_config where groupname = 'rgroup_seg_down'; -1:drop resource group rgroup_seg_down; - -1:alter system reset gp_fts_probe_interval; -1:alter system reset gp_fts_probe_retries; -1:select pg_reload_conf(); -1q: - diff --git a/src/test/isolation2/sql/resgroup/resgroup_set_memory_spill_ratio.sql b/src/test/isolation2/sql/resgroup/resgroup_set_memory_spill_ratio.sql deleted file mode 100644 index c29bbde7a0e..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_set_memory_spill_ratio.sql +++ /dev/null @@ -1,83 +0,0 @@ --- This query must be the first one in this case. --- SHOW command will be bypassed in resgroup, when it's the first command --- in a connection it needs special handling to show memory_spill_ratio --- correctly. Verify that it shows the correct value 10 instead of default 20. -SHOW memory_spill_ratio; - ---start_ignore -DROP ROLE role1_spill_test; -DROP ROLE role2_spill_test; -DROP RESOURCE GROUP rg1_spill_test; -DROP RESOURCE GROUP rg2_spill_test; ---end_ignore - -CREATE RESOURCE GROUP rg1_spill_test WITH - (CONCURRENCY=10, MEMORY_LIMIT=10, CPU_RATE_LIMIT=10, memory_shared_quota=20, memory_spill_ratio=30); -CREATE RESOURCE GROUP rg2_spill_test WITH - (CONCURRENCY=10, MEMORY_LIMIT=10, CPU_RATE_LIMIT=10, memory_shared_quota=50, memory_spill_ratio=10); -CREATE ROLE role1_spill_test RESOURCE GROUP rg1_spill_test; -CREATE ROLE role2_spill_test RESOURCE GROUP rg2_spill_test; - --- positive set to resource group level ---start_ignore -SET ROLE role1_spill_test; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; ---end_ignore - --- positive set to session level -SET MEMORY_SPILL_RATIO TO 70; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- positive fallback to statement_mem at session level -SET MEMORY_SPILL_RATIO TO 0; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- negative set to session level -SET MEMORY_SPILL_RATIO TO 101; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- positive set to session level -SET MEMORY_SPILL_RATIO TO 90; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- positive set to session level -SET MEMORY_SPILL_RATIO TO 20; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- reset to resource group level -RESET MEMORY_SPILL_RATIO; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- positive set to session level -SET MEMORY_SPILL_RATIO TO 60; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- change role, positive for session level -SET ROLE role2_spill_test; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- positive set to session level -SET MEMORY_SPILL_RATIO TO 20; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- reset to resource group level -RESET MEMORY_SPILL_RATIO; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - --- cleanup -RESET ROLE; -DROP ROLE role1_spill_test; -DROP ROLE role2_spill_test; -DROP RESOURCE GROUP rg1_spill_test; -DROP RESOURCE GROUP rg2_spill_test; diff --git a/src/test/isolation2/sql/resgroup/resgroup_syntax.sql b/src/test/isolation2/sql/resgroup/resgroup_syntax.sql deleted file mode 100644 index bf0937b8663..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_syntax.sql +++ /dev/null @@ -1,336 +0,0 @@ --- ---------------------------------------------------------------------- --- Test: assign/alter a role to a resource group --- ---------------------------------------------------------------------- - -DROP ROLE IF EXISTS rg_test_role; - --- positive -CREATE ROLE rg_test_role; -SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; -CREATE ROLE rg_test_role_super SUPERUSER; -SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; -ALTER ROLE rg_test_role_super NOSUPERUSER; -SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; -ALTER ROLE rg_test_role_super SUPERUSER; -SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; - -ALTER ROLE rg_test_role RESOURCE GROUP none; -SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; -ALTER ROLE rg_test_role_super RESOURCE GROUP none; -SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; - -ALTER ROLE rg_test_role RESOURCE GROUP default_group; -SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role'; -ALTER ROLE rg_test_role_super RESOURCE GROUP admin_group; -SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super'; - - --- negative -ALTER ROLE rg_test_role RESOURCE GROUP non_exist_group; -ALTER ROLE rg_test_role RESOURCE GROUP admin_group; - -CREATE ROLE rg_test_role1 RESOURCE GROUP non_exist_group; --- nonsuper user should not be assigned to admin group -CREATE ROLE rg_test_role1 RESOURCE GROUP admin_group; - --- cleanup -DROP ROLE rg_test_role; -DROP ROLE rg_test_role_super; - --- ---------------------------------------------------------------------- --- Test: create/drop a resource group --- ---------------------------------------------------------------------- - ---start_ignore -DROP RESOURCE GROUP rg_test_group; ---end_ignore - -SELECT * FROM gp_toolkit.gp_resgroup_config; - --- negative - --- can't create the reserved resource groups -CREATE RESOURCE GROUP default_group WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP admin_group WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP none WITH (cpu_rate_limit=10, memory_limit=10); --- multiple resource groups can't share the same name -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10); -DROP RESOURCE GROUP rg_test_group; --- must specify cpu_rate_limit or cpuset -CREATE RESOURCE GROUP rg_test_group WITH (memory_limit=10); --- 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); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5, cpu_rate_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5, memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5, memory_shared_quota=70, memory_shared_quota=80); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0', cpuset='0', memory_limit=5); --- 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); --- can't specify invalid cpuset -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset=',', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='-', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='a', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='12a', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0-,', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='-1', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='3-1', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset=' 0 ', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='4;a', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='-;4', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset=';5', memory_limit=5); -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='5;', memory_limit=5); - ----- suppose the core numbered 1024 is not exist -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='1024', memory_limit=5); -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); --- can't alter to invalid cpuset -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0', memory_limit=5); -ALTER RESOURCE GROUP rg_test_group set CPUSET ''; -ALTER RESOURCE GROUP rg_test_group set CPUSET ','; -ALTER RESOURCE GROUP rg_test_group set CPUSET '-'; -ALTER RESOURCE GROUP rg_test_group set CPUSET 'a'; -ALTER RESOURCE GROUP rg_test_group set CPUSET '12a'; -ALTER RESOURCE GROUP rg_test_group set CPUSET '0-'; -ALTER RESOURCE GROUP rg_test_group set CPUSET '-1'; -ALTER RESOURCE GROUP rg_test_group set CPUSET '3-1'; -ALTER RESOURCE GROUP rg_test_group set CPUSET ' 0 '; -ALTER RESOURCE GROUP rg_test_group set CPUSET '4;a'; -ALTER RESOURCE GROUP rg_test_group set CPUSET '-;4'; -ALTER RESOURCE GROUP rg_test_group set CPUSET ';5'; -ALTER RESOURCE GROUP rg_test_group set CPUSET '5;'; -ALTER RESOURCE GROUP rg_test_group set CPUSET ';'; -ALTER RESOURCE GROUP rg_test_group set CPUSET '1;2;'; -ALTER RESOURCE GROUP rg_test_group set CPUSET '1;2;3'; ----- suppose the core numbered 1024 is not exist -ALTER RESOURCE GROUP rg_test_group set CPUSET '1024'; -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,'; -DROP RESOURCE GROUP rg_test_group; --- can't drop non-exist resource group -DROP RESOURCE GROUP non_exist_group; --- can't drop reserved resource groups -DROP RESOURCE GROUP default_group; -DROP RESOURCE GROUP admin_group; -DROP RESOURCE GROUP none; - --- positive -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10); -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'; -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpuset='0', memory_limit=10, memory_shared_quota=70, memory_spill_ratio=30); -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'; -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10); -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'; -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0'); -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'; -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpuset='0;0-1'); -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'; -DROP RESOURCE GROUP rg_test_group; --- ---------------------------------------------------------------------- --- 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 RESOURCE GROUP rg_test_group2 WITH (cpu_rate_limit=60, memory_limit=10); -CREATE RESOURCE GROUP rg_test_group3 WITH (cpu_rate_limit=1, memory_limit=10); -DROP RESOURCE GROUP rg_test_group1; -DROP RESOURCE GROUP rg_test_group2; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=61, memory_limit=10); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=91); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=0, memory_limit=10); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=-1); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=0.9); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=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); -CREATE RESOURCE GROUP rg_test_group WITH (concurrency=26, cpu_rate_limit=10, memory_limit=10); --- 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"); --- 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"); --- negative: the cores of cpuset in different groups mustn't overlap -CREATE RESOURCE GROUP rg_test_group1 WITH (cpuset='0', memory_limit=10); -CREATE RESOURCE GROUP rg_test_group2 WITH (cpuset='0', memory_limit=10); -DROP RESOURCE GROUP rg_test_group1; - --- 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); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=50, memory_spill_ratio=51); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=10, memory_spill_ratio=-1); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=-1, memory_spill_ratio=10); - --- 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); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=60); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=1, memory_limit=10); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=1); -DROP RESOURCE GROUP rg_test_group; --- positive: concurrency should be in [0, max_connections] -CREATE RESOURCE GROUP rg_test_group WITH (concurrency=0, cpu_rate_limit=10, memory_limit=10); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=10, memory_limit=10); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (concurrency=25, cpu_rate_limit=10, memory_limit=10); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg1_test_group WITH (concurrency=1, cpu_rate_limit=10, memory_limit=10); -CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=50, memory_limit=50); -DROP RESOURCE GROUP rg1_test_group; -DROP RESOURCE GROUP rg2_test_group; -CREATE RESOURCE GROUP rg1_test_group WITH (concurrency=1, cpu_rate_limit=20, memory_limit=20); -CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=40, memory_limit=40); -DROP RESOURCE GROUP rg1_test_group; -DROP RESOURCE GROUP rg2_test_group; -CREATE RESOURCE GROUP rg1_test_group WITH (concurrency=1, cpu_rate_limit=30, memory_limit=30); -CREATE RESOURCE GROUP rg2_test_group WITH (concurrency=1, cpu_rate_limit=30, memory_limit=30); -DROP RESOURCE GROUP rg1_test_group; -DROP RESOURCE GROUP rg2_test_group; --- 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"); -DROP RESOURCE GROUP rg_test_group; - --- 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); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=50, memory_spill_ratio=50); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=0, memory_spill_ratio=100); -DROP RESOURCE GROUP rg_test_group; -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=99, memory_spill_ratio=1); -DROP RESOURCE GROUP rg_test_group; - --- 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); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio=101); - --- 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'); -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_spill_ratio='10'); - --- 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); - --- 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); - --- positive -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=0, memory_spill_ratio=0); -DROP RESOURCE GROUP rg_test_group; - --- ---------------------------------------------------------------------- --- Test: alter a resource group --- ---------------------------------------------------------------------- -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); - --- ALTER RESOURCE GROUP SET CONCURRENCY N --- negative: concurrency should be in [1, max_connections] -ALTER RESOURCE GROUP admin_group SET CONCURRENCY 0; -ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -1; -ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 26; -ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY -0.5; -ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 0.5; -ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY a; -ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 'abc'; -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 RESOURCE GROUP rg_test_group SET CONCURRENCY 1; -ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 2; -ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 25; - --- 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; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT -1; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 0; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 0.7; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 1.7; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 61; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT a; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 'abc'; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 20%; -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 RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 2; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 60; -DROP RESOURCE GROUP rg_test_group; --- 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 RESOURCE GROUP rg2_test_group WITH (cpu_rate_limit=10, memory_limit=10); -ALTER RESOURCE GROUP rg1_test_group SET CPU_RATE_LIMIT 50; -ALTER RESOURCE GROUP rg1_test_group SET CPU_RATE_LIMIT 40; -ALTER RESOURCE GROUP rg2_test_group SET CPU_RATE_LIMIT 20; -ALTER RESOURCE GROUP rg1_test_group SET CPU_RATE_LIMIT 30; -ALTER RESOURCE GROUP rg2_test_group SET CPU_RATE_LIMIT 30; -DROP RESOURCE GROUP rg1_test_group; -DROP RESOURCE GROUP rg2_test_group; --- 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); -ALTER RESOURCE GROUP rg_test_group SET CPUSET '0'; -SELECT groupname,cpu_rate_limit,memory_limit,cpuset FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; -ALTER RESOURCE GROUP rg_test_group SET CPU_RATE_LIMIT 10; -SELECT groupname,cpu_rate_limit,memory_limit,cpuset FROM gp_toolkit.gp_resgroup_config WHERE groupname='rg_test_group'; -DROP RESOURCE GROUP rg_test_group; - -CREATE RESOURCE GROUP cgroup_audited_group WITH (concurrency=0, cpu_rate_limit=10, memory_limit=10, memory_auditor="cgroup"); --- negative: memory_auditor cannot be altered -ALTER RESOURCE GROUP cgroup_audited_group SET MEMORY_AUDITOR "default"; --- negative: concurrency should be zero for cgroup audited resource group -ALTER RESOURCE GROUP cgroup_audited_group SET CONCURRENCY 10; --- negative: role should not be assigned to a cgroup audited resource group -CREATE ROLE cgroup_audited_role RESOURCE GROUP cgroup_audited_group; -DROP RESOURCE GROUP cgroup_audited_group; - --- 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); -ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10; -DROP RESOURCE GROUP rg_test_group; - --- 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); -ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio '10'; -ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10.5; -DROP RESOURCE GROUP rg_test_group; - --- 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); -ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio -1; -ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 101; -DROP RESOURCE GROUP rg_test_group; - --- 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); -ALTER RESOURCE GROUP rg_test_group SET memory_limit 0; -DROP RESOURCE GROUP rg_test_group; - --- 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); -ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10; -DROP RESOURCE GROUP rg_test_group; - --- 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); -ALTER RESOURCE GROUP rg_test_group SET memory_spill_ratio 10; -DROP RESOURCE GROUP rg_test_group; - --- 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); -ALTER RESOURCE GROUP rg_test_group SET memory_limit 0; -DROP RESOURCE GROUP rg_test_group; diff --git a/src/test/isolation2/sql/resgroup/resgroup_transaction.sql b/src/test/isolation2/sql/resgroup/resgroup_transaction.sql deleted file mode 100644 index d805ca3bc79..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_transaction.sql +++ /dev/null @@ -1,136 +0,0 @@ --- ---------------------------------------------------------------------- --- Test: manage resource group in transaction --- ---------------------------------------------------------------------- - ---start_ignore -DROP RESOURCE GROUP rg_test_group; ---end_ignore - --- helper view to check the resgroup status -CREATE OR REPLACE VIEW rg_test_monitor AS - SELECT groupname, concurrency, cpu_rate_limit - FROM gp_toolkit.gp_resgroup_config - WHERE groupname='rg_test_group'; - --- ---------------------------------------------------------------------- --- Test: create/alter/drop a resource group in transaction block --- ---------------------------------------------------------------------- - --- CREATE RESOURCE GROUP cannot run inside a transaction block -BEGIN; - CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); -END; -SELECT * FROM rg_test_monitor; - --- ALTER RESOURCE GROUP cannot run inside a transaction block -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); -BEGIN; - ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 10; -END; -SELECT * FROM rg_test_monitor; - --- DROP RESOURCE GROUP cannot run inside a transaction block -BEGIN; - DROP RESOURCE GROUP rg_test_group; -END; -SELECT * FROM rg_test_monitor; - -DROP RESOURCE GROUP rg_test_group; - - --- ---------------------------------------------------------------------- --- Test: create/alter/drop a resource group and DML in transaction block --- ---------------------------------------------------------------------- - --- CREATE RESOURCE GROUP cannot run inside a transaction block -BEGIN; - SELECT 1; - CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); -END; -SELECT * FROM rg_test_monitor; - --- ALTER RESOURCE GROUP cannot run inside a transaction block -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); -BEGIN; - SELECT 1; - ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 10; -END; -SELECT * FROM rg_test_monitor; - --- DROP RESOURCE GROUP cannot run inside a transaction block -BEGIN; - SELECT 1; - DROP RESOURCE GROUP rg_test_group; -END; -SELECT * FROM rg_test_monitor; - -DROP RESOURCE GROUP rg_test_group; - - --- ---------------------------------------------------------------------- --- Test: create/alter/drop a resource group in subtransaction --- ---------------------------------------------------------------------- - --- CREATE RESOURCE GROUP cannot run inside a subtransaction -BEGIN; - SAVEPOINT rg_savepoint; - CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); - ROLLBACK TO SAVEPOINT rg_savepoint; -ABORT; -SELECT * FROM rg_test_monitor; - --- ALTER RESOURCE GROUP cannot run inside a subtransaction -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); -BEGIN; - SAVEPOINT rg_savepoint; - ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 10; - ROLLBACK TO SAVEPOINT rg_savepoint; -ABORT; -SELECT * FROM rg_test_monitor; - --- DROP RESOURCE GROUP cannot run inside a subtransaction -BEGIN; - SAVEPOINT rg_savepoint; - DROP RESOURCE GROUP rg_test_group; - ROLLBACK TO SAVEPOINT rg_savepoint; -ABORT; -SELECT * FROM rg_test_monitor; - -DROP RESOURCE GROUP rg_test_group; - --- ---------------------------------------------------------------------- --- Test: create/alter/drop a resource group in function call --- ---------------------------------------------------------------------- - -CREATE OR REPLACE FUNCTION rg_create_func() RETURNS VOID -AS $$ CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5) $$ -LANGUAGE SQL; - -CREATE OR REPLACE FUNCTION rg_alter_func() RETURNS VOID -AS $$ ALTER RESOURCE GROUP rg_test_group SET CONCURRENCY 10 $$ -LANGUAGE SQL; - -CREATE OR REPLACE FUNCTION rg_drop_func() RETURNS VOID -AS $$ DROP RESOURCE GROUP rg_test_group $$ -LANGUAGE SQL; - --- CREATE RESOURCE GROUP cannot run inside a function call -SELECT * FROM rg_create_func(); -SELECT * FROM rg_test_monitor; - --- ALTER RESOURCE GROUP cannot run inside a function call -CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=5, memory_limit=5); -SELECT * FROM rg_alter_func(); -SELECT * FROM rg_test_monitor; - --- DROP RESOURCE GROUP cannot run inside a function call -SELECT * FROM rg_drop_func(); -SELECT * FROM rg_test_monitor; - -DROP RESOURCE GROUP rg_test_group; -DROP FUNCTION rg_create_func(); -DROP FUNCTION rg_alter_func(); -DROP FUNCTION rg_drop_func(); - --- cleanup -DROP VIEW rg_test_monitor; diff --git a/src/test/isolation2/sql/resgroup/resgroup_unassign_entrydb.sql b/src/test/isolation2/sql/resgroup/resgroup_unassign_entrydb.sql deleted file mode 100644 index 69516f7469d..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_unassign_entrydb.sql +++ /dev/null @@ -1,50 +0,0 @@ --- Testing when we terminate a query involves entrydb, UnassignResGroup() would --- be called on both QD and entrydb process. If that function finishes calling --- on QD before entrydb calling, a bug could previously be triggered that leads --- to data corruption. This test verifies this. - --- start_ignore -DROP ROLE IF EXISTS role_test; -DROP RESOURCE GROUP rg_test; --- end_ignore - -CREATE RESOURCE GROUP rg_test WITH (concurrency=2, cpu_rate_limit=10, memory_limit=10); -CREATE ROLE role_test RESOURCE GROUP rg_test; - --- By pass this session, else this affects the testing session, i.e. 1: -SET gp_resource_group_bypass = true; - -1: SET ROLE role_test; - -SELECT gp_inject_fault('unassign_resgroup_end_qd', 'reset', 1); -SELECT gp_inject_fault('unassign_resgroup_start_entrydb', 'reset', 1); - -SELECT gp_inject_fault('unassign_resgroup_end_qd', 'suspend', 1); -SELECT gp_inject_fault('unassign_resgroup_start_entrydb', 'suspend', 1); - --- A query invovles entrydb. -1&: SELECT * from gp_dist_random('gp_id'), pg_sleep(15); - -SELECT pg_terminate_backend(pid) - FROM pg_stat_activity WHERE query LIKE - 'SELECT * from gp_dist_random%' - ORDER BY xact_start LIMIT 1; - --- Make sure entry db starts calling UnassignResGroup() after QD --- finishes calling UnassignResGroup(). -SELECT gp_wait_until_triggered_fault('unassign_resgroup_end_qd', 1, 1); -SELECT gp_inject_fault('unassign_resgroup_start_entrydb', 'resume', 1); - -SELECT gp_inject_fault('unassign_resgroup_end_qd', 'reset', 1); -SELECT gp_inject_fault('unassign_resgroup_start_entrydb', 'reset', 1); - -1<: - --- Verify the system is ok with entrydb. -2: SET ROLE role_test; -2: SELECT * from gp_dist_random('gp_id'), pg_sleep(0.1) LIMIT 1; -2q: - --- Clean up -DROP ROLE role_test; -DROP RESOURCE GROUP rg_test; diff --git a/src/test/isolation2/sql/resgroup/resgroup_unlimit_memory_spill_ratio.sql b/src/test/isolation2/sql/resgroup/resgroup_unlimit_memory_spill_ratio.sql deleted file mode 100644 index 683bfc0680f..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_unlimit_memory_spill_ratio.sql +++ /dev/null @@ -1,85 +0,0 @@ --- start_ignore -DROP RESOURCE GROUP rg_spill_test; --- end_ignore - --- create -CREATE RESOURCE GROUP rg_spill_test WITH -(concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=60); -DROP RESOURCE GROUP rg_spill_test; - -CREATE RESOURCE GROUP rg_spill_test WITH -(concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=0); -DROP RESOURCE GROUP rg_spill_test; - -CREATE RESOURCE GROUP rg_spill_test WITH -(concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=100); -DROP RESOURCE GROUP rg_spill_test; - -CREATE RESOURCE GROUP rg_spill_test WITH -(concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=-1); -DROP RESOURCE GROUP rg_spill_test; - -CREATE RESOURCE GROUP rg_spill_test WITH -(concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=101); -DROP RESOURCE GROUP rg_spill_test; - --- alter -CREATE RESOURCE GROUP rg_spill_test WITH -(concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=20); - -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 60; -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 0; -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 100; -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO -1; -ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 101; - -DROP RESOURCE GROUP rg_spill_test; - --- set GUC -CREATE RESOURCE GROUP rg_spill_test WITH -(concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=20); - -SET MEMORY_SPILL_RATIO TO 60; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - -SET MEMORY_SPILL_RATIO TO 0; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - -SET MEMORY_SPILL_RATIO TO 100; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - -SET MEMORY_SPILL_RATIO TO -1; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - -SET MEMORY_SPILL_RATIO TO 101; -SHOW MEMORY_SPILL_RATIO; -SELECT 1; - -DROP RESOURCE GROUP rg_spill_test; - --- test case for query_mem=0 -CREATE TABLE test_zero_workmem(c int); - ---This test intends to build a situation that query_mem = 0 ---and verify under such condition work_mem will be used. -CREATE RESOURCE GROUP rg_zero_workmem WITH -(concurrency=2, cpu_rate_limit=10, memory_limit=20, memory_shared_quota=20, memory_spill_ratio=0); - -CREATE ROLE role_zero_workmem SUPERUSER RESOURCE GROUP rg_zero_workmem; -SET ROLE TO role_zero_workmem; - ---test query that will use spi -ANALYZE test_zero_workmem; - ---test normal DML -SELECT count(*) FROM test_zero_workmem; - ---clean env -RESET ROLE; -DROP TABLE test_zero_workmem; -DROP ROLE role_zero_workmem; -DROP RESOURCE GROUP rg_zero_workmem; diff --git a/src/test/isolation2/sql/resgroup/resgroup_views.sql b/src/test/isolation2/sql/resgroup/resgroup_views.sql deleted file mode 100644 index 15cdb09948f..00000000000 --- a/src/test/isolation2/sql/resgroup/resgroup_views.sql +++ /dev/null @@ -1,45 +0,0 @@ -select * - from gp_toolkit.gp_resgroup_config - where groupname='default_group'; - -select rsgname - , groupid - , num_running - , num_queueing - , num_queued - , num_executed - , cpu_usage->'-1' as qd_cpu_usage - , memory_usage->'-1'->'used' as qd_memory_used - , memory_usage->'-1'->'shared_used' as qd_memory_shared_used - from gp_toolkit.gp_resgroup_status - where rsgname='default_group'; - -select rsgname - , groupid - , cpu - , memory_used - , memory_shared_used - from gp_toolkit.gp_resgroup_status_per_host s - join gp_segment_configuration c - on s.hostname=c.hostname and c.content=-1 and role='p' - where rsgname='default_group'; - -select rsgname - , groupid - , segment_id - , cpu - , memory_used - , memory_shared_used - from gp_toolkit.gp_resgroup_status_per_segment - where rsgname='default_group' - and segment_id=-1; - --- also log the raw output of the views, if any of above tests failed it is --- easier to find out the causes with these logs. - --- start_ignore -select * from gp_toolkit.gp_resgroup_config; -select * from gp_toolkit.gp_resgroup_status; -select * from gp_toolkit.gp_resgroup_status_per_host; -select * from gp_toolkit.gp_resgroup_status_per_segment; --- end_ignore diff --git a/src/test/isolation2/sql/resgroup/restore_default_resgroup.sql b/src/test/isolation2/sql/resgroup/restore_default_resgroup.sql deleted file mode 100644 index de498aefffc..00000000000 --- a/src/test/isolation2/sql/resgroup/restore_default_resgroup.sql +++ /dev/null @@ -1,20 +0,0 @@ --- enable resource group and restart cluster. --- start_ignore -! gpconfig -c gp_resource_group_cpu_limit -v 0.9; -! gpconfig -c gp_resource_group_memory_limit -v 0.9; -! gpconfig -c gp_resource_manager -v group; - --- 40 should be enough for the following cases and some --- weak test agents may not adopt a higher max_connections -! gpconfig -c max_connections -v 100 -m 40; -! gpstop -rai; --- end_ignore - -show gp_resource_manager; -show gp_resource_group_cpu_limit; -show gp_resource_group_memory_limit; -show max_connections; - --- by default admin_group has concurrency set to -1 which leads to --- very small memory quota for each resgroup slot, correct it. -ALTER RESOURCE GROUP admin_group SET concurrency 40;