This is an automated email from the ASF dual-hosted git repository.

avamingli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit b25f1a68649f3ba89784b4bfae29cac089bfb485
Author: Huansong Fu <[email protected]>
AuthorDate: Thu Mar 30 22:17:23 2023 -0700

    Initialize capability of default resource queue in .dat file
    
    Currently the "cdb_schema.sql" file makes the change to alter the default
    resource queue 'pg_default' to have desired capability. More appropriate
    way of setting up such initial state should be done via the common catalog
    setup which is burning that into a .dat file for the corresponding catalog.
    Do that now, and add a regress test case.
---
 src/backend/catalog/cdb_schema.sql            |  2 --
 src/include/catalog/pg_resqueuecapability.dat | 20 ++++++++++++++++++++
 src/test/regress/expected/resource_queue.out  | 11 +++++++++++
 src/test/regress/sql/resource_queue.sql       |  6 ++++++
 4 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/backend/catalog/cdb_schema.sql 
b/src/backend/catalog/cdb_schema.sql
index 36a9342c90..180895513e 100644
--- a/src/backend/catalog/cdb_schema.sql
+++ b/src/backend/catalog/cdb_schema.sql
@@ -44,8 +44,6 @@ CREATE OR REPLACE VIEW pg_catalog.gp_distributed_log AS
 
 GRANT SELECT ON pg_catalog.gp_distributed_log TO PUBLIC;
 
-ALTER RESOURCE QUEUE pg_default WITH (priority=medium, memory_limit='-1');
-
 
 -- pg_tablespace_location wrapper functions to see Greenplum cluster-wide 
tablespace locations
 CREATE FUNCTION gp_tablespace_segment_location (IN tblspc_oid oid, OUT 
gp_segment_id int, OUT tblspc_loc text)
diff --git a/src/include/catalog/pg_resqueuecapability.dat 
b/src/include/catalog/pg_resqueuecapability.dat
new file mode 100644
index 0000000000..dfca05f03c
--- /dev/null
+++ b/src/include/catalog/pg_resqueuecapability.dat
@@ -0,0 +1,20 @@
+#----------------------------------------------------------------------
+#
+# pg_resqueuecapability.dat
+#    Initial contents of the pg_resqueuecapability system relation.
+#
+# Portions Copyright (c) 2008, Greenplum Inc.
+# Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
+# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
+# src/include/catalog/pg_resqueuecapability.dat
+#
+#----------------------------------------------------------------------
+
+[
+
+{ resqueueid => '6055', restypid => '5', ressetting => 'medium' },
+{ resqueueid => '6055', restypid => '6', ressetting => '-1' },
+
+]
diff --git a/src/test/regress/expected/resource_queue.out 
b/src/test/regress/expected/resource_queue.out
index bbee810dc4..a39e600b82 100755
--- a/src/test/regress/expected/resource_queue.out
+++ b/src/test/regress/expected/resource_queue.out
@@ -1,4 +1,15 @@
 -- SQL coverage of RESOURCE QUEUE
+-- start_ignore
+create extension if not exists gp_inject_fault;
+-- end_ignore
+-- check we have correct initial state of the default resource queue
+SELECT rqc.* FROM pg_resqueuecapability rqc JOIN pg_resqueue rq ON 
rqc.resqueueid = rq.oid WHERE rq.rsqname = 'pg_default';
+ resqueueid | restypid | ressetting 
+------------+----------+------------
+       6055 |        5 | medium
+       6055 |        6 | -1
+(2 rows)
+
 CREATE RESOURCE QUEUE regressq ACTIVE THRESHOLD 1;
 SELECT rsqname, rsqcountlimit, rsqcostlimit, rsqovercommit, rsqignorecostlimit 
FROM pg_resqueue WHERE rsqname='regressq';
  rsqname  | rsqcountlimit | rsqcostlimit | rsqovercommit | rsqignorecostlimit 
diff --git a/src/test/regress/sql/resource_queue.sql 
b/src/test/regress/sql/resource_queue.sql
index 597e93bbd1..e2b8d3089c 100644
--- a/src/test/regress/sql/resource_queue.sql
+++ b/src/test/regress/sql/resource_queue.sql
@@ -1,4 +1,10 @@
 -- SQL coverage of RESOURCE QUEUE
+-- start_ignore
+create extension if not exists gp_inject_fault;
+-- end_ignore
+
+-- check we have correct initial state of the default resource queue
+SELECT rqc.* FROM pg_resqueuecapability rqc JOIN pg_resqueue rq ON 
rqc.resqueueid = rq.oid WHERE rq.rsqname = 'pg_default';
 
 CREATE RESOURCE QUEUE regressq ACTIVE THRESHOLD 1;
 SELECT rsqname, rsqcountlimit, rsqcostlimit, rsqovercommit, rsqignorecostlimit 
FROM pg_resqueue WHERE rsqname='regressq';


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to