未验证 提交 533e4d0c 编写于 作者: N Ning Yu 提交者: GitHub

resgroup: change max spill_ratio back to 100.

In 3be31490 we changed max spill_ratio
to INT_MAX, but it will not take effect until more related logic is
accordingly changed.

Before we have all the work done we will change the max spill_ratio back
to 100.
上级 ce9635d5
......@@ -59,7 +59,7 @@
#define RESGROUP_MAX_MEMORY_SHARED_QUOTA (100)
#define RESGROUP_MIN_MEMORY_SPILL_RATIO (0)
#define RESGROUP_MAX_MEMORY_SPILL_RATIO (INT_MAX)
#define RESGROUP_MAX_MEMORY_SPILL_RATIO (100)
/*
* The names must be in the same order as ResGroupMemAuditorType.
......
......@@ -2986,7 +2986,7 @@ struct config_int ConfigureNamesInt_gp[] =
NULL
},
&memory_spill_ratio,
20, 0, INT_MAX, NULL, NULL
20, 0, 100, NULL, NULL
},
{
......
......@@ -25,7 +25,7 @@ groupname |memory_shared_quota|proposed_memory_shared_quota|memory_spill_rati
rg_spill_test|20 |20 |20 |20
(1 row)
-- positive, memory_spill_ratio range is [0, 2147483647]
-- positive, memory_spill_ratio range is [0, 100]
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 0;
ALTER
SELECT * FROM rg_spill_status;
......@@ -58,9 +58,9 @@ groupname |memory_shared_quota|proposed_memory_shared_quota|memory_spill_rati
rg_spill_test|20 |20 |81 |81
(1 row)
-- negative: memory_spill_ratio is negative
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO -1;
ERROR: memory_spill_ratio range is [0, 2147483647]
-- negative: memory_spill_ratio is larger than RESGROUP_MAX_MEMORY_SPILL_RATIO
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 101;
ERROR: memory_spill_ratio range is [0, 100]
SELECT * FROM rg_spill_status;
groupname |memory_shared_quota|proposed_memory_shared_quota|memory_spill_ratio|proposed_memory_spill_ratio
-------------+-------------------+----------------------------+------------------+---------------------------
......
......@@ -63,8 +63,8 @@ SELECT 1;
(1 row)
-- negative set to session level
SET MEMORY_SPILL_RATIO TO -1;
ERROR: -1 is outside the valid range for parameter "memory_spill_ratio" (0 .. 2147483647)
SET MEMORY_SPILL_RATIO TO 101;
ERROR: 101 is outside the valid range for parameter "memory_spill_ratio" (0 .. 100)
SHOW MEMORY_SPILL_RATIO;
memory_spill_ratio
------------------
......
......@@ -176,7 +176,7 @@ ERROR: memory_auditor should be "vmtracker" or "cgroup"
CREATE RESOURCE GROUP rg_test_group WITH (concurrency=1, cpu_rate_limit=10, memory_limit=10, memory_auditor="cgroup");
ERROR: resource group concurrency must be 0 when group memory_auditor is cgroup
-- memory_spill_ratio range is [0, 2147483647]
-- memory_spill_ratio range is [0, 100]
-- no limit on the sum of memory_shared_quota and memory_spill_ratio
CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=10, memory_spill_ratio=0);
CREATE
......@@ -187,7 +187,7 @@ CREATE
DROP RESOURCE GROUP rg_test_group;
DROP
CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=10, memory_spill_ratio=-1);
ERROR: memory_spill_ratio range is [0, 2147483647]
ERROR: memory_spill_ratio range is [0, 100]
CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=-1, memory_spill_ratio=10);
ERROR: memory_shared_quota range is [0, 100]
......@@ -251,7 +251,7 @@ CREATE
DROP RESOURCE GROUP rg_test_group;
DROP
-- memory_spill_ratio range is [0, 2147483647]
-- memory_spill_ratio range is [0, 100]
-- no limit on the sum of memory_shared_quota and memory_spill_ratio
CREATE RESOURCE GROUP rg_test_group WITH (cpu_rate_limit=10, memory_limit=10, memory_shared_quota=0, memory_spill_ratio=1);
CREATE
......
......@@ -20,7 +20,12 @@ DROP RESOURCE GROUP rg_spill_test;
DROP
CREATE RESOURCE GROUP rg_spill_test WITH (concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=-1);
ERROR: memory_spill_ratio range is [0, 2147483647]
ERROR: memory_spill_ratio range is [0, 100]
DROP RESOURCE GROUP rg_spill_test;
ERROR: resource group "rg_spill_test" does not exist
CREATE RESOURCE GROUP rg_spill_test WITH (concurrency=10, cpu_rate_limit=20, memory_limit=20, memory_shared_quota=50, memory_spill_ratio=101);
ERROR: memory_spill_ratio range is [0, 100]
DROP RESOURCE GROUP rg_spill_test;
ERROR: resource group "rg_spill_test" does not exist
......@@ -35,9 +40,9 @@ ALTER
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 100;
ALTER
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO -1;
ERROR: memory_spill_ratio range is [0, 2147483647]
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 10000;
ALTER
ERROR: memory_spill_ratio range is [0, 100]
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 101;
ERROR: memory_spill_ratio range is [0, 100]
DROP RESOURCE GROUP rg_spill_test;
DROP
......@@ -86,7 +91,7 @@ SELECT 1;
(1 row)
SET MEMORY_SPILL_RATIO TO -1;
ERROR: -1 is outside the valid range for parameter "memory_spill_ratio" (0 .. 2147483647)
ERROR: -1 is outside the valid range for parameter "memory_spill_ratio" (0 .. 100)
SHOW MEMORY_SPILL_RATIO;
memory_spill_ratio
------------------
......@@ -98,12 +103,12 @@ SELECT 1;
1
(1 row)
SET MEMORY_SPILL_RATIO TO 10000;
SET
SET MEMORY_SPILL_RATIO TO 101;
ERROR: 101 is outside the valid range for parameter "memory_spill_ratio" (0 .. 100)
SHOW MEMORY_SPILL_RATIO;
memory_spill_ratio
------------------
10000
100
(1 row)
SELECT 1;
?column?
......
......@@ -17,7 +17,7 @@ SELECT * FROM rg_spill_status;
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 20;
SELECT * FROM rg_spill_status;
-- positive, memory_spill_ratio range is [0, 2147483647]
-- positive, memory_spill_ratio range is [0, 100]
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 0;
SELECT * FROM rg_spill_status;
......@@ -30,8 +30,8 @@ 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 negative
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO -1;
-- 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
......
......@@ -30,7 +30,7 @@ SHOW MEMORY_SPILL_RATIO;
SELECT 1;
-- negative set to session level
SET MEMORY_SPILL_RATIO TO -1;
SET MEMORY_SPILL_RATIO TO 101;
SHOW MEMORY_SPILL_RATIO;
SELECT 1;
......
......@@ -95,7 +95,7 @@ CREATE RESOURCE GROUP rg_test_group WITH (concurrency=0, cpu_rate_limit=10, memo
-- 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");
-- memory_spill_ratio range is [0, 2147483647]
-- 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;
......@@ -136,7 +136,7 @@ DROP RESOURCE GROUP rg2_test_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, 2147483647]
-- 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;
......
......@@ -19,6 +19,10 @@ 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);
......@@ -27,7 +31,7 @@ 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 10000;
ALTER RESOURCE GROUP rg_spill_test SET MEMORY_SPILL_RATIO 101;
DROP RESOURCE GROUP rg_spill_test;
......@@ -51,7 +55,7 @@ SET MEMORY_SPILL_RATIO TO -1;
SHOW MEMORY_SPILL_RATIO;
SELECT 1;
SET MEMORY_SPILL_RATIO TO 10000;
SET MEMORY_SPILL_RATIO TO 101;
SHOW MEMORY_SPILL_RATIO;
SELECT 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册