You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by yj...@apache.org on 2025/01/20 04:02:57 UTC

(cloudberry) branch main updated (df1e2ff5ae -> fe8326add2)

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

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


    from df1e2ff5ae Prevent CREATE TABLE from using dangling tablespace (#876)
     new b21d8dc5f2 Do not use immediate restart in regress test
     new 3acf999b6f Replace last PushOverrideSearchPath() call with set_config_option().
     new cf583e890f Possible qual postponing past ANTI-JOIN/LASJ_NOTIN-JOIN.
     new a902d1fadb Add test case for PR 15279.
     new 84748f5775 Rewrite test interrupt_holdoff_count
     new dbae11e750 Added test case for pr 15283 (#15528)
     new 62307f34ff Refine error message for EXCHANGE PARTITION ... WITH|WITHOU VALIDATION
     new 65209eb383 Make slabs and generations use gp_malloc|free
     new beac4003ed Add logic for checking the process holding the lock file exists
     new dc79dab0a7 Make gp_session_role alias of gp_role using map_old_guc_names
     new 7ac7eb629e Don't use PGC_S_OVERRIDE for setting gp_role GUC
     new 33e877344a Remove a FIXME in tupser.c
     new 3b2d07b605 add some test results into .gitignore (#16254)
     new aa9cb76622 Fix partition single node test.
     new 04647e2448 Fix gpstop pipeline flakiness after #15727
     new 40f3dc2c58 Disallow non-standalone ALTER distribution
     new 546d7b8a9d Fix recursive CTE mergejoin having motion on WTS
     new d167c736c1 Fix flakiness of regression test in create_index (#16343)
     new 7fb9b5c688 Remove unnecessary trailing semicolons from Python scripts. (#15976)
     new 4b5d93994c Fix flaky test in create_index (#16368)
     new 0c83071427 Archive current timeline history file after recovery finishes if needed
     new a9f26d7cd5 Bring work_mem out of deprecation
     new 4ac70ed566 Fix the wrong permissions warning on the pgpass file (#16207)
     new 566a3d8a1d Analyzedb: Add materialized views to list of tables to be analyzed (#16410)
     new fe8326add2 print log message with write_stderr when reach vmem or resgroup limit.

The 25 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 gpMgmt/bin/analyzedb                               |  10 +-
 gpMgmt/bin/gpload.py                               |   8 +-
 gpMgmt/bin/gppylib/commands/base.py                |   2 +-
 gpMgmt/bin/gppylib/commands/gp.py                  |   4 +-
 .../gppylib/commands/test/unit/test_unit_base.py   |   9 +
 gpMgmt/bin/gppylib/commands/unix.py                |   2 +-
 gpMgmt/bin/gppylib/db/dbconn.py                    |   4 +-
 gpMgmt/bin/gppylib/gpparseopts.py                  |   2 +-
 gpMgmt/bin/gppylib/mainUtils.py                    |   5 +
 gpMgmt/bin/gppylib/programs/clsSystemState.py      |   2 +-
 gpMgmt/test/behave/mgmt_utils/analyzedb.feature    |  15 ++
 gpMgmt/test/behave/mgmt_utils/gpstart.feature      |   2 +
 .../mgmt_utils/steps/analyzedb_mgmt_utils.py       |  16 +-
 gpMgmt/test/behave/mgmt_utils/steps/gpstart.py     |  15 ++
 .../steps/unreachable_hosts_mgmt_utils.py          |   4 +
 gpcontrib/gp_replica_check/gp_replica_check.py     |   2 +-
 .../expected/resource_manager_restore_to_none.out  |  27 +--
 .../expected/resource_manager_switch_to_queue.out  |  23 +--
 src/backend/access/transam/xlog.c                  |  31 +++
 src/backend/catalog/namespace.c                    |   4 +
 src/backend/cdb/cdbpath.c                          |   9 +-
 src/backend/cdb/motion/tupser.c                    |   5 -
 src/backend/commands/schemacmds.c                  |  62 +++---
 src/backend/commands/tablecmds.c                   |  36 ++++
 src/backend/optimizer/plan/initsplan.c             |   5 +-
 src/backend/parser/gram.y                          |   8 +-
 src/backend/postmaster/postmaster.c                |   9 +-
 src/backend/utils/misc/guc.c                       |   3 +-
 src/backend/utils/mmgr/generation.c                |  14 +-
 src/backend/utils/mmgr/memprot.c                   |  13 +-
 src/backend/utils/mmgr/slab.c                      |  12 +-
 .../plpgsql/src/expected/plpgsql_transaction.out   |   3 -
 src/test/isolation2/.gitignore                     |   4 +
 .../t/138_archive_current_timeline_history.pl      | 215 +++++++++++++++++++++
 src/test/regress/expected/aggregates.out           |   4 -
 src/test/regress/expected/aggregates_optimizer.out |   4 -
 .../regress/expected/alter_distribution_policy.out |  11 ++
 src/test/regress/expected/bfv_joins.out            |  45 +++--
 src/test/regress/expected/bfv_joins_optimizer.out  |  45 +++--
 src/test/regress/expected/bitmapops.out            |   1 -
 src/test/regress/expected/bitmapops_optimizer.out  |   1 -
 src/test/regress/expected/circle.out               |   1 +
 src/test/regress/expected/gp_recursive_cte.out     |  81 ++++++++
 src/test/regress/expected/groupingsets.out         |   5 -
 .../regress/expected/groupingsets_optimizer.out    |   5 -
 src/test/regress/expected/guc.out                  |  23 ---
 src/test/regress/expected/guc_gp.out               |   2 -
 src/test/regress/expected/instr_in_shmem_setup.out |   2 +-
 .../regress/expected/interrupt_holdoff_count.out   |  30 +++
 src/test/regress/expected/join.out                 |   2 -
 src/test/regress/expected/join_hash.out            |  18 --
 src/test/regress/expected/join_hash_optimizer.out  |  18 --
 src/test/regress/expected/join_optimizer.out       |   2 -
 src/test/regress/expected/memoize.out              |   2 -
 src/test/regress/expected/memoize_optimizer.out    |   2 -
 src/test/regress/expected/namespace.out            |  45 +++++
 src/test/regress/expected/partition.out            |   5 +-
 src/test/regress/expected/partition1.out           |  10 +-
 src/test/regress/expected/partition_optimizer.out  |   3 +-
 src/test/regress/expected/polygon.out              |   6 +-
 src/test/regress/expected/polygon_optimizer.out    |   8 +-
 src/test/regress/expected/rangefuncs.out           |   2 -
 src/test/regress/expected/rangefuncs_optimizer.out |   2 -
 src/test/regress/expected/select_distinct.out      |   2 -
 .../regress/expected/select_distinct_optimizer.out |   2 -
 src/test/regress/expected/select_parallel.out      |   2 -
 src/test/regress/expected/tuplesort.out            |   3 -
 src/test/regress/expected/tuplesort_optimizer.out  |   3 -
 src/test/regress/greenplum_schedule                |   1 +
 src/test/regress/output/aocs.source                |   1 -
 src/test/regress/output/appendonly.source          |   1 -
 src/test/regress/sql/alter_distribution_policy.sql |   6 +
 src/test/regress/sql/bfv_joins.sql                 |  39 ++--
 src/test/regress/sql/circle.sql                    |   2 +
 src/test/regress/sql/gp_recursive_cte.sql          |  45 +++++
 src/test/regress/sql/instr_in_shmem_setup.sql      |   2 +-
 src/test/regress/sql/interrupt_holdoff_count.sql   |  20 ++
 src/test/regress/sql/namespace.sql                 |  24 +++
 src/test/regress/sql/polygon.sql                   |   3 +-
 .../singlenode_regress/expected/aggregates.out     |   4 -
 src/test/singlenode_regress/expected/bitmapops.out |   1 -
 .../singlenode_regress/expected/groupingsets.out   |   5 -
 src/test/singlenode_regress/expected/guc.out       |  23 ---
 .../expected/incremental_sort.out                  |   2 -
 src/test/singlenode_regress/expected/join.out      |   2 -
 src/test/singlenode_regress/expected/join_hash.out |  18 --
 src/test/singlenode_regress/expected/memoize.out   |   2 -
 src/test/singlenode_regress/expected/partition.out |   3 +-
 .../singlenode_regress/expected/partition1.out     |   6 +-
 .../singlenode_regress/expected/rangefuncs.out     |   2 -
 .../expected/select_distinct.out                   |   2 -
 .../expected/select_parallel.out                   |   2 -
 src/test/singlenode_regress/expected/tuplesort.out |   3 -
 .../expected/workfile/hashagg_spill.out            |   3 -
 .../expected/workfile/hashjoin_spill.out           |   1 -
 src/test/singlenode_regress/output/aocs.source     |   1 -
 96 files changed, 816 insertions(+), 390 deletions(-)
 create mode 100644 src/test/recovery/t/138_archive_current_timeline_history.pl
 create mode 100644 src/test/regress/expected/interrupt_holdoff_count.out
 create mode 100644 src/test/regress/sql/interrupt_holdoff_count.sql


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 20/25: Fix flaky test in create_index (#16368)

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4b5d93994cb84282f2c257d57381719670345494
Author: bhari <bh...@vmware.com>
AuthorDate: Tue Sep 5 15:37:44 2023 +0530

    Fix flaky test in create_index (#16368)
    
    A test case in create_index is still failing after commit 50b7996999951d8e85cc4194a22ce7e92e6b44d3.
    Failure could be reproduced only about 1 in 5 times.
    **Test case:**
    `EXPLAIN (COSTS OFF) SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon ORDER BY (poly_center(f1))[0];`
    **RCA:**
    Since the ANALYZE query on table polygon_tbl was run before all inserts, rows were not estimated correctly.
    **FIX:**
    By moving the ANALYZE command after all the insert queries of the table,
    it could be observed that the faulty plan is not occurring.
---
 src/test/regress/expected/polygon.out           | 6 +++---
 src/test/regress/expected/polygon_optimizer.out | 8 ++++----
 src/test/regress/sql/polygon.sql                | 3 +--
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/test/regress/expected/polygon.out b/src/test/regress/expected/polygon.out
index 00ddc89f08..057b066c40 100644
--- a/src/test/regress/expected/polygon.out
+++ b/src/test/regress/expected/polygon.out
@@ -9,7 +9,6 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(3,4),(5,6),(7,8)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(7,8),(5,6),(3,4),(1,2)'); -- Reverse
 INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(7,8),(5,6),(3,-4)');
-ANALYZE POLYGON_TBL;
 -- degenerate polygons
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)');
@@ -34,16 +33,17 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
 ERROR:  invalid input syntax for type polygon: "asdf"
 LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
                                             ^
+ANALYZE POLYGON_TBL;
 SELECT * FROM POLYGON_TBL;
              f1             
 ----------------------------
+ ((0,1),(0,1))
+ ((0,0))
  ((2,0),(2,4),(0,0))
  ((3,1),(3,3),(1,0))
  ((1,2),(3,4),(5,6),(7,8))
  ((7,8),(5,6),(3,4),(1,2))
  ((1,2),(7,8),(5,6),(3,-4))
- ((0,0))
- ((0,1),(0,1))
 (7 rows)
 
 --
diff --git a/src/test/regress/expected/polygon_optimizer.out b/src/test/regress/expected/polygon_optimizer.out
index 1554fb2bf5..9b61fc7ad4 100644
--- a/src/test/regress/expected/polygon_optimizer.out
+++ b/src/test/regress/expected/polygon_optimizer.out
@@ -9,7 +9,6 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(3,4),(5,6),(7,8)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(7,8),(5,6),(3,4),(1,2)'); -- Reverse
 INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(7,8),(5,6),(3,-4)');
-ANALYZE POLYGON_TBL;
 -- degenerate polygons
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)');
@@ -34,16 +33,17 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
 ERROR:  invalid input syntax for type polygon: "asdf"
 LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
                                             ^
+ANALYZE POLYGON_TBL;
 SELECT * FROM POLYGON_TBL;
              f1             
 ----------------------------
- ((0,0))
  ((0,1),(0,1))
- ((1,2),(3,4),(5,6),(7,8))
- ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))
  ((2,0),(2,4),(0,0))
  ((3,1),(3,3),(1,0))
+ ((1,2),(3,4),(5,6),(7,8))
  ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4))
 (7 rows)
 
 --
diff --git a/src/test/regress/sql/polygon.sql b/src/test/regress/sql/polygon.sql
index 2a496a24b8..c6e0f3dc19 100644
--- a/src/test/regress/sql/polygon.sql
+++ b/src/test/regress/sql/polygon.sql
@@ -14,7 +14,6 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(3,4),(5,6),(7,8)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(7,8),(5,6),(3,4),(1,2)'); -- Reverse
 INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(7,8),(5,6),(3,-4)');
-ANALYZE POLYGON_TBL;
 
 -- degenerate polygons
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)');
@@ -31,7 +30,7 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
-
+ANALYZE POLYGON_TBL;
 
 SELECT * FROM POLYGON_TBL;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 09/25: Add logic for checking the process holding the lock file exists

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit beac4003edb38c180b3ebc8bc4b2a3bdabed710d
Author: sruthip2 <sr...@vmware.com>
AuthorDate: Wed Aug 2 19:42:20 2023 +0530

    Add logic for checking the process holding the lock file exists
    
    Issue:
    Some utilities (gprecoverseg, gpstop, etc...) use a lock directory to prevent customers from running
    multiple instances of the program simultaneously. The lock directory is created inside the
    COORDINATOR_DATA_DIRECTORY at the start of program execution and should be removed when the execution completes.
    However, the lock directory is not always removed if the user abruptly kills the program
    during execution. Consequently, the next run of the same utility encounters an error, stating
    that the lock directory already exists and asks the user to manually delete it, even if
    the process holding the lock is already terminated.
    
    Solution:
    To address this issue, this commit introduces a modification in mainUtils.py.
    When attempting to acquire the lock, the code now checks if the process ID in the PID file,
    present in the lock directory, still exists. If the process has been killed, the script
    automatically removes the lock directory and proceeds to acquire a new lock for the current run.
    This ensures that the utility can continue its execution without being hindered by
    orphaned lock files from previous runs.
---
 gpMgmt/bin/gppylib/mainUtils.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gpMgmt/bin/gppylib/mainUtils.py b/gpMgmt/bin/gppylib/mainUtils.py
index 98d42bddad..b191c88156 100644
--- a/gpMgmt/bin/gppylib/mainUtils.py
+++ b/gpMgmt/bin/gppylib/mainUtils.py
@@ -173,6 +173,11 @@ class SimpleMainLock:
             if self.pidfilepid == self.parentpid:
                 return None
 
+            # Check if the process that holds the lock exists.
+            # If the process is already killed, remove the lock directory.
+            if not unix.check_pid(self.pidfilepid):
+                shutil.rmtree(self.ppath)
+
         # try and acquire the lock
         try:
             self.pidlockfile.acquire()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 24/25: Analyzedb: Add materialized views to list of tables to be analyzed (#16410)

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 566a3d8a1def49dbebb6f59d7c4cec990008149a
Author: Marcus Robb <ma...@initworx.com>
AuthorDate: Tue Sep 12 10:37:28 2023 -0700

    Analyzedb: Add materialized views to list of tables to be analyzed (#16410)
    
    Previously, analyzedb did not include materialized views when preparing the list of tables to be analyzed. This caused refreshed materialized views to have poor performance until analyzed.
    
    Solution:
    Updated the SQL statements in analyzedb that collect the list of tables to also include relkind='m' from pg_class.
    This will add materialized views to the list of hash tables to be analyzed for each run.
---
 gpMgmt/bin/analyzedb                                     | 10 +++++-----
 gpMgmt/test/behave/mgmt_utils/analyzedb.feature          | 15 +++++++++++++++
 .../test/behave/mgmt_utils/steps/analyzedb_mgmt_utils.py | 16 +++++++++++++++-
 3 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/gpMgmt/bin/analyzedb b/gpMgmt/bin/analyzedb
index 010db0c762..cc51e26592 100755
--- a/gpMgmt/bin/analyzedb
+++ b/gpMgmt/bin/analyzedb
@@ -52,14 +52,14 @@ NUM_REPORTS_TO_SAVE = 3
 GET_ALL_DATA_TABLES_SQL = """
 select n.nspname as schemaname, c.relname as tablename
 from pg_class c, pg_namespace n
-where c.relnamespace = n.oid and c.relkind='r'::char
+where c.relnamespace = n.oid and (c.relkind='r'::char or c.relkind = 'm'::char)
 and (c.relnamespace >= 16384 or n.nspname = 'public' or n.nspname = 'pg_catalog')
 and c.oid not in (select ftrelid from pg_foreign_table)
 """
 
 GET_VALID_DATA_TABLES_SQL = """
 select n.nspname as schemaname, c.relname as tablename from pg_class c, pg_namespace n where
-c.relnamespace = n.oid and c.oid in (%s) and c.relkind='r'::char and (c.relnamespace >= 16384 or n.nspname = 'public' or n.nspname = 'pg_catalog') and c.oid not in (select ftrelid from pg_foreign_table)
+c.relnamespace = n.oid and c.oid in (%s) and (c.relkind='r'::char or c.relkind = 'm'::char) and (c.relnamespace >= 16384 or n.nspname = 'public' or n.nspname = 'pg_catalog') and c.oid not in (select ftrelid from pg_foreign_table)
 """
 
 GET_REQUESTED_AO_DATA_TABLE_INFO_SQL = """
@@ -86,7 +86,7 @@ GET_REQUESTED_LAST_OP_INFO_SQL = """
 GET_ALL_DATA_TABLES_IN_SCHEMA_SQL = """
 select n.nspname as schemaname, c.relname as tablename
 from pg_class c, pg_namespace n
-where c.relnamespace = n.oid and c.relkind='r'::char
+where c.relnamespace = n.oid and (c.relkind='r'::char or c.relkind = 'm'::char)
  and (c.relnamespace >= 16384 or n.nspname = 'public' or n.nspname = 'pg_catalog')
 and c.oid not in (select ftrelid from pg_foreign_table)
 and n.nspname = '%s'
@@ -112,7 +112,7 @@ and c.relkind = 'p' and c.relispartition
 GET_REQUESTED_NON_AO_TABLES_SQL = """
 select n.nspname as schemaname, c.relname as tablename
 from pg_class c, pg_namespace n
-where c.relnamespace = n.oid and c.relkind='r'::char
+where c.relnamespace = n.oid and (c.relkind='r'::char or c.relkind = 'm'::char)
 and (c.relnamespace >= 16384 or n.nspname = 'public' or n.nspname = 'pg_catalog')
 and c.oid not in (select ftrelid from pg_foreign_table)
 and c.oid not in (select relid from pg_appendonly)
@@ -554,7 +554,7 @@ class AnalyzeDb(Operation):
         At the same time, parse the requested columns and populate the col_dict.
         If a requested table is partitioned, expand all the leaf partitions.
         """
-        logger.info("Getting and verifying input tables...")
+        logger.info("Getting and verifying input tables and materialized views...")
         if self.single_table:
 
             # Check that the table name given on the command line is schema-qualified.
diff --git a/gpMgmt/test/behave/mgmt_utils/analyzedb.feature b/gpMgmt/test/behave/mgmt_utils/analyzedb.feature
index 93d90fd332..5809c7745a 100644
--- a/gpMgmt/test/behave/mgmt_utils/analyzedb.feature
+++ b/gpMgmt/test/behave/mgmt_utils/analyzedb.feature
@@ -1775,3 +1775,18 @@ Feature: Incrementally analyze the database
         And the user runs "dropdb schema_with_temp_table"
         And the user drops the named connection "default"
 
+    Scenario: analyzedb can handle the table name with special utf-8 characters.
+        Given database "special_encoding_db" is dropped and recreated
+        And the user connects to "special_encoding_db" with named connection "default"
+        And the user executes "CREATE TEMP TABLE spiegelungssätze (c1 int) DISTRIBUTED BY (c1)" with named connection "default"
+        When the user runs "analyzedb -a -d special_encoding_db"
+        Then analyzedb should return a return code of 0
+
+    Scenario: analyzedb finds materialized views
+        Given  a materialized view "public.mv_test_view" exists on table "pg_class"
+        And the user runs "analyzedb -a -d incr_analyze"
+        Then analyzedb should print "-public.mv_test_view" to stdout
+        And the user runs "analyzedb -a -s public -d incr_analyze"
+        Then analyzedb should print "-public.mv_test_view" to stdout
+        And the user runs "analyzedb -a -t public.mv_test_view -d incr_analyze"
+        Then analyzedb should print "-public.mv_test_view" to stdout
diff --git a/gpMgmt/test/behave/mgmt_utils/steps/analyzedb_mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/analyzedb_mgmt_utils.py
index 3bbdca1ea7..f7bf6f1bdf 100644
--- a/gpMgmt/test/behave/mgmt_utils/steps/analyzedb_mgmt_utils.py
+++ b/gpMgmt/test/behave/mgmt_utils/steps/analyzedb_mgmt_utils.py
@@ -37,7 +37,6 @@ DEFAULT PARTITION default_dates);
 """
 
 
-
 @given('there is a regular "{storage_type}" table "{tablename}" with column name list "{col_name_list}" and column type list "{col_type_list}" in schema "{schemaname}"')
 def impl(context, storage_type, tablename, col_name_list, col_type_list, schemaname):
     schemaname_no_quote = schemaname
@@ -98,6 +97,13 @@ def impl(context, view_name, table_name):
         create_view_on_table(context.conn, view_name, table_name)
 
 
+@given('a materialized view "{view_name}" exists on table "{table_name}"')
+def impl(context, view_name, table_name):
+    with closing(dbconn.connect(dbconn.DbURL(dbname=context.dbname))) as conn:
+        create_materialized_view_on_table_in_schema(context.conn, viewname=view_name,
+                                                     tablename=table_name)
+
+
 @given('"{qualified_table}" appears in the latest state files')
 @then('"{qualified_table}" should appear in the latest state files')
 def impl(context, qualified_table):
@@ -462,3 +468,11 @@ def create_view_on_table(conn, viewname, tablename):
             " AS SELECT * FROM " + tablename
     dbconn.execSQL(conn, query)
     conn.commit()
+
+
+def create_materialized_view_on_table_in_schema(conn, tablename, viewname):
+    query = "DROP MATERIALIZED VIEW IF EXISTS " + viewname + ";" \
+            "CREATE MATERIALIZED VIEW " + viewname + \
+            " AS SELECT * FROM " + tablename
+    dbconn.execSQL(conn, query)
+    conn.commit()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 18/25: Fix flakiness of regression test in create_index (#16343)

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d167c736c1bc1877aae7a019f1f9206b68b98ba6
Author: bhari <bh...@vmware.com>
AuthorDate: Mon Sep 4 11:58:06 2023 +0530

    Fix flakiness of regression test in create_index (#16343)
    
    * Fix flakiness of regression test in create_index
    
    A test case in create_index.sql became flaky after
    commit b5aeb102946bedd3118916e84d79894af7e9f926.
    Found issue to be related to stats not being available for table
    in query sometimes.
    So added `ANALYZE <table_name>` after insert queries,
    so stats are available always.
---
 src/test/regress/expected/circle.out | 1 +
 src/test/regress/sql/circle.sql      | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/test/regress/expected/circle.out b/src/test/regress/expected/circle.out
index c3b05274de..36ec9f611c 100644
--- a/src/test/regress/expected/circle.out
+++ b/src/test/regress/expected/circle.out
@@ -34,6 +34,7 @@ INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
 ERROR:  invalid input syntax for type circle: "(3,(1,2),3)"
 LINE 1: INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
                                        ^
+ANALYZE CIRCLE_TBL;
 SELECT * FROM CIRCLE_TBL;
        f1       
 ----------------
diff --git a/src/test/regress/sql/circle.sql b/src/test/regress/sql/circle.sql
index 8c8a0f8806..aca9f1f826 100644
--- a/src/test/regress/sql/circle.sql
+++ b/src/test/regress/sql/circle.sql
@@ -36,6 +36,8 @@ INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
 
 INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
 
+ANALYZE CIRCLE_TBL;
+
 SELECT * FROM CIRCLE_TBL;
 
 SELECT center(f1) AS center


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 14/25: Fix partition single node test.

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit aa9cb76622213b2e675d120a3f8743066b28d340
Author: Jianghua Yang <yj...@gmail.com>
AuthorDate: Thu Jan 16 21:03:14 2025 +0800

    Fix partition single node test.
---
 src/test/singlenode_regress/expected/partition.out  | 3 ++-
 src/test/singlenode_regress/expected/partition1.out | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/test/singlenode_regress/expected/partition.out b/src/test/singlenode_regress/expected/partition.out
index 6c4ecee8ed..9ba7a1dc41 100755
--- a/src/test/singlenode_regress/expected/partition.out
+++ b/src/test/singlenode_regress/expected/partition.out
@@ -277,7 +277,8 @@ alter table foo_p exchange partition for(6) with table bar_p;
 ERROR:  partition constraint of relation "bar_p" is violated by some row
 alter table foo_p exchange partition for(6) with table bar_p without
 validation;
-NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation. If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
+NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
 ERROR:  partition constraint of relation "bar_p" is violated by some row
 analyze foo_p;
 select * from foo_p;
diff --git a/src/test/singlenode_regress/expected/partition1.out b/src/test/singlenode_regress/expected/partition1.out
index 496dc20152..2cdd12349c 100644
--- a/src/test/singlenode_regress/expected/partition1.out
+++ b/src/test/singlenode_regress/expected/partition1.out
@@ -2665,10 +2665,12 @@ CREATE TABLE validation_syntax_tbl (a int)
 CREATE TABLE exchange_tbl (a int4);
 INSERT INTO exchange_tbl VALUES (100);
 ALTER TABLE validation_syntax_tbl EXCHANGE PARTITION p1 WITH TABLE exchange_tbl WITH VALIDATION;
-NOTICE:  specifying "WITH VALIDATION" acts as no operation. If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
+NOTICE:  specifying "WITH VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
 ERROR:  partition constraint of relation "exchange_tbl" is violated by some row
 ALTER TABLE validation_syntax_tbl EXCHANGE PARTITION p1 WITH TABLE exchange_tbl WITHOUT VALIDATION;
-NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation. If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
+NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
 ERROR:  partition constraint of relation "exchange_tbl" is violated by some row
 DROP TABLE exchange_tbl;
 DROP TABLE validation_syntax_tbl;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 10/25: Make gp_session_role alias of gp_role using map_old_guc_names

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit dc79dab0a7825557c94ee88fc14b6d2a543d6248
Author: Ashwin Agrawal <aa...@vmware.com>
AuthorDate: Mon Aug 21 15:24:59 2023 -0700

    Make gp_session_role alias of gp_role using map_old_guc_names
    
    map_old_guc_names facility exist to have alias for old GUC names to
    new ones. Hence best to use that facility instead of hand roll
    gp_session_role as alias to gp_role.
    
    Doing this also eliminates having the problem fixed via commit
    8d52dad.
---
 src/backend/utils/misc/guc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index cfe27ffc44..6e3fbb9b5b 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -5121,6 +5121,7 @@ static struct config_enum ConfigureNamesEnum[] =
 static const char *const map_old_guc_names[] = {
 	"sort_mem", "work_mem",
 	"vacuum_mem", "maintenance_work_mem",
+	"gp_session_role", "gp_role",
 	NULL
 };
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 21/25: Archive current timeline history file after recovery finishes if needed

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0c830714271464d1fb689dee70883e659cc43756
Author: Jimmy Yih <jy...@vmware.com>
AuthorDate: Fri Aug 25 11:11:46 2023 -0700

    Archive current timeline history file after recovery finishes if needed
    
    Previously, the only time the timeline history file would be archived
    was when a standby already configured for WAL archiving was
    promoted. If WAL archiving was set up and started after the standby
    was promoted, its current timeline history file would not be found in
    the archive. This could cause issues when restoring backups that did
    not include the timeline history files (e.g. pg_basebackup
    -Xnone). Some example failures include failing to restore with
    recovery_target_timeline explicitly set to the control file's timeline
    id and failing to create cascade standbys after recovering with
    recovery_target_timeline set to 'current' or 'latest'. To prevent
    these restore issues, we now ensure that the current timeline history
    file has been archived by marking it as ready for archiving after
    recovery finishes if it was found that it has not already been
    archived or marked ready.
---
 src/backend/access/transam/xlog.c                  |  31 +++
 .../t/138_archive_current_timeline_history.pl      | 215 +++++++++++++++++++++
 2 files changed, 246 insertions(+)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 22196d95d0..df5ae6b3c3 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8539,6 +8539,37 @@ StartupXLOG(void)
 	if (standbyState != STANDBY_DISABLED)
 		ShutdownRecoveryTransactionEnvironment();
 
+	/*
+	 * GPDB: A timeline history file is only marked as ready for archival if
+	 * WAL archiving was already enabled when a new timeline id is created
+	 * during promotion.  Thus it's possible to get into a state where the
+	 * timeline history file is not archived yet due to WAL archiving being
+	 * disabled during the timeline switch.  As such, we need to guarantee
+	 * that the current timeline history file is archived.  This will make
+	 * sure downstream operations that require the timeline history file
+	 * succeed (e.g. creating a standby with recovery_target_timeline
+	 * explicitly set to the control file's timeline id or when creating a
+	 * streaming replication standby).  Skip if the current timeline ID is 1
+	 * since there's no timeline history file for it.
+	 */
+	if (XLogArchivingActive() && ThisTimeLineID > 1)
+	{
+		char		histfname[MAXFNAMELEN];
+
+		TLHistoryFileName(histfname, ThisTimeLineID);
+
+		/*
+		 * Timeline history .done files do not get removed automatically so
+		 * this check should be valid to make sure we don't archive the
+		 * timeline history file again on restart.  However, if the timeline
+		 * history .done file was manually removed for some reason, then we
+		 * make the assumption that the archive_command is set up properly to
+		 * gracefully handle the re-archiving attempt.
+		 */
+		if (!XLogArchiveIsReadyOrDone(histfname))
+			XLogArchiveNotify(histfname);
+	}
+
 	/*
 	 * If there were cascading standby servers connected to us, nudge any wal
 	 * sender processes to notice that we've been promoted.
diff --git a/src/test/recovery/t/138_archive_current_timeline_history.pl b/src/test/recovery/t/138_archive_current_timeline_history.pl
new file mode 100644
index 0000000000..79af62a10f
--- /dev/null
+++ b/src/test/recovery/t/138_archive_current_timeline_history.pl
@@ -0,0 +1,215 @@
+# Demonstrate that setting up and starting WAL archiving on an
+# already-promoted node will result in the archival of its current
+# timeline history file.  The way we do this is by doing the
+# following:
+#
+# 1. Create a primary node that is on a timeline greater than 1.
+# 2. Take a basebackup of that primary node with the -Xnone flag to
+#    suggest that the WAL and timeline history files will be coming
+#    from a separate location (e.g. a WAL archive).
+# 3. Validate specific scenarios that would fail or give unexpected
+#    warnings if the timeline history file was not retrievable.
+#    Specifically, we test the different recovery_target_timeline
+#    values and cascade streaming replication.
+
+use strict;
+use warnings;
+use PostgresNode;
+use TestLib;
+use Test::More tests => 15;
+
+$ENV{PGDATABASE} = 'postgres';
+
+# Initialize primary node
+my $node_primary = get_new_node('primary');
+$node_primary->init(allows_streaming => 1);
+$node_primary->start;
+
+# Take a backup
+my $backup_name = 'my_backup_1';
+$node_primary->backup($backup_name);
+
+# Create a standby that will be promoted onto timeline 2
+my $node_primary_tli2 = get_new_node('primary_tli2');
+$node_primary_tli2->init_from_backup($node_primary, $backup_name,
+	has_streaming => 1);
+$node_primary_tli2->start;
+
+# Stop and remove the primary; it's not needed anymore
+$node_primary->teardown_node;
+
+# Promote the standby using "pg_promote", switching it to timeline 2
+my $psql_out = '';
+$node_primary_tli2->psql(
+	'postgres',
+	"SELECT pg_promote(wait_seconds => 300);",
+	stdout => \$psql_out);
+is($psql_out, 't', "promotion of standby with pg_promote");
+
+# Enable archiving on the promoted node. The timeline 2 history file
+# will be pushed to the archive. We set this up ourselves instead of
+# using $node_primary_tli2->enable_archiving so that the
+# archive_command will fail if it tries to archive the same file
+# again.
+my $node_primary_tli2_archive_dir = $node_primary_tli2->archive_dir;
+$node_primary_tli2->append_conf('postgresql.conf', qq{
+archive_mode = 'on'
+archive_command = 'cp -n "%p" "$node_primary_tli2_archive_dir/%f"'
+});
+$node_primary_tli2->restart;
+
+# Wait until the timeline 2 history file has been archived. The file
+# is marked ready after recovery has completed and will be archived
+# when the archiver process does its first loop but poll to make this
+# check deterministic.
+my $primary_archive = $node_primary_tli2->archive_dir;
+$node_primary_tli2->poll_query_until('postgres',
+	"SELECT size IS NOT NULL FROM pg_stat_file('$primary_archive/00000002.history', true);")
+  or die "Timed out while waiting for 00000002.history to be archived";
+
+# Check to see if this restart will not attempt to archive the
+# timeline 2 history file again.
+$node_primary_tli2->restart;
+my $node_primary_tli2_log_contents = slurp_file($node_primary_tli2->logfile);
+ok( $node_primary_tli2_log_contents !~ qr/archive command failed with exit code 1/,
+	"00000002.history was not archived twice")
+  or die "00000002.history was being archived again and archiving errored out";
+
+# Take backup of node_primary_tli2 and use -Xnone so that pg_wal will
+# be empty and restore will retrieve the necessary WAL and timeline
+# history file(s) from the archive.
+$backup_name = 'my_backup_2';
+$node_primary_tli2->backup($backup_name, backup_options => ['-Xnone']);
+
+# Create simple WAL that will be archived and restored
+$node_primary_tli2->safe_psql('postgres', "CREATE TABLE tab_int AS SELECT 8 AS a;");
+
+# Create a restore point to later use as the recovery_target_name
+my $recovery_name = "my_target";
+my $restore_point_lsn = $node_primary_tli2->safe_psql('postgres',
+	"SELECT pg_create_restore_point('$recovery_name');");
+
+# Find the next WAL segment to be archived
+my $walfile_to_be_archived = $node_primary_tli2->safe_psql('postgres',
+	"SELECT pg_walfile_name(pg_current_wal_lsn());");
+
+# Make the WAL segment eligible for archival
+$node_primary_tli2->safe_psql('postgres', 'SELECT pg_switch_wal();');
+
+# Wait until the WAL segment has been archived
+my $archive_wait_query =
+  "SELECT '$walfile_to_be_archived' <= last_archived_wal FROM pg_stat_archiver;";
+$node_primary_tli2->poll_query_until('postgres', $archive_wait_query)
+  or die "Timed out while waiting for WAL segment to be archived";
+$node_primary_tli2->teardown_node;
+
+# Scenario 1: Initialize a new standby node from the backup using
+# recovery_target_timeline explicitly set to '2'. This node will start
+# off on timeline 2 according to the control file and will finish
+# recovery onto the same timeline. When explicitly setting the
+# timeline id, startup will fail if the timeline history file is not
+# retrievable from the archive but will not fail if we use 'current'
+# or 'latest'.
+my $node_standby_explicit = get_new_node('standby_explicit');
+$node_standby_explicit->init_from_backup($node_primary_tli2, $backup_name,
+	has_restoring => 1, standby => 0);
+$node_standby_explicit->append_conf('postgresql.conf', qq{
+recovery_target_timeline = '2'
+recovery_target_action = 'pause'
+recovery_target_name = 'my_target'
+archive_mode = 'off'
+primary_conninfo = ''
+});
+$node_standby_explicit->start;
+standby_sanity_check($node_standby_explicit, $restore_point_lsn);
+$node_standby_explicit->teardown_node;
+
+# Scenario 2: Initialize a new standby node from the backup using
+# recovery_target_timeline set to 'current'.  This node will start off
+# on timeline 2 according to the control file and will finish recovery
+# on the same timeline.  If the timeline history file was not
+# retrievable from the archive, the standby would just log a warning
+# and proceed normally which is not desirable.
+my $node_standby_current = get_new_node('standby_current');
+$node_standby_current->init_from_backup($node_primary_tli2, $backup_name,
+	has_restoring => 1, standby => 0);
+$node_standby_current->append_conf('postgresql.conf', qq{
+recovery_target_timeline = 'current'
+recovery_target_action = 'pause'
+recovery_target_name = 'my_target'
+archive_mode = 'off'
+primary_conninfo = ''
+});
+$node_standby_current->start;
+standby_sanity_check($node_standby_current, $restore_point_lsn);
+$node_standby_current->teardown_node;
+
+# Scenario 3: Initialize a new standby node from the backup using
+# recovery_target_timeline set to 'latest'. This node will start off
+# on timeline 2 according to the control file and will finish recovery
+# onto the same timeline.  If the timeline history file was not
+# retrievable from the archive, the standby would just log a warning
+# and proceed normally which is not desirable.
+my $node_standby_latest = get_new_node('standby_latest');
+$node_standby_latest->init_from_backup($node_primary_tli2, $backup_name,
+	has_restoring => 1, standby => 0);
+$node_standby_latest->append_conf('postgresql.conf', qq{
+recovery_target_timeline = 'latest'
+recovery_target_action = 'pause'
+recovery_target_name = 'my_target'
+archive_mode = 'off'
+primary_conninfo = ''
+});
+$node_standby_latest->start;
+standby_sanity_check($node_standby_latest, $restore_point_lsn);
+
+# Scenario 4: Set up a cascade standby node to validate that there's
+# no issues since the WAL receiver will request all necessary timeline
+# history files from the standby node's WAL sender.  If the timeline
+# history file was not retrievable from the standby node, the cascade
+# standby node would continuously loop trying to re-request the
+# timeline history file and always fail.
+my $node_cascade = get_new_node('cascade');
+$node_cascade->init_from_backup($node_primary_tli2, $backup_name,
+	standby => 1);
+$node_cascade->enable_streaming($node_standby_latest);
+$node_cascade->start;
+
+# Wait for the replication to catch up
+$node_standby_latest->wait_for_catchup($node_cascade, 'replay', $node_standby_latest->lsn('replay'));
+
+# Sanity check that the cascade standby node came up and is queryable
+my $result_cascade =
+  $node_cascade->safe_psql('postgres', "SELECT * FROM tab_int;");
+is($result_cascade, qq(8), 'check that the node received the streamed WAL data');
+
+$node_cascade->teardown_node;
+$node_standby_latest->teardown_node;
+
+sub standby_sanity_check
+{
+	my ($node_standby, $restore_point_lsn) = @_;
+
+	# Sanity check that the timeline history file was retrieved
+	my $node_standby_log_contents = slurp_file($node_standby->logfile);
+	ok( $node_standby_log_contents =~ qr/restored log file "00000002.history" from archive/,
+		"00000002.history retrieved from the archives");
+	ok (-f $node_standby->data_dir . "/pg_wal/00000002.history",
+		"00000002.history exists in the standby's pg_wal directory");
+
+	# Wait until necessary replay has been done on standby
+	my $caughtup_query =
+	  "SELECT '$restore_point_lsn'::pg_lsn <= pg_last_wal_replay_lsn()";
+	$node_standby->poll_query_until('postgres', $caughtup_query)
+	  or die "Timed out while waiting for standby to catch up";
+
+	# Sanity check that the node is queryable
+	my $result_standby =
+	  $node_standby->safe_psql('postgres', "SELECT timeline_id FROM pg_control_checkpoint();");
+	is($result_standby, qq(2), 'check that the node is on timeline 2');
+	$result_standby =
+	  $node_standby->safe_psql('postgres', "SELECT * FROM tab_int;");
+	is($result_standby, qq(8), 'check that the node did archive recovery');
+
+	return;
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 02/25: Replace last PushOverrideSearchPath() call with set_config_option().

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3acf999b6ff32eacff864db70ae183fc58fa9072
Author: Noah Misch <no...@leadboat.com>
AuthorDate: Mon May 8 06:14:07 2023 -0700

    Replace last PushOverrideSearchPath() call with set_config_option().
    
    The two methods don't cooperate, so set_config_option("search_path",
    ...) has been ineffective under non-empty overrideStack.  This defect
    enabled an attacker having database-level CREATE privilege to execute
    arbitrary code as the bootstrap superuser.  While that particular attack
    requires v13+ for the trusted extension attribute, other attacks are
    feasible in all supported versions.
    
    Standardize on the combination of NewGUCNestLevel() and
    set_config_option("search_path", ...).  It is newer than
    PushOverrideSearchPath(), more-prevalent, and has no known
    disadvantages.  The "override" mechanism remains for now, for
    compatibility with out-of-tree code.  Users should update such code,
    which likely suffers from the same sort of vulnerability closed here.
    Back-patch to v11 (all supported versions).
    
    Alexander Lakhin.  Reported by Alexander Lakhin.
    
    Security: CVE-2023-2454
    
    (cherry-picked from 78119a0bf98edb13e7f79c6402378376cc6b6ca4 with conflicts pg:REL_12_STABLE)
---
 src/backend/catalog/namespace.c         |  4 +++
 src/backend/commands/schemacmds.c       | 62 +++++++++++++++------------------
 src/test/regress/expected/namespace.out | 45 ++++++++++++++++++++++++
 src/test/regress/sql/namespace.sql      | 24 +++++++++++++
 4 files changed, 102 insertions(+), 33 deletions(-)

diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index a2ce73578b..42465ef89a 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -3631,6 +3631,10 @@ OverrideSearchPathMatchesCurrent(OverrideSearchPath *path)
 /*
  * PushOverrideSearchPath - temporarily override the search path
  *
+ * Do not use this function; almost any usage introduces a security
+ * vulnerability.  It exists for the benefit of legacy code running in
+ * non-security-sensitive environments.
+ *
  * We allow nested overrides, hence the push/pop terminology.  The GUC
  * search_path variable is ignored while an override is active.
  *
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 6032aff5e7..1e9f7b7e3b 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -35,6 +35,7 @@
 #include "commands/tag.h"
 #include "miscadmin.h"
 #include "parser/parse_utilcmd.h"
+#include "parser/scansup.h"
 #include "tcop/utility.h"
 #include "utils/acl.h"
 #include "utils/builtins.h"
@@ -63,14 +64,16 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
 {
 	const char *schemaName = stmt->schemaname;
 	Oid			namespaceId;
-	OverrideSearchPath *overridePath;
 	List	   *parsetree_list;
 	ListCell   *parsetree_item;
 	Oid			owner_uid;
 	Oid			saved_uid;
 	int			save_sec_context;
+	int			save_nestlevel;
+	char	   *nsp = namespace_search_path;
 	AclResult	aclresult;
 	ObjectAddress address;
+	StringInfoData pathbuf;
 	bool		shouldDispatch = (Gp_role == GP_ROLE_DISPATCH && 
 								  !IsBootstrapProcessingMode());
 
@@ -92,7 +95,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
 		InitTempTableNamespace();
 		return InvalidOid;
 	}
-
+#if 0
 	if (stmt->pop_search_path)
 	{
 		Assert(Gp_role == GP_ROLE_EXECUTE);
@@ -102,7 +105,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
 
 		return InvalidOid;
 	}
-
+#endif
 	GetUserIdAndSecContext(&saved_uid, &save_sec_context);
 
 	/*
@@ -253,14 +256,26 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
 	CommandCounterIncrement();
 
 	/*
-	 * Temporarily make the new namespace be the front of the search path, as
-	 * well as the default creation target namespace.  This will be undone at
-	 * the end of this routine, or upon error.
+	 * Prepend the new schema to the current search path.
+	 *
+	 * We use the equivalent of a function SET option to allow the setting to
+	 * persist for exactly the duration of the schema creation.  guc.c also
+	 * takes care of undoing the setting on error.
 	 */
-	overridePath = GetOverrideSearchPath(CurrentMemoryContext);
-	overridePath->schemas = lcons_oid(namespaceId, overridePath->schemas);
-	/* XXX should we clear overridePath->useTemp? */
-	PushOverrideSearchPath(overridePath);
+	save_nestlevel = NewGUCNestLevel();
+
+	initStringInfo(&pathbuf);
+	appendStringInfoString(&pathbuf, quote_identifier(schemaName));
+
+	while (scanner_isspace(*nsp))
+		nsp++;
+
+	if (*nsp != '\0')
+		appendStringInfo(&pathbuf, ", %s", nsp);
+
+	(void) set_config_option("search_path", pathbuf.data,
+							 PGC_USERSET, PGC_S_SESSION,
+							 GUC_ACTION_SAVE, true, 0, false);
 
 	/*
 	 * Report the new schema to possibly interested event triggers.  Note we
@@ -314,29 +329,10 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
 		CommandCounterIncrement();
 	}
 
-	if (shouldDispatch)
-	{
-		elog(DEBUG5, "shouldDispatch = true, namespaceOid = %d, pop_search_path = true", namespaceId);
-
-		/*
-		 * Final dispatch to notify QE call PopOverrideSearchPath so that side effects
-		 * are not visible for later commands.
-		 */
-		stmt->pop_search_path = true;
-		CdbDispatchUtilityStatement((Node *) stmt,
-									DF_CANCEL_ON_ERROR |
-									DF_WITH_SNAPSHOT |
-									DF_NEED_TWO_PHASE,
-									GetAssignedOidsForDispatch(),
-									NULL);
-		stmt->pop_search_path = false;
-	}
-
-	if (Gp_role != GP_ROLE_EXECUTE)
-	{
-		/* Reset search path to normal state */
-		PopOverrideSearchPath();
-	}
+	/*
+	 * Restore the GUC variable search_path we set above.
+	 */
+	AtEOXact_GUC(true, save_nestlevel);
 
 	/* Reset current user and security context */
 	SetUserIdAndSecContext(saved_uid, save_sec_context);
diff --git a/src/test/regress/expected/namespace.out b/src/test/regress/expected/namespace.out
index 7fd91d4fa3..d2c5b18fe7 100644
--- a/src/test/regress/expected/namespace.out
+++ b/src/test/regress/expected/namespace.out
@@ -1,6 +1,14 @@
 --
 -- Regression tests for schemas (namespaces)
 --
+-- set the whitespace-only search_path to test that the
+-- GUC list syntax is preserved during a schema creation
+SELECT pg_catalog.set_config('search_path', ' ', false);
+ set_config 
+------------
+  
+(1 row)
+
 CREATE SCHEMA test_ns_schema_1
        CREATE INDEX abc_a_idx ON abc (a)
        CREATE VIEW abc_view AS
@@ -9,6 +17,43 @@ CREATE SCHEMA test_ns_schema_1
               a serial,
               b int UNIQUE
        ) DISTRIBUTED BY (b);
+-- verify that the correct search_path restored on abort
+SET search_path to public;
+BEGIN;
+SET search_path to public, test_ns_schema_1;
+CREATE SCHEMA test_ns_schema_2
+       CREATE VIEW abc_view AS SELECT c FROM abc;
+ERROR:  column "c" does not exist
+LINE 2:        CREATE VIEW abc_view AS SELECT c FROM abc;
+                                              ^
+COMMIT;
+SHOW search_path;
+ search_path 
+-------------
+ public
+(1 row)
+
+-- verify that the correct search_path preserved
+-- after creating the schema and on commit
+BEGIN;
+SET search_path to public, test_ns_schema_1;
+CREATE SCHEMA test_ns_schema_2
+       CREATE VIEW abc_view AS SELECT a FROM abc;
+SHOW search_path;
+       search_path        
+--------------------------
+ public, test_ns_schema_1
+(1 row)
+
+COMMIT;
+SHOW search_path;
+       search_path        
+--------------------------
+ public, test_ns_schema_1
+(1 row)
+
+DROP SCHEMA test_ns_schema_2 CASCADE;
+NOTICE:  drop cascades to view test_ns_schema_2.abc_view
 -- verify that the objects were created
 SELECT COUNT(*) FROM pg_class WHERE relnamespace =
     (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');
diff --git a/src/test/regress/sql/namespace.sql b/src/test/regress/sql/namespace.sql
index fea24c7f5b..2879672d78 100644
--- a/src/test/regress/sql/namespace.sql
+++ b/src/test/regress/sql/namespace.sql
@@ -2,6 +2,10 @@
 -- Regression tests for schemas (namespaces)
 --
 
+-- set the whitespace-only search_path to test that the
+-- GUC list syntax is preserved during a schema creation
+SELECT pg_catalog.set_config('search_path', ' ', false);
+
 CREATE SCHEMA test_ns_schema_1
        CREATE INDEX abc_a_idx ON abc (a)
 
@@ -13,6 +17,26 @@ CREATE SCHEMA test_ns_schema_1
               b int UNIQUE
        ) DISTRIBUTED BY (b);
 
+-- verify that the correct search_path restored on abort
+SET search_path to public;
+BEGIN;
+SET search_path to public, test_ns_schema_1;
+CREATE SCHEMA test_ns_schema_2
+       CREATE VIEW abc_view AS SELECT c FROM abc;
+COMMIT;
+SHOW search_path;
+
+-- verify that the correct search_path preserved
+-- after creating the schema and on commit
+BEGIN;
+SET search_path to public, test_ns_schema_1;
+CREATE SCHEMA test_ns_schema_2
+       CREATE VIEW abc_view AS SELECT a FROM abc;
+SHOW search_path;
+COMMIT;
+SHOW search_path;
+DROP SCHEMA test_ns_schema_2 CASCADE;
+
 -- verify that the objects were created
 SELECT COUNT(*) FROM pg_class WHERE relnamespace =
     (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 23/25: Fix the wrong permissions warning on the pgpass file (#16207)

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4ac70ed5669a23c6708b1fb39f1d4b4dadecb7e0
Author: Moonsn <mo...@gmail.com>
AuthorDate: Wed Sep 13 10:15:05 2023 +0800

    Fix the wrong permissions warning on the pgpass file (#16207)
    
    * Fix the false warning on the pgpass file
    
    The existing logic compares file modes using string comparison, which leads to false warnings on Python 3 due to the different mode representations ("0600" vs. "0o600"). To address this issue and enhance code efficiency, this PR proposes changing the comparison to an octal integer comparison. This not only eliminates false warnings but also ensures a more strict and faster comparison method, compatible with tools like "2to3".
---
 gpMgmt/bin/gppylib/db/dbconn.py                |  4 ++--
 gpMgmt/test/behave/mgmt_utils/gpstart.feature  |  2 ++
 gpMgmt/test/behave/mgmt_utils/steps/gpstart.py | 15 +++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/gpMgmt/bin/gppylib/db/dbconn.py b/gpMgmt/bin/gppylib/db/dbconn.py
index 1643e207ee..b85f802d02 100644
--- a/gpMgmt/bin/gppylib/db/dbconn.py
+++ b/gpMgmt/bin/gppylib/db/dbconn.py
@@ -38,9 +38,9 @@ class Pgpass():
             return
 
         st_info = os.stat(PGPASSFILE)
-        mode = str(oct(st_info[stat.ST_MODE] & 0o777))
+        mode = st_info[stat.ST_MODE] & 0o777
 
-        if mode != "0o600":
+        if mode != 0o600:
             print('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less' % PGPASSFILE)
             self.valid_pgpass = False
             return
diff --git a/gpMgmt/test/behave/mgmt_utils/gpstart.feature b/gpMgmt/test/behave/mgmt_utils/gpstart.feature
index e9a34b4b25..138ae04785 100644
--- a/gpMgmt/test/behave/mgmt_utils/gpstart.feature
+++ b/gpMgmt/test/behave/mgmt_utils/gpstart.feature
@@ -8,11 +8,13 @@ Feature: gpstart behave tests
           And a mirror has crashed
           And the database is not running
          When the user runs "gpstart -a"
+	  And pgpassfile is exists
          Then gpstart should return a return code of 0
           And gpstart should print "Skipping startup of segment marked down in configuration" to stdout
           And gpstart should print "Skipped segment starts \(segments are marked down in configuration\) += 1" to stdout
           And gpstart should print "Successfully started [0-9]+ of [0-9]+ segment instances, skipped 1 other segments" to stdout
           And gpstart should print "Number of segments not attempted to start: 1" to stdout
+	  And gpstart should not print "permissions should be" to stdout
 
     Scenario: gpstart starts even if the standby host is unreachable
         Given the database is running
diff --git a/gpMgmt/test/behave/mgmt_utils/steps/gpstart.py b/gpMgmt/test/behave/mgmt_utils/steps/gpstart.py
index 2046dbcae4..0bf339798b 100644
--- a/gpMgmt/test/behave/mgmt_utils/steps/gpstart.py
+++ b/gpMgmt/test/behave/mgmt_utils/steps/gpstart.py
@@ -91,6 +91,21 @@ def impl(context, cmd):
     context.stdout_message, context.stderr_message = p.communicate()
     context.ret_code = p.returncode
 
+@when('pgpassfile is exists')
+def impl(context):
+    """
+    Create a pgpassfile
+    """
+    user_dir = os.path.expanduser("~")
+    file_name = '.pgpass'
+    file_path = os.path.join(user_dir, file_name)
+    if not os.path.exists(file_path):
+        try:
+            with open(file_path, "w") as file:
+                os.chmod(file_path, 0o600)
+        except Exception as e:
+            print("create pgpass file error")
+
 @given('the host for the {seg_type} on content {content} is made unreachable')
 def impl(context, seg_type, content):
     if seg_type == "primary":


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 16/25: Disallow non-standalone ALTER distribution

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 40f3dc2c5842e7068d3f932551825d0ae2b61263
Author: soumyadeep2007 <so...@gmail.com>
AuthorDate: Wed Aug 30 13:20:01 2023 -0700

    Disallow non-standalone ALTER distribution
    
    If AT SET DISTRIBUTED BY, or AT SET WITH (reorganize=true|false) is run
    today along with another subcommand, it will result in ERRORs such as:
    
    ALTER TABLE foo ADD COLUMN c int, SET DISTRIBUTED BY(b);
    ERROR: attribute number 3 exceeds number of columns 2
    
    This kind of error results when the CTAS for the temp table is
    dispatched as part of ATExecSetDistributedBy(). Since SET DISTRIBUTED BY
    is run in the last pass, the ADD COLUMN takes effect on the QD and is
    considered as part of the dispatched QueryDesc for the CTAS. However,
    since the AT command has not been dispatched yet to the QEs (which only
    happens after ATController()), the QE hasn't yet applied the results of
    the ADD COLUMN operation.  Thus, the QEs cannot reconcile the reference
    to the added column, and an ERROR results.
    
    Other ERRORs can also result from having an inconsistent view of the
    catalog on the QEs in the CTAS.
    
    Supporting AT SET DISTRIBUTED BY with other subcommands would require
    abandoning the current approach, and aligining it with regular AT
    workflow. Since, that is a larger change, we ban such usage at the
    moment.
    
    Co-authored-by: Andrew Repp <re...@vmware.com>
---
 src/backend/commands/tablecmds.c                   | 36 ++++++++++++++++++++++
 .../regress/expected/alter_distribution_policy.out | 11 +++++++
 src/test/regress/sql/alter_distribution_policy.sql |  6 ++++
 3 files changed, 53 insertions(+)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index b32dd59dae..7e038bb8d7 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -582,6 +582,9 @@ static bool prebuild_temp_table(Relation rel, RangeVar *tmpname, DistributedBy *
 								bool isTmpTableAo, bool useExistingColumnAttributes);
 
 
+static void checkATSetDistributedByStandalone(AlteredTableInfo *tab, Relation rel);
+
+
 /* ----------------------------------------------------------------
  *		DefineRelation
  *				Creates a new relation.
@@ -6260,6 +6263,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab,
 			ATExecGenericOptions(rel, (List *) cmd->def);
 			break;
 		case AT_SetDistributedBy:	/* SET DISTRIBUTED BY */
+			checkATSetDistributedByStandalone(tab, rel);
 			ATExecSetDistributedBy(rel, (Node *) cmd->def, cmd);
 			break;
 		case AT_ExpandTable:	/* EXPAND TABLE */
@@ -23014,3 +23018,35 @@ ATSetTags(Relation rel, List *tags, bool unset)
 							 RelationGetRelationName(rel));
 	}
 }
+
+/*
+ * Check if AT SET DISTRIBUTED BY for this relation was specified in isolation.
+ * Currently, we don't allow AT SET DISTRIBUTED BY to be specified with other
+ * subcommands. This is due to the way that AT SET DISTRIBUTED BY is currently
+ * implemented: ATExecSetDistributedBy dispatches a CTAS, outside the regular
+ * AT dispatch workflow, which results in an inconsistent view of the catalog on
+ * the QEs.
+ */
+static void
+checkATSetDistributedByStandalone(AlteredTableInfo *tab, Relation rel)
+{
+	bool standalone = true;
+
+	for (int i = 0; i < AT_NUM_PASSES; ++i)
+	{
+		if (i != AT_PASS_MISC && list_length(tab->subcmds[i]) > 0)
+		{
+			standalone = false;
+			break;
+		}
+	}
+	if (list_length(tab->subcmds[AT_PASS_MISC]) > 1)
+		standalone = false;
+
+	if (!standalone)
+		ereport(ERROR,
+				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+					errmsg("cannot alter distribution with other subcommands for relation \"%s\"",
+						   RelationGetRelationName(rel)),
+					errhint("consider separating into multiple statements")));
+}
diff --git a/src/test/regress/expected/alter_distribution_policy.out b/src/test/regress/expected/alter_distribution_policy.out
index 32bddea03e..6f51650457 100644
--- a/src/test/regress/expected/alter_distribution_policy.out
+++ b/src/test/regress/expected/alter_distribution_policy.out
@@ -1764,3 +1764,14 @@ SELECT gp_segment_id,count(*) from t_reorganize_false GROUP BY 1;
 (1 row)
 
 DROP TABLE t_reorganize_false;
+-- Check that AT SET DISTRIBUTED BY cannot be combined with other subcommands
+-- on the same table
+CREATE TABLE atsdby_multiple(i int, j int);
+NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
+HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
+ALTER TABLE atsdby_multiple SET DISTRIBUTED BY(j), ADD COLUMN k int;
+ERROR:  cannot alter distribution with other subcommands for relation "atsdby_multiple"
+HINT:  consider separating into multiple statements
+ALTER TABLE atsdby_multiple SET WITH (reorganize=true), ADD COLUMN k int;
+ERROR:  cannot alter distribution with other subcommands for relation "atsdby_multiple"
+HINT:  consider separating into multiple statements
diff --git a/src/test/regress/sql/alter_distribution_policy.sql b/src/test/regress/sql/alter_distribution_policy.sql
index 269bb90096..feade3ed93 100644
--- a/src/test/regress/sql/alter_distribution_policy.sql
+++ b/src/test/regress/sql/alter_distribution_policy.sql
@@ -617,3 +617,9 @@ SELECT gp_segment_id,count(*) from t_reorganize_false GROUP BY 1;
 ALTER TABLE t_reorganize_false SET WITH (REORGANIZE=false) DISTRIBUTED RANDOMLY;
 SELECT gp_segment_id,count(*) from t_reorganize_false GROUP BY 1;
 DROP TABLE t_reorganize_false;
+
+-- Check that AT SET DISTRIBUTED BY cannot be combined with other subcommands
+-- on the same table
+CREATE TABLE atsdby_multiple(i int, j int);
+ALTER TABLE atsdby_multiple SET DISTRIBUTED BY(j), ADD COLUMN k int;
+ALTER TABLE atsdby_multiple SET WITH (reorganize=true), ADD COLUMN k int;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 17/25: Fix recursive CTE mergejoin having motion on WTS

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 546d7b8a9df7e0eac484236f020641d795d3e787
Author: Divyesh Vanjare <va...@vmware.com>
AuthorDate: Wed Aug 30 14:36:55 2023 -0400

    Fix recursive CTE mergejoin having motion on WTS
    
    For a recursive CTE, planner currently creates a mergejoin plan which
    moves the WorkTableScan results to a singleQE using
    CdbPathLocus_MakeSingleQE
    That would introduce motion in between Union and WorkTableScan. The
    WorkTableScan results should be local to each segment and shouldn't be
    broadcasted/moved to other segments. We shouldn't be allowing any motion
    in between Union and WorkTableScan. This commit adds a check for the
    last resort case to avoid adding that motion. If there is a WTS on any
    side in the last resort case, we should just fail (no possible plan
    using mergejoin)
    
    Added simplified test to force a mergejoin for such recursive CTE, the
    test shouldn't create a mergejoin plan.
    
    Co-authored-by: Zhenghua Lyu <zl...@pivotal.io>
    Co-authored-by: Alexandra Wang<le...@pivotal.io>
---
 src/backend/cdb/cdbpath.c                      |  9 ++-
 src/test/regress/expected/gp_recursive_cte.out | 81 ++++++++++++++++++++++++++
 src/test/regress/sql/gp_recursive_cte.sql      | 45 ++++++++++++++
 3 files changed, 132 insertions(+), 3 deletions(-)

diff --git a/src/backend/cdb/cdbpath.c b/src/backend/cdb/cdbpath.c
index 9eb95e087c..2d90f63ad9 100644
--- a/src/backend/cdb/cdbpath.c
+++ b/src/backend/cdb/cdbpath.c
@@ -2231,15 +2231,18 @@ cdbpath_motion_for_join(PlannerInfo *root,
 			CdbPathLocus_MakeReplicated(&large_rel->move_to,
 										CdbPathLocus_NumSegments(small_rel->locus), 0);
 
-		/* Last resort: Move both rels to a single qExec. */
-		else
+		/* Last resort: Move both rels to a single qExec
+		 * only if there is no wts on either rels*/
+		else if (!outer.has_wts && !inner.has_wts)
 		{
 			int numsegments = CdbPathLocus_CommonSegments(outer.locus,
 														  inner.locus);
 			CdbPathLocus_MakeSingleQE(&outer.move_to, numsegments);
 			CdbPathLocus_MakeSingleQE(&inner.move_to, numsegments);
 		}
-	} /* partitioned */
+		else
+			goto fail;
+	}							/* partitioned */
 
 	/*
 	 * Move outer.
diff --git a/src/test/regress/expected/gp_recursive_cte.out b/src/test/regress/expected/gp_recursive_cte.out
index e0f47dac81..389f888e6b 100644
--- a/src/test/regress/expected/gp_recursive_cte.out
+++ b/src/test/regress/expected/gp_recursive_cte.out
@@ -797,3 +797,84 @@ select * from cte;
  10
 (10 rows)
 
+-- Test recursive CTE when the non-recursive term is a table scan with a
+-- predicate on the distribution key, and the recursive term joins the CTE with
+-- the same table on its non-distribution key
+create table recursive_table_6(a numeric(4), b int);
+NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
+HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
+insert into recursive_table_6 values (0::numeric, 3);
+insert into recursive_table_6 values (2::numeric, 0);
+insert into recursive_table_6 values (5::numeric, 0);
+analyze recursive_table_6;
+SELECT $query$
+WITH RECURSIVE cte (i, j) AS (
+    SELECT a, b FROM recursive_table_6 WHERE a = 0::numeric::numeric
+    UNION ALL
+    SELECT a, b FROM recursive_table_6, cte WHERE cte.i = recursive_table_6.b
+)
+SELECT i, j FROM cte;
+$query$ AS qry \gset
+EXPLAIN (COSTS OFF)
+    :qry ;
+                                   QUERY PLAN                                    
+---------------------------------------------------------------------------------
+ Gather Motion 3:1  (slice1; segments: 3)
+   ->  Recursive Union
+         ->  Seq Scan on recursive_table_6
+               Filter: (a = '0'::numeric)
+         ->  Hash Join
+               Hash Cond: (cte.i = (recursive_table_6_1.b)::numeric)
+               ->  WorkTable Scan on cte
+               ->  Hash
+                     ->  Broadcast Motion 3:3  (slice2; segments: 3)
+                           ->  Seq Scan on recursive_table_6 recursive_table_6_1
+ Optimizer: Postgres query optimizer
+(11 rows)
+
+:qry ;
+ i | j 
+---+---
+ 0 | 3
+ 2 | 0
+ 5 | 0
+(3 rows)
+
+-- Test recursive CTE doesnt create a plan with motion on top of worktablescan
+CREATE TABLE t1 (a int, b int) DISTRIBUTED BY (a);
+SET enable_nestloop = off;
+SET enable_hashjoin = off;
+SET enable_mergejoin = on;
+explain (costs off) with recursive rcte as
+   (
+      ( select a, b, 1::integer recursion_level from t1 order by 1 )
+      union all
+      select parent_table.a, parent_table.b, rcte.recursion_level + 1
+      from
+      ( select a, b from t1 order by 1 ) parent_table
+      join rcte on rcte.b = parent_table.a
+   )
+select count(*) from rcte;
+                                   QUERY PLAN                                    
+---------------------------------------------------------------------------------
+ Finalize Aggregate
+   ->  Gather Motion 3:1  (slice1; segments: 3)
+         ->  Partial Aggregate
+               ->  Recursive Union
+                     ->  Sort
+                           Sort Key: t1.a
+                           ->  Seq Scan on t1
+                     ->  Nested Loop
+                           Join Filter: (t1_1.a = rcte.b)
+                           ->  WorkTable Scan on rcte
+                           ->  Materialize
+                                 ->  Broadcast Motion 3:3  (slice2; segments: 3)
+                                       ->  Sort
+                                             Sort Key: t1_1.a
+                                             ->  Seq Scan on t1 t1_1
+ Optimizer: Postgres query optimizer
+(16 rows)
+
+RESET enable_nestloop;
+RESET enable_hashjoin;
+RESET enable_mergejoin;
diff --git a/src/test/regress/sql/gp_recursive_cte.sql b/src/test/regress/sql/gp_recursive_cte.sql
index 90aeda8814..549a29fc86 100644
--- a/src/test/regress/sql/gp_recursive_cte.sql
+++ b/src/test/regress/sql/gp_recursive_cte.sql
@@ -518,3 +518,48 @@ with recursive cte (n) as
   ) q
 )
 select * from cte;
+
+-- Test recursive CTE when the non-recursive term is a table scan with a
+-- predicate on the distribution key, and the recursive term joins the CTE with
+-- the same table on its non-distribution key
+create table recursive_table_6(a numeric(4), b int);
+insert into recursive_table_6 values (0::numeric, 3);
+insert into recursive_table_6 values (2::numeric, 0);
+insert into recursive_table_6 values (5::numeric, 0);
+analyze recursive_table_6;
+
+SELECT $query$
+WITH RECURSIVE cte (i, j) AS (
+    SELECT a, b FROM recursive_table_6 WHERE a = 0::numeric::numeric
+    UNION ALL
+    SELECT a, b FROM recursive_table_6, cte WHERE cte.i = recursive_table_6.b
+)
+SELECT i, j FROM cte;
+$query$ AS qry \gset
+
+EXPLAIN (COSTS OFF)
+    :qry ;
+
+:qry ;
+
+-- Test recursive CTE doesnt create a plan with motion on top of worktablescan
+CREATE TABLE t1 (a int, b int) DISTRIBUTED BY (a);
+SET enable_nestloop = off;
+SET enable_hashjoin = off;
+SET enable_mergejoin = on;
+
+explain (costs off) with recursive rcte as
+   (
+      ( select a, b, 1::integer recursion_level from t1 order by 1 )
+      union all
+
+      select parent_table.a, parent_table.b, rcte.recursion_level + 1
+      from
+      ( select a, b from t1 order by 1 ) parent_table
+      join rcte on rcte.b = parent_table.a
+   )
+select count(*) from rcte;
+
+RESET enable_nestloop;
+RESET enable_hashjoin;
+RESET enable_mergejoin;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 05/25: Rewrite test interrupt_holdoff_count

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 84748f577521643f0b52202eda4581f18436307d
Author: Evgeniy Ratkov <e....@arenadata.io>
AuthorDate: Mon Aug 7 10:33:18 2023 +0300

    Rewrite test interrupt_holdoff_count
    
    This commit fixes test, which was added at commit 50e66c76acf19d09ac7f0fc05cca01e014bb0ab8
    ```
    begin;
    declare c1 cursor for select count(*) from t_15278 group by sqrt(a);
    abort;
    select pg_cancel_backend(pg_backend_pid());
    ```
    Above old version test checks that after some errors generated on segment,
    InterruptHoldoffCount should be reset to 0 on QD.
    However, this is flaky:
    QD does not wait result of declare cursor, If error on segments occurs after declare finished,
    This error is processed when abort is called.
    At some cases abort is called before error is generated on segment.
    It led to situation, when there is not any errors on segments and abort
    is executed with success result. This test requires error to check
    InterruptHoldoffCount after query which ended with error.
    
    New version of the test uses existing inject fault, which generate error on segment at create table.
    create table ends with error and InterruptHoldoffCount can be checked correctly.
    
    Co-authored-by: Vasiliy Ivanov <iv...@arenadata.io>
---
 .../regress/expected/interrupt_holdoff_count.out   | 24 ++++++++++++++++------
 src/test/regress/greenplum_schedule                |  3 ++-
 src/test/regress/sql/interrupt_holdoff_count.sql   | 16 ++++++++-------
 3 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/src/test/regress/expected/interrupt_holdoff_count.out b/src/test/regress/expected/interrupt_holdoff_count.out
index 44827d8b41..98f8763460 100644
--- a/src/test/regress/expected/interrupt_holdoff_count.out
+++ b/src/test/regress/expected/interrupt_holdoff_count.out
@@ -1,13 +1,19 @@
 -- test for Github Issue 15278
 -- QD should reset InterruptHoldoffCount
+-- start_ignore
+create extension if not exists gp_inject_fault;
+-- end_ignore
+select gp_inject_fault('start_prepare', 'error', dbid, current_setting('gp_session_id')::int)
+	from gp_segment_configuration where content = 0 and role = 'p';
+ gp_inject_fault 
+-----------------
+ Success:
+(1 row)
+
 create table t_15278(a int, b int);
 NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
 HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
-insert into t_15278 values (-1,1);
-begin;
-declare c1 cursor for select count(*) from t_15278 group by sqrt(a);
-abort;
-ERROR:  cannot take square root of a negative number  (seg2 slice2 127.0.1.1:7004 pid=489428)
+ERROR:  fault triggered, fault name:'start_prepare' fault type:'error'  (seg0 127.0.1.1:6002 pid=764409)
 -- Without fix, the above transaction will lead
 -- QD's global var InterruptHoldoffCount not reset to 0
 -- thus the below SQL will return t. After fixing, now
@@ -15,4 +21,10 @@ ERROR:  cannot take square root of a negative number  (seg2 slice2 127.0.1.1:700
 -- the correct behavior.
 select pg_cancel_backend(pg_backend_pid());
 ERROR:  canceling statement due to user request
-drop table t_15278;
+select gp_inject_fault('start_prepare', 'reset', dbid, current_setting('gp_session_id')::int)
+	from gp_segment_configuration where content = 0 and role = 'p';
+ gp_inject_fault 
+-----------------
+ Success:
+(1 row)
+
diff --git a/src/test/regress/greenplum_schedule b/src/test/regress/greenplum_schedule
index 781ba141d2..3da977b786 100755
--- a/src/test/regress/greenplum_schedule
+++ b/src/test/regress/greenplum_schedule
@@ -169,7 +169,8 @@ test: wrkloadadmin
 test: trig auth_constraint role portals_updatable plpgsql_cache timeseries pg_stat_last_operation pg_stat_last_shoperation gp_numeric_agg partindex_test partition_pruning runtime_stats expand_table expand_table_ao expand_table_aoco expand_table_regression shrink_table
 
 # direct dispatch tests
-test: direct_dispatch bfv_dd bfv_dd_multicolumn bfv_dd_types interrupt_holdoff_count
+test: direct_dispatch bfv_dd bfv_dd_multicolumn bfv_dd_types
+test: interrupt_holdoff_count
 
 test: bfv_catalog bfv_index bfv_olap bfv_aggregate bfv_partition_plans DML_over_joins bfv_statistic nested_case_null sort bb_mpph aggregate_with_groupingsets gporca gpsd
 # Run minirepro separately to avoid concurrent deletes erroring out the internal pg_dump call
diff --git a/src/test/regress/sql/interrupt_holdoff_count.sql b/src/test/regress/sql/interrupt_holdoff_count.sql
index e5e44fae29..9334c30268 100644
--- a/src/test/regress/sql/interrupt_holdoff_count.sql
+++ b/src/test/regress/sql/interrupt_holdoff_count.sql
@@ -1,11 +1,13 @@
 -- test for Github Issue 15278
 -- QD should reset InterruptHoldoffCount
-create table t_15278(a int, b int);
-insert into t_15278 values (-1,1);
+-- start_ignore
+create extension if not exists gp_inject_fault;
+-- end_ignore
+
+select gp_inject_fault('start_prepare', 'error', dbid, current_setting('gp_session_id')::int)
+	from gp_segment_configuration where content = 0 and role = 'p';
 
-begin;
-declare c1 cursor for select count(*) from t_15278 group by sqrt(a);
-abort;
+create table t_15278(a int, b int);
 
 -- Without fix, the above transaction will lead
 -- QD's global var InterruptHoldoffCount not reset to 0
@@ -14,5 +16,5 @@ abort;
 -- the correct behavior.
 select pg_cancel_backend(pg_backend_pid());
 
-drop table t_15278;
-
+select gp_inject_fault('start_prepare', 'reset', dbid, current_setting('gp_session_id')::int)
+	from gp_segment_configuration where content = 0 and role = 'p';


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 06/25: Added test case for pr 15283 (#15528)

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit dbae11e750cb43133d9da8036586185d8551019f
Author: Rakesh Sharma <sh...@vmware.com>
AuthorDate: Wed May 24 09:34:20 2023 +0530

    Added test case for pr 15283 (#15528)
    
    1. Updated code to use get_stderr() instead of get_result().stderr
    2. Added test case for retry count.
---
 gpMgmt/bin/gppylib/commands/base.py                     | 2 +-
 gpMgmt/bin/gppylib/commands/test/unit/test_unit_base.py | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gpMgmt/bin/gppylib/commands/base.py b/gpMgmt/bin/gppylib/commands/base.py
index e5c2a98c54..8201a727bc 100755
--- a/gpMgmt/bin/gppylib/commands/base.py
+++ b/gpMgmt/bin/gppylib/commands/base.py
@@ -524,7 +524,7 @@ class RemoteExecutionContext(LocalExecutionContext):
             return
         time.sleep(SSH_RETRY_DELAY)
         LocalExecutionContext.execute(self, cmd, pickled)
-        if (cmd.get_results().stderr.startswith('ssh_exchange_identification: Connection closed by remote host')):
+        if (cmd.get_stderr().startswith('ssh_exchange_identification: Connection closed by remote host')):
             self.__retry(cmd, count + 1, pickled)
 
 class Command(object):
diff --git a/gpMgmt/bin/gppylib/commands/test/unit/test_unit_base.py b/gpMgmt/bin/gppylib/commands/test/unit/test_unit_base.py
index 71231a5da1..6de0f145ed 100644
--- a/gpMgmt/bin/gppylib/commands/test/unit/test_unit_base.py
+++ b/gpMgmt/bin/gppylib/commands/test/unit/test_unit_base.py
@@ -4,6 +4,7 @@
 #
 
 import unittest
+from mock import call, Mock, patch, ANY
 from gppylib.commands.base import Command, WorkerPool, RemoteExecutionContext, GPHOME, LocalExecutionContext
 
 
@@ -53,3 +54,11 @@ class WorkerPoolTestCase(unittest.TestCase):
         self.subject.execute(cmd)
         self.assertEqual("bar=1 && foo=1 && ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 localhost "
                           "\". gphome/greenplum_path.sh; bar=1 && foo=1 && ls /tmp\"", cmd.cmdStr)
+
+    @patch('gppylib.commands.base.Command.get_stderr',
+           return_value="ssh_exchange_identification: Connection closed by remote host")
+    def test_RemoteExecutionContext_failed_and_retry(self,mock):
+        self.subject = RemoteExecutionContext('localhost',None,'gphome' )
+        cmd = Command('test', cmdStr='ls /tmp')
+        self.subject.execute(cmd)
+        self.assertEqual(Command.get_stderr.call_count, 11)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 01/25: Do not use immediate restart in regress test

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b21d8dc5f2c552426a58c42fceab647647790750
Author: Huansong Fu <fu...@gmail.com>
AuthorDate: Tue Aug 1 11:37:54 2023 -0700

    Do not use immediate restart in regress test
    
    There is nothing wrong with doing that for the tests themselves, but it has an
    implication to a bug #16120 where restarting w/o checkpoint can create orphaned
    files and results in the failure of test gp_check_fiels. While that issue is
    dealt with separately, for now turn the restart mode to fast to avoid the issue.
    
    We ignored isolation2 tests for now because gp_check_files are not covering them
    (and it would be really hard to cover, given so many intentional crash/panic or
    other ad-hoc scenarios that we are doing in isolation2 could create orphaned
    files... I don't see us do that anytime soon).
---
 .../expected/resource_manager_restore_to_none.out  | 27 +---------------------
 .../expected/resource_manager_switch_to_queue.out  | 23 +-----------------
 src/test/regress/expected/instr_in_shmem_setup.out |  2 +-
 src/test/regress/sql/instr_in_shmem_setup.sql      |  2 +-
 4 files changed, 4 insertions(+), 50 deletions(-)

diff --git a/gpcontrib/gp_toolkit/expected/resource_manager_restore_to_none.out b/gpcontrib/gp_toolkit/expected/resource_manager_restore_to_none.out
index d20126183d..0146db7bbf 100644
--- a/gpcontrib/gp_toolkit/expected/resource_manager_restore_to_none.out
+++ b/gpcontrib/gp_toolkit/expected/resource_manager_restore_to_none.out
@@ -5,32 +5,7 @@
 \! echo $?
 0
 -- start_ignore
-\! gpstop -rai
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Starting gpstop with args: -rai
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Gathering information and validating the environment...
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Obtaining Greenplum Coordinator catalog information
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Obtaining Segment details from coordinator...
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 7.0.0-alpha.0+dev.16142.g1f3e5a0825 build dev'
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Commencing Coordinator instance shutdown with mode='immediate'
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Coordinator segment instance directory=/home/gpadmin/zxj/workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Attempting forceful termination of any leftover coordinator process
-20230110:23:11:33:400128 gpstop:ubuntu:gpadmin-[INFO]:-Terminating processes for segment /home/gpadmin/zxj/workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1
-20230110:23:11:34:400128 gpstop:ubuntu:gpadmin-[INFO]:-Stopping coordinator standby host ubuntu mode=immediate
-20230110:23:11:35:400128 gpstop:ubuntu:gpadmin-[INFO]:-Successfully shutdown standby process on ubuntu
-20230110:23:11:35:400128 gpstop:ubuntu:gpadmin-[INFO]:-Targeting dbid [2, 5, 3, 6, 4, 7] for shutdown
-20230110:23:11:35:400128 gpstop:ubuntu:gpadmin-[INFO]:-Commencing parallel primary segment instance shutdown, please wait...
-20230110:23:11:35:400128 gpstop:ubuntu:gpadmin-[INFO]:-0.00% of jobs completed
-20230110:23:11:35:400128 gpstop:ubuntu:gpadmin-[INFO]:-100.00% of jobs completed
-20230110:23:11:35:400128 gpstop:ubuntu:gpadmin-[INFO]:-Commencing parallel mirror segment instance shutdown, please wait...
-20230110:23:11:35:400128 gpstop:ubuntu:gpadmin-[INFO]:-0.00% of jobs completed
-20230110:23:11:36:400128 gpstop:ubuntu:gpadmin-[INFO]:-100.00% of jobs completed
-20230110:23:11:36:400128 gpstop:ubuntu:gpadmin-[INFO]:-----------------------------------------------------
-20230110:23:11:36:400128 gpstop:ubuntu:gpadmin-[INFO]:-   Segments stopped successfully      = 6
-20230110:23:11:36:400128 gpstop:ubuntu:gpadmin-[INFO]:-   Segments with errors during stop   = 0
-20230110:23:11:36:400128 gpstop:ubuntu:gpadmin-[INFO]:-----------------------------------------------------
-20230110:23:11:36:400128 gpstop:ubuntu:gpadmin-[INFO]:-Successfully shutdown 6 of 6 segment instances 
-20230110:23:11:36:400128 gpstop:ubuntu:gpadmin-[INFO]:-Database successfully shutdown with no errors reported
-20230110:23:11:36:400128 gpstop:ubuntu:gpadmin-[INFO]:-Restarting System...
+\! gpstop -raf
 -- end_ignore
 \! echo $?
 0
diff --git a/gpcontrib/gp_toolkit/expected/resource_manager_switch_to_queue.out b/gpcontrib/gp_toolkit/expected/resource_manager_switch_to_queue.out
index c1065a0e63..4f0f7ead74 100644
--- a/gpcontrib/gp_toolkit/expected/resource_manager_switch_to_queue.out
+++ b/gpcontrib/gp_toolkit/expected/resource_manager_switch_to_queue.out
@@ -5,28 +5,7 @@
 \! echo $?
 0
 -- start_ignore
-\! gpstop -rai
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Starting gpstop with args: -rai
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Gathering information and validating the environment...
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Obtaining Greenplum Coordinator catalog information
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Obtaining Segment details from coordinator...
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 7.0.0-alpha.0+dev.16117.g367b82d8d9 build dev'
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Commencing Coordinator instance shutdown with mode='immediate'
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Coordinator segment instance directory=/home/gpadmin/zxj/workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Attempting forceful termination of any leftover coordinator process
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Terminating processes for segment /home/gpadmin/zxj/workspace/gpdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-No standby coordinator host configured
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Targeting dbid [2, 3, 4] for shutdown
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-Commencing parallel segment instance shutdown, please wait...
-20230109:22:58:10:221895 gpstop:ubuntu:gpadmin-[INFO]:-0.00% of jobs completed
-20230109:22:58:11:221895 gpstop:ubuntu:gpadmin-[INFO]:-100.00% of jobs completed
-20230109:22:58:11:221895 gpstop:ubuntu:gpadmin-[INFO]:-----------------------------------------------------
-20230109:22:58:11:221895 gpstop:ubuntu:gpadmin-[INFO]:-   Segments stopped successfully      = 3
-20230109:22:58:11:221895 gpstop:ubuntu:gpadmin-[INFO]:-   Segments with errors during stop   = 0
-20230109:22:58:11:221895 gpstop:ubuntu:gpadmin-[INFO]:-----------------------------------------------------
-20230109:22:58:11:221895 gpstop:ubuntu:gpadmin-[INFO]:-Successfully shutdown 3 of 3 segment instances 
-20230109:22:58:11:221895 gpstop:ubuntu:gpadmin-[INFO]:-Database successfully shutdown with no errors reported
-20230109:22:58:11:221895 gpstop:ubuntu:gpadmin-[INFO]:-Restarting System...
+\! gpstop -raf
 -- end_ignore
 \! echo $?
 0
diff --git a/src/test/regress/expected/instr_in_shmem_setup.out b/src/test/regress/expected/instr_in_shmem_setup.out
index 0c62b8480c..e23e72b7a4 100644
--- a/src/test/regress/expected/instr_in_shmem_setup.out
+++ b/src/test/regress/expected/instr_in_shmem_setup.out
@@ -4,5 +4,5 @@
 -- will check for leaks of instrumentation slots in shmem.
 -- start_ignore
 \! gpconfig -c gp_enable_query_metrics -v on 
-\! PGDATESTYLE="" gpstop -rai
+\! PGDATESTYLE="" gpstop -raf
 -- end_ignore
diff --git a/src/test/regress/sql/instr_in_shmem_setup.sql b/src/test/regress/sql/instr_in_shmem_setup.sql
index 1effaa0585..ee54570624 100644
--- a/src/test/regress/sql/instr_in_shmem_setup.sql
+++ b/src/test/regress/sql/instr_in_shmem_setup.sql
@@ -5,5 +5,5 @@
 
 -- start_ignore
 \! gpconfig -c gp_enable_query_metrics -v on 
-\! PGDATESTYLE="" gpstop -rai
+\! PGDATESTYLE="" gpstop -raf
 -- end_ignore


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 22/25: Bring work_mem out of deprecation

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a9f26d7cd5e692c308083b3b7fa61aea2841aee5
Author: soumyadeep2007 <so...@gmail.com>
AuthorDate: Thu Sep 7 11:05:49 2023 -0700

    Bring work_mem out of deprecation
    
    work_mem still enjoys abundant use in our codebase. Although, we would
    like to replace it with operatorMemKB, that kind of change will require
    significant investment and a careful strategy. So, bring it out of
    deprecation for now.
    
    Discussion: https://groups.google.com/a/greenplum.org/g/gpdb-dev/c/GgOxTgaMJsA/m/004-RkHDFAAJ
    
    Reviewed-by: Ashwin Agrawal <aa...@vmware.com>
---
 src/backend/utils/misc/guc.c                       |  2 +-
 .../plpgsql/src/expected/plpgsql_transaction.out   |  3 ---
 src/test/regress/expected/aggregates.out           |  4 ----
 src/test/regress/expected/aggregates_optimizer.out |  4 ----
 src/test/regress/expected/bitmapops.out            |  1 -
 src/test/regress/expected/bitmapops_optimizer.out  |  1 -
 src/test/regress/expected/groupingsets.out         |  5 -----
 .../regress/expected/groupingsets_optimizer.out    |  5 -----
 src/test/regress/expected/guc.out                  | 23 ----------------------
 src/test/regress/expected/guc_gp.out               |  2 --
 src/test/regress/expected/join.out                 |  2 --
 src/test/regress/expected/join_hash.out            | 18 -----------------
 src/test/regress/expected/join_hash_optimizer.out  | 18 -----------------
 src/test/regress/expected/join_optimizer.out       |  2 --
 src/test/regress/expected/memoize.out              |  2 --
 src/test/regress/expected/memoize_optimizer.out    |  2 --
 src/test/regress/expected/rangefuncs.out           |  2 --
 src/test/regress/expected/rangefuncs_optimizer.out |  2 --
 src/test/regress/expected/select_distinct.out      |  2 --
 .../regress/expected/select_distinct_optimizer.out |  2 --
 src/test/regress/expected/select_parallel.out      |  2 --
 src/test/regress/expected/tuplesort.out            |  3 ---
 src/test/regress/expected/tuplesort_optimizer.out  |  3 ---
 src/test/regress/output/aocs.source                |  1 -
 src/test/regress/output/appendonly.source          |  1 -
 .../singlenode_regress/expected/aggregates.out     |  4 ----
 src/test/singlenode_regress/expected/bitmapops.out |  1 -
 .../singlenode_regress/expected/groupingsets.out   |  5 -----
 src/test/singlenode_regress/expected/guc.out       | 23 ----------------------
 .../expected/incremental_sort.out                  |  2 --
 src/test/singlenode_regress/expected/join.out      |  2 --
 src/test/singlenode_regress/expected/join_hash.out | 18 -----------------
 src/test/singlenode_regress/expected/memoize.out   |  2 --
 .../singlenode_regress/expected/rangefuncs.out     |  2 --
 .../expected/select_distinct.out                   |  2 --
 .../expected/select_parallel.out                   |  2 --
 src/test/singlenode_regress/expected/tuplesort.out |  3 ---
 .../expected/workfile/hashagg_spill.out            |  3 ---
 .../expected/workfile/hashjoin_spill.out           |  1 -
 src/test/singlenode_regress/output/aocs.source     |  1 -
 40 files changed, 1 insertion(+), 182 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 6e3fbb9b5b..474b840e0c 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -2499,7 +2499,7 @@ static struct config_int ConfigureNamesInt[] =
 	},
 
 	{
-		{"work_mem", PGC_USERSET, DEPRECATED_OPTIONS,
+		{"work_mem", PGC_USERSET, RESOURCES_MEM,
 			gettext_noop("Sets the maximum memory to be used for query workspaces."),
 			gettext_noop("This much memory can be used by each internal "
 						 "sort operation and hash table before switching to "
diff --git a/src/pl/plpgsql/src/expected/plpgsql_transaction.out b/src/pl/plpgsql/src/expected/plpgsql_transaction.out
index 6ff66090c6..12575fe185 100644
--- a/src/pl/plpgsql/src/expected/plpgsql_transaction.out
+++ b/src/pl/plpgsql/src/expected/plpgsql_transaction.out
@@ -127,10 +127,7 @@ BEGIN
     COMMIT;
 END;
 $$;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 CALL transaction_test5();
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 ERROR:  invalid transaction termination
 CONTEXT:  PL/pgSQL function transaction_test5() line 3 at COMMIT
 -- SECURITY DEFINER currently disallow transaction statements
diff --git a/src/test/regress/expected/aggregates.out b/src/test/regress/expected/aggregates.out
index e37086c15f..c1f2efcc10 100644
--- a/src/test/regress/expected/aggregates.out
+++ b/src/test/regress/expected/aggregates.out
@@ -3081,7 +3081,6 @@ reset enable_memoize;
 --
 set enable_sort=false;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select unique1, count(*), sum(twothousand) from tenk1
 group by unique1
 having sum(fivethous) > 4975
@@ -3139,14 +3138,12 @@ order by sum(twothousand);
 (48 rows)
 
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_sort to default;
 --
 -- Compare results between plans using sorting and plans using hash
 -- aggregation. Force spilling in both cases by setting work_mem low.
 --
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 create table agg_data_2k as
 select g from generate_series(0, 1999) g;
 analyze agg_data_2k;
@@ -3235,7 +3232,6 @@ select (g/2)::numeric as c1, array_agg(g::numeric) as c2, count(*) as c3
   from agg_data_2k group by g/2;
 set enable_sort = true;
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Compare group aggregation results to hash aggregation results
 (select * from agg_hash_1 except select * from agg_group_1)
   union all
diff --git a/src/test/regress/expected/aggregates_optimizer.out b/src/test/regress/expected/aggregates_optimizer.out
index 706baf06ec..842b35fd0e 100644
--- a/src/test/regress/expected/aggregates_optimizer.out
+++ b/src/test/regress/expected/aggregates_optimizer.out
@@ -3404,7 +3404,6 @@ reset enable_memoize;
 --
 set enable_sort=false;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select unique1, count(*), sum(twothousand) from tenk1
 group by unique1
 having sum(fivethous) > 4975
@@ -3462,14 +3461,12 @@ order by sum(twothousand);
 (48 rows)
 
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_sort to default;
 --
 -- Compare results between plans using sorting and plans using hash
 -- aggregation. Force spilling in both cases by setting work_mem low.
 --
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 create table agg_data_2k as
 select g from generate_series(0, 1999) g;
 NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause. Creating a NULL policy entry.
@@ -3565,7 +3562,6 @@ select (g/2)::numeric as c1, array_agg(g::numeric) as c2, count(*) as c3
 NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause. Creating a NULL policy entry.
 set enable_sort = true;
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Compare group aggregation results to hash aggregation results
 (select * from agg_hash_1 except select * from agg_group_1)
   union all
diff --git a/src/test/regress/expected/bitmapops.out b/src/test/regress/expected/bitmapops.out
index b3d094aa98..d0d36f8635 100644
--- a/src/test/regress/expected/bitmapops.out
+++ b/src/test/regress/expected/bitmapops.out
@@ -23,7 +23,6 @@ set enable_indexscan=false;
 set enable_seqscan=false;
 -- Lower work_mem to trigger use of lossy bitmaps
 set work_mem = 64;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Test bitmap-and.
 SELECT count(*) FROM bmscantest WHERE a = 1 AND b = 1;
  count 
diff --git a/src/test/regress/expected/bitmapops_optimizer.out b/src/test/regress/expected/bitmapops_optimizer.out
index e374e380b4..74a7890e57 100644
--- a/src/test/regress/expected/bitmapops_optimizer.out
+++ b/src/test/regress/expected/bitmapops_optimizer.out
@@ -25,7 +25,6 @@ set enable_indexscan=false;
 set enable_seqscan=false;
 -- Lower work_mem to trigger use of lossy bitmaps
 set work_mem = 64;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Test bitmap-and.
 SELECT count(*) FROM bmscantest WHERE a = 1 AND b = 1;
  count 
diff --git a/src/test/regress/expected/groupingsets.out b/src/test/regress/expected/groupingsets.out
index a1c532f638..ae84ced248 100644
--- a/src/test/regress/expected/groupingsets.out
+++ b/src/test/regress/expected/groupingsets.out
@@ -1863,7 +1863,6 @@ select array(select row(v.a,s1.*) from (select two,four, count(*) from onek grou
 -- test the knapsack
 set enable_indexscan = false;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select unique1,
          count(two), count(four), count(ten),
@@ -1916,7 +1915,6 @@ explain (costs off)
 (14 rows)
 
 set work_mem = '384kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select unique1,
          count(two), count(four), count(ten),
@@ -1976,7 +1974,6 @@ update pg_class set reltuples = 10 where relname='bug_16784';
 ERROR:  permission denied: "pg_class" is a system catalog
 insert into bug_16784 select g/10, g from generate_series(1,40) g;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_sort = false;
 select * from
   (values (1),(2)) v(a),
@@ -2173,7 +2170,6 @@ WARNING:  autovacuum is not supported in Cloudberry
 update pg_class set reltuples = 10 where relname='gs_data_1';
 ERROR:  permission denied: "pg_class" is a system catalog
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Produce results with sorting.
 set enable_sort = true;
 set enable_hashagg = false;
@@ -2242,7 +2238,6 @@ group by cube (g1000,g100,g10) distributed by (g1000);
 set jit_above_cost to default;
 set enable_sort = true;
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Compare results of ORCA plan that relies on "IS NOT DISTINCT FROM" HASH Join
 (select * from gs_hash_1 except select * from gs_group_1)
   union all
diff --git a/src/test/regress/expected/groupingsets_optimizer.out b/src/test/regress/expected/groupingsets_optimizer.out
index c32318311f..979383088b 100644
--- a/src/test/regress/expected/groupingsets_optimizer.out
+++ b/src/test/regress/expected/groupingsets_optimizer.out
@@ -1925,7 +1925,6 @@ select array(select row(v.a,s1.*) from (select two,four, count(*) from onek grou
 -- test the knapsack
 set enable_indexscan = false;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select unique1,
          count(two), count(four), count(ten),
@@ -2038,7 +2037,6 @@ explain (costs off)
 (39 rows)
 
 set work_mem = '384kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select unique1,
          count(two), count(four), count(ten),
@@ -2135,7 +2133,6 @@ update pg_class set reltuples = 10 where relname='bug_16784';
 ERROR:  permission denied: "pg_class" is a system catalog
 insert into bug_16784 select g/10, g from generate_series(1,40) g;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_sort = false;
 select * from
   (values (1),(2)) v(a),
@@ -2332,7 +2329,6 @@ WARNING:  autovacuum is not supported in Cloudberry
 update pg_class set reltuples = 10 where relname='gs_data_1';
 ERROR:  permission denied: "pg_class" is a system catalog
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Produce results with sorting.
 set enable_sort = true;
 set enable_hashagg = false;
@@ -2427,7 +2423,6 @@ group by cube (g1000,g100,g10) distributed by (g1000);
 set jit_above_cost to default;
 set enable_sort = true;
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Compare results of ORCA plan that relies on "IS NOT DISTINCT FROM" HASH Join
 (select * from gs_hash_1 except select * from gs_group_1)
   union all
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 723a3e6dc0..7f2bdc4503 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -679,23 +679,17 @@ reset search_path;
 -- Tests for function-local GUC settings
 --
 set work_mem = '3MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 create function report_guc(text) returns text as
 $$ select current_setting($1) $$ language sql
 set work_mem = '1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select report_guc('work_mem'), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  report_guc | current_setting 
 ------------+-----------------
  1MB        | 3MB
 (1 row)
 
 alter function report_guc(text) set work_mem = '2MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select report_guc('work_mem'), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  report_guc | current_setting 
 ------------+-----------------
  2MB        | 3MB
@@ -716,11 +710,7 @@ begin
 end $$
 language plpgsql
 set work_mem = '1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select myfunc(0), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  myfunc | current_setting 
 --------+-----------------
  2MB    | 3MB
@@ -728,14 +718,12 @@ WARNING:  "work_mem": setting is deprecated, and may be removed in a future rele
 
 alter function myfunc(int) reset all;
 select myfunc(0), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  myfunc | current_setting 
 --------+-----------------
  2MB    | 2MB
 (1 row)
 
 set work_mem = '3MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- but SET isn't
 create or replace function myfunc(int) returns text as $$
 begin
@@ -744,18 +732,13 @@ begin
 end $$
 language plpgsql
 set work_mem = '1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select myfunc(0), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  myfunc | current_setting 
 --------+-----------------
  2MB    | 2MB
 (1 row)
 
 set work_mem = '3MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- it should roll back on error, though
 create or replace function myfunc(int) returns text as $$
 begin
@@ -765,12 +748,8 @@ begin
 end $$
 language plpgsql
 set work_mem = '1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select myfunc(0);
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 ERROR:  division by zero
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 CONTEXT:  SQL statement "SELECT 1/$1"
 PL/pgSQL function myfunc(integer) line 4 at PERFORM
 select current_setting('work_mem');
@@ -780,8 +759,6 @@ select current_setting('work_mem');
 (1 row)
 
 select myfunc(1), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  myfunc | current_setting 
 --------+-----------------
  2MB    | 2MB
diff --git a/src/test/regress/expected/guc_gp.out b/src/test/regress/expected/guc_gp.out
index 01c675ea8f..2cae6b7204 100644
--- a/src/test/regress/expected/guc_gp.out
+++ b/src/test/regress/expected/guc_gp.out
@@ -101,9 +101,7 @@ DROP FUNCTION if exists test_call_set_command();
 -- a SET command. If this stops emitting a WARNING in the future, we'll need
 -- another way to detect that the GUC's assign-hook is called only once.
 set work_mem='1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 --
 -- Test if RESET timezone is dispatched to all slices
 --
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index 43e4fb3823..b2ae0fdfce 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -2598,7 +2598,6 @@ reset enable_nestloop;
 -- like it does on PostgreSQL?
 -- end_ignore
 set work_mem to '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_mergejoin to off;
 set enable_memoize to off;
 explain (costs off)
@@ -2627,7 +2626,6 @@ select count(*) from tenk1 a, tenk1 b
 (1 row)
 
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 reset enable_mergejoin;
 reset enable_memoize;
 --
diff --git a/src/test/regress/expected/join_hash.out b/src/test/regress/expected/join_hash.out
index 2a817e6972..5171a7d9cf 100644
--- a/src/test/regress/expected/join_hash.out
+++ b/src/test/regress/expected/join_hash.out
@@ -94,7 +94,6 @@ ANALYZE wide;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from simple r join simple s using (id);
                      QUERY PLAN                     
@@ -131,7 +130,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local enable_parallel_hash = off;
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -169,7 +167,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local enable_parallel_hash = on;
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -210,7 +207,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -248,7 +244,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -287,7 +282,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '192kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -330,7 +324,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) FROM simple r JOIN bigger_than_it_looks s USING (id);
@@ -368,7 +361,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -407,7 +399,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 1;
 set local work_mem = '192kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -451,7 +442,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from simple r join extremely_skewed s using (id);
@@ -488,7 +478,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -526,7 +515,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 1;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -565,7 +553,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local parallel_leader_participation = off;
 select * from hash_join_batches(
 $$
@@ -596,7 +583,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from join_foo
@@ -652,7 +638,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from join_foo
     left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss
@@ -707,7 +692,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from join_foo
@@ -763,7 +747,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from join_foo
     left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss
@@ -928,7 +911,6 @@ savepoint settings;
 set max_parallel_workers_per_gather = 2;
 set enable_parallel_hash = on;
 set work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 insert into wide select generate_series(3, 100) as id, rpad('', 320000, 'x') as t;
 explain (costs off)
   select length(max(s.t))
diff --git a/src/test/regress/expected/join_hash_optimizer.out b/src/test/regress/expected/join_hash_optimizer.out
index 516d35fcd1..35458411ed 100644
--- a/src/test/regress/expected/join_hash_optimizer.out
+++ b/src/test/regress/expected/join_hash_optimizer.out
@@ -99,7 +99,6 @@ ANALYZE wide;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from simple r join simple s using (id);
                                   QUERY PLAN                                  
@@ -140,7 +139,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local enable_parallel_hash = off;
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -182,7 +180,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local enable_parallel_hash = on;
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -227,7 +224,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -269,7 +265,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -312,7 +307,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '192kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -359,7 +353,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) FROM simple r JOIN bigger_than_it_looks s USING (id);
@@ -398,7 +391,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -438,7 +430,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 1;
 set local work_mem = '192kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -483,7 +474,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from simple r join extremely_skewed s using (id);
@@ -527,7 +517,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -572,7 +561,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 1;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -618,7 +606,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local parallel_leader_participation = off;
 select * from hash_join_batches(
 $$
@@ -651,7 +638,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from join_foo
@@ -711,7 +697,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from join_foo
     left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss
@@ -770,7 +755,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from join_foo
@@ -830,7 +814,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from join_foo
     left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss
@@ -1017,7 +1000,6 @@ savepoint settings;
 set max_parallel_workers_per_gather = 2;
 set enable_parallel_hash = on;
 set work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 insert into wide select generate_series(3, 100) as id, rpad('', 320000, 'x') as t;
 explain (costs off)
   select length(max(s.t))
diff --git a/src/test/regress/expected/join_optimizer.out b/src/test/regress/expected/join_optimizer.out
index 4b73785d62..1c7b3a3d03 100644
--- a/src/test/regress/expected/join_optimizer.out
+++ b/src/test/regress/expected/join_optimizer.out
@@ -2625,7 +2625,6 @@ reset enable_nestloop;
 -- regression test for bug #13908 (hash join with skew tuples & nbatch increase)
 --
 set work_mem to '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_mergejoin to off;
 set enable_memoize to off;
 explain (costs off)
@@ -2654,7 +2653,6 @@ select count(*) from tenk1 a, tenk1 b
 (1 row)
 
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 reset enable_mergejoin;
 reset enable_memoize;
 --
diff --git a/src/test/regress/expected/memoize.out b/src/test/regress/expected/memoize.out
index 58c2e43657..e55034b305 100644
--- a/src/test/regress/expected/memoize.out
+++ b/src/test/regress/expected/memoize.out
@@ -104,7 +104,6 @@ WHERE t1.unique1 < 1000;
 
 -- Reduce work_mem so that we see some cache evictions
 SET work_mem TO '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 SET enable_mergejoin TO off;
 -- Ensure we get some evictions.  We're unable to validate the hits and misses
 -- here as the number of entries that fit in the cache at once will vary
@@ -260,7 +259,6 @@ WHERE unique1 < 3
 RESET enable_seqscan;
 RESET enable_mergejoin;
 RESET work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 RESET enable_bitmapscan;
 RESET enable_hashjoin;
 -- Test parallel plans with Memoize
diff --git a/src/test/regress/expected/memoize_optimizer.out b/src/test/regress/expected/memoize_optimizer.out
index 4c4d0f989c..2e10828436 100644
--- a/src/test/regress/expected/memoize_optimizer.out
+++ b/src/test/regress/expected/memoize_optimizer.out
@@ -100,7 +100,6 @@ WHERE t1.unique1 < 1000;
 
 -- Reduce work_mem so that we see some cache evictions
 SET work_mem TO '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 SET enable_mergejoin TO off;
 -- Ensure we get some evictions.  We're unable to validate the hits and misses
 -- here as the number of entries that fit in the cache at once will vary
@@ -253,7 +252,6 @@ WHERE unique1 < 3
 RESET enable_seqscan;
 RESET enable_mergejoin;
 RESET work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 RESET enable_bitmapscan;
 RESET enable_hashjoin;
 -- Test parallel plans with Memoize
diff --git a/src/test/regress/expected/rangefuncs.out b/src/test/regress/expected/rangefuncs.out
index eaba6dd8e8..dffab4d8f1 100644
--- a/src/test/regress/expected/rangefuncs.out
+++ b/src/test/regress/expected/rangefuncs.out
@@ -1788,7 +1788,6 @@ create function rngfunc1(n integer, out a text, out b text)
   language sql
   as $$ select 'foo ' || i, 'bar ' || i from generate_series(1,$1) i $$;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select t.a, t, t.a from rngfunc1(10000) t limit 1;
    a   |         t         |   a   
 -------+-------------------+-------
@@ -1796,7 +1795,6 @@ select t.a, t, t.a from rngfunc1(10000) t limit 1;
 (1 row)
 
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select t.a, t, t.a from rngfunc1(10000) t limit 1;
    a   |         t         |   a   
 -------+-------------------+-------
diff --git a/src/test/regress/expected/rangefuncs_optimizer.out b/src/test/regress/expected/rangefuncs_optimizer.out
index 01dc04fd4f..31784b180a 100644
--- a/src/test/regress/expected/rangefuncs_optimizer.out
+++ b/src/test/regress/expected/rangefuncs_optimizer.out
@@ -1790,7 +1790,6 @@ create function rngfunc1(n integer, out a text, out b text)
   language sql
   as $$ select 'foo ' || i, 'bar ' || i from generate_series(1,$1) i $$;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select t.a, t, t.a from rngfunc1(10000) t limit 1;
    a   |         t         |   a   
 -------+-------------------+-------
@@ -1798,7 +1797,6 @@ select t.a, t, t.a from rngfunc1(10000) t limit 1;
 (1 row)
 
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select t.a, t, t.a from rngfunc1(10000) t limit 1;
    a   |         t         |   a   
 -------+-------------------+-------
diff --git a/src/test/regress/expected/select_distinct.out b/src/test/regress/expected/select_distinct.out
index f463e61ef0..ab75aacaae 100644
--- a/src/test/regress/expected/select_distinct.out
+++ b/src/test/regress/expected/select_distinct.out
@@ -165,7 +165,6 @@ SELECT count(*) FROM
 -- aggregation. Force spilling in both cases by setting work_mem low.
 --
 SET work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Produce results with sorting.
 SET enable_hashagg=FALSE;
 SET optimizer_enable_hashagg=FALSE;
@@ -207,7 +206,6 @@ CREATE TABLE distinct_hash_2 AS
 SELECT DISTINCT (g%1000)::text FROM generate_series(0,9999) g;
 SET enable_sort=TRUE;
 SET work_mem TO DEFAULT;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Compare results
 (SELECT * FROM distinct_hash_1 EXCEPT SELECT * FROM distinct_group_1)
   UNION ALL
diff --git a/src/test/regress/expected/select_distinct_optimizer.out b/src/test/regress/expected/select_distinct_optimizer.out
index 702bb6c23f..57b27b557e 100644
--- a/src/test/regress/expected/select_distinct_optimizer.out
+++ b/src/test/regress/expected/select_distinct_optimizer.out
@@ -164,7 +164,6 @@ SELECT count(*) FROM
 -- aggregation. Force spilling in both cases by setting work_mem low.
 --
 SET work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Produce results with sorting.
 SET enable_hashagg=FALSE;
 SET optimizer_enable_hashagg=FALSE;
@@ -212,7 +211,6 @@ SELECT DISTINCT (g%1000)::text FROM generate_series(0,9999) g;
 NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause. Creating a NULL policy entry.
 SET enable_sort=TRUE;
 SET work_mem TO DEFAULT;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Compare results
 (SELECT * FROM distinct_hash_1 EXCEPT SELECT * FROM distinct_group_1)
   UNION ALL
diff --git a/src/test/regress/expected/select_parallel.out b/src/test/regress/expected/select_parallel.out
index ba3ee7ef55..eb36bb11f8 100644
--- a/src/test/regress/expected/select_parallel.out
+++ b/src/test/regress/expected/select_parallel.out
@@ -534,7 +534,6 @@ BEGIN
 EXCEPTION WHEN invalid_parameter_value THEN
 END $$;
 set work_mem='64kB';  --set small work mem to force lossy pages
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
 	select count(*) from tenk1, tenk2 where tenk1.hundred > 1 and tenk2.thousand=0;
                                   QUERY PLAN                                  
@@ -596,7 +595,6 @@ explain (analyze, timing off, summary off, costs off)
 
 alter table tenk2 reset (parallel_workers);
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 create function explain_parallel_sort_stats() returns setof text
 language plpgsql as
 $$
diff --git a/src/test/regress/expected/tuplesort.out b/src/test/regress/expected/tuplesort.out
index 1f63355d8b..745615afe0 100644
--- a/src/test/regress/expected/tuplesort.out
+++ b/src/test/regress/expected/tuplesort.out
@@ -411,7 +411,6 @@ COMMIT;
 BEGIN;
 SET LOCAL enable_indexscan = false;
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- unfortunately can't show analyze output confirming sort method,
 -- the memory used output wouldn't be stable
 EXPLAIN (COSTS OFF) DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing;
@@ -492,7 +491,6 @@ FROM (
 -- disk based (see also above)
 BEGIN;
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 SELECT
     (array_agg(id ORDER BY id DESC NULLS FIRST))[0:5],
     (array_agg(abort_increasing ORDER BY abort_increasing DESC NULLS LAST))[0:5],
@@ -580,7 +578,6 @@ EXPLAIN (COSTS OFF) :qry;
 
 -- test mark/restore with on-disk sorts
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 EXPLAIN (COSTS OFF) :qry;
                                                                                        QUERY PLAN                                                                                        
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/src/test/regress/expected/tuplesort_optimizer.out b/src/test/regress/expected/tuplesort_optimizer.out
index b5a8b7e12e..60ac968a80 100644
--- a/src/test/regress/expected/tuplesort_optimizer.out
+++ b/src/test/regress/expected/tuplesort_optimizer.out
@@ -407,7 +407,6 @@ COMMIT;
 BEGIN;
 SET LOCAL enable_indexscan = false;
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- unfortunately can't show analyze output confirming sort method,
 -- the memory used output wouldn't be stable
 EXPLAIN (COSTS OFF) DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing;
@@ -488,7 +487,6 @@ FROM (
 -- disk based (see also above)
 BEGIN;
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 SELECT
     (array_agg(id ORDER BY id DESC NULLS FIRST))[0:5],
     (array_agg(abort_increasing ORDER BY abort_increasing DESC NULLS LAST))[0:5],
@@ -576,7 +574,6 @@ EXPLAIN (COSTS OFF) :qry;
 
 -- test mark/restore with on-disk sorts
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 EXPLAIN (COSTS OFF) :qry;
                                                                                        QUERY PLAN                                                                                        
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/src/test/regress/output/aocs.source b/src/test/regress/output/aocs.source
index 5c38cc89d3..623e4a1e1e 100644
--- a/src/test/regress/output/aocs.source
+++ b/src/test/regress/output/aocs.source
@@ -1226,7 +1226,6 @@ insert into bms_ao_bug select 1, 1, a.c1::char(100) from generate_series(1, 2000
 create index bms_ao_bug_ix1 on bms_ao_bug (c2);
 set enable_seqscan=off;
 set work_mem=256;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select
 a.c1,
 count(*) row_cnt
diff --git a/src/test/regress/output/appendonly.source b/src/test/regress/output/appendonly.source
index 3bc178ca56..37032cf74d 100644
--- a/src/test/regress/output/appendonly.source
+++ b/src/test/regress/output/appendonly.source
@@ -1664,7 +1664,6 @@ insert into bms_ao_bug select 1, 1, a.c1::char(100) from generate_series(1, 2000
 create index bms_ao_bug_ix1 on bms_ao_bug (c2);
 set enable_seqscan=off;
 set work_mem=256;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select
 a.c1,
 count(*) row_cnt
diff --git a/src/test/singlenode_regress/expected/aggregates.out b/src/test/singlenode_regress/expected/aggregates.out
index 2b151573b1..e48b6dba5f 100644
--- a/src/test/singlenode_regress/expected/aggregates.out
+++ b/src/test/singlenode_regress/expected/aggregates.out
@@ -3043,7 +3043,6 @@ reset enable_memoize;
 --
 set enable_sort=false;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select unique1, count(*), sum(twothousand) from tenk1
 group by unique1
 having sum(fivethous) > 4975
@@ -3101,14 +3100,12 @@ order by sum(twothousand);
 (48 rows)
 
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_sort to default;
 --
 -- Compare results between plans using sorting and plans using hash
 -- aggregation. Force spilling in both cases by setting work_mem low.
 --
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 create table agg_data_2k as
 select g from generate_series(0, 1999) g;
 analyze agg_data_2k;
@@ -3192,7 +3189,6 @@ select (g/2)::numeric as c1, array_agg(g::numeric) as c2, count(*) as c3
   from agg_data_2k group by g/2;
 set enable_sort = true;
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Compare group aggregation results to hash aggregation results
 (select * from agg_hash_1 except select * from agg_group_1)
   union all
diff --git a/src/test/singlenode_regress/expected/bitmapops.out b/src/test/singlenode_regress/expected/bitmapops.out
index 05e9642234..3570973e3c 100644
--- a/src/test/singlenode_regress/expected/bitmapops.out
+++ b/src/test/singlenode_regress/expected/bitmapops.out
@@ -20,7 +20,6 @@ set enable_indexscan=false;
 set enable_seqscan=false;
 -- Lower work_mem to trigger use of lossy bitmaps
 set work_mem = 64;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Test bitmap-and.
 SELECT count(*) FROM bmscantest WHERE a = 1 AND b = 1;
  count 
diff --git a/src/test/singlenode_regress/expected/groupingsets.out b/src/test/singlenode_regress/expected/groupingsets.out
index 3480bdfa30..36872ea7a2 100644
--- a/src/test/singlenode_regress/expected/groupingsets.out
+++ b/src/test/singlenode_regress/expected/groupingsets.out
@@ -1734,7 +1734,6 @@ select array(select row(v.a,s1.*) from (select two,four, count(*) from onek grou
 -- test the knapsack
 set enable_indexscan = false;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select unique1,
          count(two), count(four), count(ten),
@@ -1780,7 +1779,6 @@ explain (costs off)
 (10 rows)
 
 set work_mem = '384kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select unique1,
          count(two), count(four), count(ten),
@@ -1838,7 +1836,6 @@ update pg_class set reltuples = 10 where relname='bug_16784';
 ERROR:  permission denied: "pg_class" is a system catalog
 insert into bug_16784 select g/10, g from generate_series(1,40) g;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_sort = false;
 select * from
   (values (1),(2)) v(a),
@@ -2035,7 +2032,6 @@ WARNING:  autovacuum is not supported in Cloudberry
 update pg_class set reltuples = 10 where relname='gs_data_1';
 ERROR:  permission denied: "pg_class" is a system catalog
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Produce results with sorting.
 set enable_sort = true;
 set enable_hashagg = false;
@@ -2095,7 +2091,6 @@ select g100, g10, sum(g::numeric), count(*), max(g::text)
 from gs_data_1 group by cube (g1000, g100,g10);
 set enable_sort = true;
 set work_mem to default;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- GPDB_12_MERGE_FIXME: the following comparison query has an ORCA plan that
 -- relies on "IS NOT DISTINCT FROM" Hash Join, a variant that we likely have
 -- lost during the merge with upstream Postgres 12. Disable ORCA for this query
diff --git a/src/test/singlenode_regress/expected/guc.out b/src/test/singlenode_regress/expected/guc.out
index 45c68e361f..59da91ff04 100644
--- a/src/test/singlenode_regress/expected/guc.out
+++ b/src/test/singlenode_regress/expected/guc.out
@@ -677,23 +677,17 @@ reset search_path;
 -- Tests for function-local GUC settings
 --
 set work_mem = '3MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 create function report_guc(text) returns text as
 $$ select current_setting($1) $$ language sql
 set work_mem = '1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select report_guc('work_mem'), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  report_guc | current_setting 
 ------------+-----------------
  1MB        | 3MB
 (1 row)
 
 alter function report_guc(text) set work_mem = '2MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select report_guc('work_mem'), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  report_guc | current_setting 
 ------------+-----------------
  2MB        | 3MB
@@ -714,11 +708,7 @@ begin
 end $$
 language plpgsql
 set work_mem = '1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select myfunc(0), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  myfunc | current_setting 
 --------+-----------------
  2MB    | 3MB
@@ -726,14 +716,12 @@ WARNING:  "work_mem": setting is deprecated, and may be removed in a future rele
 
 alter function myfunc(int) reset all;
 select myfunc(0), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  myfunc | current_setting 
 --------+-----------------
  2MB    | 2MB
 (1 row)
 
 set work_mem = '3MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- but SET isn't
 create or replace function myfunc(int) returns text as $$
 begin
@@ -742,18 +730,13 @@ begin
 end $$
 language plpgsql
 set work_mem = '1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select myfunc(0), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  myfunc | current_setting 
 --------+-----------------
  2MB    | 2MB
 (1 row)
 
 set work_mem = '3MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- it should roll back on error, though
 create or replace function myfunc(int) returns text as $$
 begin
@@ -763,12 +746,8 @@ begin
 end $$
 language plpgsql
 set work_mem = '1MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select myfunc(0);
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 ERROR:  division by zero
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 CONTEXT:  SQL statement "SELECT 1/$1"
 PL/pgSQL function myfunc(integer) line 4 at PERFORM
 select current_setting('work_mem');
@@ -778,8 +757,6 @@ select current_setting('work_mem');
 (1 row)
 
 select myfunc(1), current_setting('work_mem');
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
  myfunc | current_setting 
 --------+-----------------
  2MB    | 2MB
diff --git a/src/test/singlenode_regress/expected/incremental_sort.out b/src/test/singlenode_regress/expected/incremental_sort.out
index 179aeabaa8..7ee9e0dcff 100644
--- a/src/test/singlenode_regress/expected/incremental_sort.out
+++ b/src/test/singlenode_regress/expected/incremental_sort.out
@@ -36,7 +36,6 @@ limit 1;
 -- When work_mem is not enough to sort the entire table, incremental sort
 -- may be faster if individual groups still fit into work_mem.
 set work_mem to '2MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
 select * from (select * from tenk1 order by four) t order by four, ten;
              QUERY PLAN              
@@ -50,7 +49,6 @@ select * from (select * from tenk1 order by four) t order by four, ten;
 (6 rows)
 
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 create table t(a integer, b integer);
 create or replace function explain_analyze_without_memory(query text)
 returns table (out_line text) language plpgsql
diff --git a/src/test/singlenode_regress/expected/join.out b/src/test/singlenode_regress/expected/join.out
index 7764f910c0..12270f2e11 100644
--- a/src/test/singlenode_regress/expected/join.out
+++ b/src/test/singlenode_regress/expected/join.out
@@ -2547,7 +2547,6 @@ reset enable_nestloop;
 -- regression test for bug #13908 (hash join with skew tuples & nbatch increase)
 --
 set work_mem to '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set enable_mergejoin to off;
 set enable_memoize to off;
 explain (costs off)
@@ -2573,7 +2572,6 @@ select count(*) from tenk1 a, tenk1 b
 (1 row)
 
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 reset enable_mergejoin;
 reset enable_memoize;
 --
diff --git a/src/test/singlenode_regress/expected/join_hash.out b/src/test/singlenode_regress/expected/join_hash.out
index 8fb11eec0c..b663e9b117 100644
--- a/src/test/singlenode_regress/expected/join_hash.out
+++ b/src/test/singlenode_regress/expected/join_hash.out
@@ -94,7 +94,6 @@ ANALYZE wide;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from simple r join simple s using (id);
                QUERY PLAN               
@@ -129,7 +128,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local enable_parallel_hash = off;
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -165,7 +163,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local enable_parallel_hash = on;
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -204,7 +201,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from simple r join simple s using (id);
@@ -240,7 +236,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -277,7 +272,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '192kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -318,7 +312,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) FROM simple r JOIN bigger_than_it_looks s USING (id);
@@ -354,7 +347,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -391,7 +383,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 1;
 set local work_mem = '192kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -433,7 +424,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 0;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from simple r join extremely_skewed s using (id);
@@ -468,7 +458,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = off;
 explain (costs off)
@@ -504,7 +493,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 1;
 set local work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 set local enable_parallel_hash = on;
 explain (costs off)
@@ -541,7 +529,6 @@ rollback to settings;
 savepoint settings;
 set local max_parallel_workers_per_gather = 2;
 set local work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local parallel_leader_participation = off;
 select * from hash_join_batches(
 $$
@@ -572,7 +559,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from join_foo
@@ -624,7 +610,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from join_foo
     left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss
@@ -675,7 +660,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set local statement_mem = '1000kB'; -- GPDB uses statement_mem instead of work_mem
 explain (costs off)
   select count(*) from join_foo
@@ -727,7 +711,6 @@ set max_parallel_workers_per_gather = 2;
 set enable_material = off;
 set enable_mergejoin = off;
 set work_mem = '4MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
   select count(*) from join_foo
     left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss
@@ -873,7 +856,6 @@ savepoint settings;
 set max_parallel_workers_per_gather = 2;
 set enable_parallel_hash = on;
 set work_mem = '128kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 insert into wide select generate_series(3, 100) as id, rpad('', 320000, 'x') as t;
 explain (costs off)
   select length(max(s.t))
diff --git a/src/test/singlenode_regress/expected/memoize.out b/src/test/singlenode_regress/expected/memoize.out
index 3ce36a5342..bd0e829887 100644
--- a/src/test/singlenode_regress/expected/memoize.out
+++ b/src/test/singlenode_regress/expected/memoize.out
@@ -98,7 +98,6 @@ WHERE t1.unique1 < 1000;
 
 -- Reduce work_mem so that we see some cache evictions
 SET work_mem TO '64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 SET enable_mergejoin TO off;
 -- Ensure we get some evictions.  We're unable to validate the hits and misses
 -- here as the number of entries that fit in the cache at once will vary
@@ -243,7 +242,6 @@ WHERE unique1 < 3
 RESET enable_seqscan;
 RESET enable_mergejoin;
 RESET work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 RESET enable_bitmapscan;
 RESET enable_hashjoin;
 -- Test parallel plans with Memoize
diff --git a/src/test/singlenode_regress/expected/rangefuncs.out b/src/test/singlenode_regress/expected/rangefuncs.out
index da2ec13c50..4e16ec1d5d 100644
--- a/src/test/singlenode_regress/expected/rangefuncs.out
+++ b/src/test/singlenode_regress/expected/rangefuncs.out
@@ -1808,7 +1808,6 @@ create function rngfunc1(n integer, out a text, out b text)
   language sql
   as $$ select 'foo ' || i, 'bar ' || i from generate_series(1,$1) i $$;
 set work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select t.a, t, t.a from rngfunc1(10000) t limit 1;
    a   |         t         |   a   
 -------+-------------------+-------
@@ -1816,7 +1815,6 @@ select t.a, t, t.a from rngfunc1(10000) t limit 1;
 (1 row)
 
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select t.a, t, t.a from rngfunc1(10000) t limit 1;
    a   |         t         |   a   
 -------+-------------------+-------
diff --git a/src/test/singlenode_regress/expected/select_distinct.out b/src/test/singlenode_regress/expected/select_distinct.out
index 480b313f40..cf95ca032c 100644
--- a/src/test/singlenode_regress/expected/select_distinct.out
+++ b/src/test/singlenode_regress/expected/select_distinct.out
@@ -153,7 +153,6 @@ SELECT count(*) FROM
 -- aggregation. Force spilling in both cases by setting work_mem low.
 --
 SET work_mem='64kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Produce results with sorting.
 SET enable_hashagg=FALSE;
 SET jit_above_cost=0;
@@ -193,7 +192,6 @@ CREATE TABLE distinct_hash_2 AS
 SELECT DISTINCT (g%1000)::text FROM generate_series(0,9999) g;
 SET enable_sort=TRUE;
 SET work_mem TO DEFAULT;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- Compare results
 (SELECT * FROM distinct_hash_1 EXCEPT SELECT * FROM distinct_group_1)
   UNION ALL
diff --git a/src/test/singlenode_regress/expected/select_parallel.out b/src/test/singlenode_regress/expected/select_parallel.out
index b8c8eb18b4..59be57dfb9 100644
--- a/src/test/singlenode_regress/expected/select_parallel.out
+++ b/src/test/singlenode_regress/expected/select_parallel.out
@@ -479,7 +479,6 @@ BEGIN
 EXCEPTION WHEN invalid_parameter_value THEN
 END $$;
 set work_mem='64kB';  --set small work mem to force lossy pages
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 explain (costs off)
 	select count(*) from tenk1, tenk2 where tenk1.hundred > 1 and tenk2.thousand=0;
                       QUERY PLAN                      
@@ -531,7 +530,6 @@ explain (analyze, timing off, summary off, costs off)
 
 alter table tenk2 reset (parallel_workers);
 reset work_mem;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 create function explain_parallel_sort_stats() returns setof text
 language plpgsql as
 $$
diff --git a/src/test/singlenode_regress/expected/tuplesort.out b/src/test/singlenode_regress/expected/tuplesort.out
index 959fd50572..ed8b1180d5 100644
--- a/src/test/singlenode_regress/expected/tuplesort.out
+++ b/src/test/singlenode_regress/expected/tuplesort.out
@@ -398,7 +398,6 @@ COMMIT;
 BEGIN;
 SET LOCAL enable_indexscan = false;
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 -- unfortunately can't show analyze output confirming sort method,
 -- the memory used output wouldn't be stable
 EXPLAIN (COSTS OFF) DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing;
@@ -476,7 +475,6 @@ FROM (
 -- disk based (see also above)
 BEGIN;
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 SELECT
     (array_agg(id ORDER BY id DESC NULLS FIRST))[0:5],
     (array_agg(abort_increasing ORDER BY abort_increasing DESC NULLS LAST))[0:5],
@@ -554,7 +552,6 @@ EXPLAIN (COSTS OFF) :qry;
 
 -- test mark/restore with on-disk sorts
 SET LOCAL work_mem = '100kB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 EXPLAIN (COSTS OFF) :qry;
                                                                                  QUERY PLAN                                                                                  
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/src/test/singlenode_regress/expected/workfile/hashagg_spill.out b/src/test/singlenode_regress/expected/workfile/hashagg_spill.out
index 62a5f57369..4a61fc9709 100644
--- a/src/test/singlenode_regress/expected/workfile/hashagg_spill.out
+++ b/src/test/singlenode_regress/expected/workfile/hashagg_spill.out
@@ -40,7 +40,6 @@ insert into testhagg select i,i,i,i from
 analyze testhagg;
 set statement_mem="1800";
 set work_mem='1800';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set gp_resqueue_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
@@ -82,7 +81,6 @@ insert into aggspill select i, i*2, i::text from generate_series(1, 1000000) i;
 -- No spill with large statement memory 
 set statement_mem = '125MB';
 set work_mem='125MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select count(*) from (select i, count(*) from aggspill group by i,j having count(*) = 1) g;
  count  
 --------
@@ -92,7 +90,6 @@ select count(*) from (select i, count(*) from aggspill group by i,j having count
 -- Reduce the statement memory to induce spilling
 set statement_mem = '10MB';
 set work_mem='10MB';
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select * from hashagg_spill.is_workfile_created('explain (analyze, verbose)
 select count(*) from (select i, count(*) from aggspill group by i,j having count(*) = 2) g');
  is_workfile_created 
diff --git a/src/test/singlenode_regress/expected/workfile/hashjoin_spill.out b/src/test/singlenode_regress/expected/workfile/hashjoin_spill.out
index 7ae6395d23..f8edebbbd8 100644
--- a/src/test/singlenode_regress/expected/workfile/hashjoin_spill.out
+++ b/src/test/singlenode_regress/expected/workfile/hashjoin_spill.out
@@ -39,7 +39,6 @@ insert into test_hj_spill SELECT i,i,i%1000,i,i,i,i,i from
 	(select count(*) as nsegments from gp_segment_configuration where role='p' and content = -1) foo) bar;
 SET statement_mem=1024;
 set work_mem=1024;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 set gp_resqueue_print_operator_memory_limits=on;
 set gp_workfile_compression = on;
 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;
diff --git a/src/test/singlenode_regress/output/aocs.source b/src/test/singlenode_regress/output/aocs.source
index 558270e21d..91401dc0c3 100644
--- a/src/test/singlenode_regress/output/aocs.source
+++ b/src/test/singlenode_regress/output/aocs.source
@@ -1179,7 +1179,6 @@ insert into bms_ao_bug select 1, 1, a.c1::char(100) from generate_series(1, 2000
 create index bms_ao_bug_ix1 on bms_ao_bug (c2);
 set enable_seqscan=off;
 set work_mem=256;
-WARNING:  "work_mem": setting is deprecated, and may be removed in a future release.
 select
 a.c1,
 count(*) row_cnt


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 08/25: Make slabs and generations use gp_malloc|free

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 65209eb38308e2e8b4908f2c1a3cfdbb13a71047
Author: Soumyadeep Chakraborty <so...@gmail.com>
AuthorDate: Tue Aug 15 13:43:33 2023 -0700

    Make slabs and generations use gp_malloc|free
    
    We need to call gp_malloc|free() for the newly added MemoryContext types
    instead of malloc|free(), so that we can get the VMEM reservation etc.
    
    This was missed during the 12 merge.
    
    Reviewed-by: Brent Doil <bd...@vmware.com>
---
 src/backend/utils/mmgr/generation.c | 14 +++++++-------
 src/backend/utils/mmgr/slab.c       | 12 +++++++-----
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/backend/utils/mmgr/generation.c b/src/backend/utils/mmgr/generation.c
index c5b58209dd..9662f52069 100644
--- a/src/backend/utils/mmgr/generation.c
+++ b/src/backend/utils/mmgr/generation.c
@@ -39,10 +39,10 @@
 #include "postgres.h"
 
 #include "lib/ilist.h"
+#include "utils/gp_alloc.h"
 #include "utils/memdebug.h"
 #include "utils/memutils.h"
 
-
 #define Generation_BLOCKHDRSZ	MAXALIGN(sizeof(GenerationBlock))
 #define Generation_CHUNKHDRSZ	sizeof(GenerationChunk)
 
@@ -225,7 +225,7 @@ GenerationContextCreate(MemoryContext parent,
 	 * freeing the first generation of allocations.
 	 */
 
-	set = (GenerationContext *) malloc(MAXALIGN(sizeof(GenerationContext)));
+	set = (GenerationContext *) gp_malloc(MAXALIGN(sizeof(GenerationContext)));
 	if (set == NULL)
 	{
 		MemoryContextStats(TopMemoryContext);
@@ -288,7 +288,7 @@ GenerationReset(MemoryContext context)
 		wipe_mem(block, block->blksize);
 #endif
 
-		free(block);
+		gp_free(block);
 	}
 
 	set->block = NULL;
@@ -306,7 +306,7 @@ GenerationDelete(MemoryContext context, MemoryContext parent)
 	/* Reset to release all the GenerationBlocks */
 	GenerationReset(context);
 	/* And free the context header */
-	free(context);
+	gp_free(context);
 }
 
 /*
@@ -335,7 +335,7 @@ GenerationAlloc(MemoryContext context, Size size)
 	{
 		Size		blksize = chunk_size + Generation_BLOCKHDRSZ + Generation_CHUNKHDRSZ;
 
-		block = (GenerationBlock *) malloc(blksize);
+		block = (GenerationBlock *) gp_malloc(blksize);
 		if (block == NULL)
 			return NULL;
 
@@ -389,7 +389,7 @@ GenerationAlloc(MemoryContext context, Size size)
 	{
 		Size		blksize = set->blockSize;
 
-		block = (GenerationBlock *) malloc(blksize);
+		block = (GenerationBlock *) gp_malloc(blksize);
 
 		if (block == NULL)
 			return NULL;
@@ -510,7 +510,7 @@ GenerationFree(MemoryContext context, void *pointer)
 		set->block = NULL;
 
 	context->mem_allocated -= block->blksize;
-	free(block);
+	gp_free(block);
 }
 
 /*
diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c
index f553e567f8..afe7a39425 100644
--- a/src/backend/utils/mmgr/slab.c
+++ b/src/backend/utils/mmgr/slab.c
@@ -56,6 +56,8 @@
 #include "lib/ilist.h"
 #include "utils/memdebug.h"
 #include "utils/memutils.h"
+#include "utils/gp_alloc.h"
+#include "lib/ilist.h"
 
 /*
  * SlabContext is a specialized implementation of MemoryContext.
@@ -232,7 +234,7 @@ SlabContextCreate(MemoryContext parent,
 	headerSize += chunksPerBlock * sizeof(bool);
 #endif
 
-	slab = (SlabContext *) malloc(headerSize);
+	slab = (SlabContext *) gp_malloc(headerSize);
 	if (slab == NULL)
 	{
 		MemoryContextStats(TopMemoryContext);
@@ -311,7 +313,7 @@ SlabReset(MemoryContext context)
 #ifdef CLOBBER_FREED_MEMORY
 			wipe_mem(block, slab->blockSize);
 #endif
-			free(block);
+			gp_free(block);
 			slab->nblocks--;
 			context->mem_allocated -= slab->blockSize;
 		}
@@ -333,7 +335,7 @@ SlabDelete(MemoryContext context, MemoryContext parent)
 	/* Reset to release all the SlabBlocks */
 	SlabReset(context);
 	/* And free the context header */
-	free(context);
+	gp_free(context);
 }
 
 /*
@@ -368,7 +370,7 @@ SlabAlloc(MemoryContext context, Size size)
 	 */
 	if (slab->minFreeChunks == 0)
 	{
-		block = (SlabBlock *) malloc(slab->blockSize);
+		block = (SlabBlock *) gp_malloc(slab->blockSize);
 
 		if (block == NULL)
 			return NULL;
@@ -563,7 +565,7 @@ SlabFree(MemoryContext context, void *pointer)
 	/* If the block is now completely empty, free it. */
 	if (block->nfree == slab->chunksPerBlock)
 	{
-		free(block);
+		gp_free(block);
 		slab->nblocks--;
 		context->mem_allocated -= slab->blockSize;
 	}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 13/25: add some test results into .gitignore (#16254)

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3b2d07b605a24f0ec9d88707027580abb51f8706
Author: Zhenglong Li <lz...@vmware.com>
AuthorDate: Wed Aug 23 09:26:48 2023 +0800

    add some test results into .gitignore (#16254)
    
    add some resource group test results into .gitignore
---
 src/test/isolation2/.gitignore | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/test/isolation2/.gitignore b/src/test/isolation2/.gitignore
index 6c1667f11c..c95d47213b 100644
--- a/src/test/isolation2/.gitignore
+++ b/src/test/isolation2/.gitignore
@@ -13,6 +13,10 @@ sql/workfile_mgr_test.sql
 expected/workfile_mgr_test.out
 expected/idle_gang_cleaner.out
 sql/idle_gang_cleaner.sql
+expected/resgroup/resgroup_io_limit.out
+sql/resgroup/resgroup_io_limit.sql
+expected/resgroup/resgroup_views.out
+sql/resgroup/resgroup_views.sql
 
 -- ignore generated pg_basebackup tests
 /sql/pg_basebackup*.sql


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 07/25: Refine error message for EXCHANGE PARTITION ... WITH|WITHOU VALIDATION

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 62307f34ff86f31c9eee86e1f8ebec129beba425
Author: Huansong Fu <fu...@gmail.com>
AuthorDate: Mon Aug 7 10:52:13 2023 -0700

    Refine error message for EXCHANGE PARTITION ... WITH|WITHOU VALIDATION
    
    The error(NOTICE) meessage is too long. Move the details into errdetail().
    
    fix partition
---
 src/backend/parser/gram.y                         |  8 ++++----
 src/test/regress/expected/partition.out           |  5 +++--
 src/test/regress/expected/partition1.out          | 10 ++++++----
 src/test/regress/expected/partition_optimizer.out |  3 ++-
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index b27e137517..a93685bbbb 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -4174,8 +4174,8 @@ opt_table_partition_exchange_validate:
 			{
 				$$ = +1;
 				ereport(NOTICE,
-						(errmsg("specifying \"WITH VALIDATION\" acts as no operation. "
-								"If the new partition is a regular table, validation is performed "
+						(errmsg("specifying \"WITH VALIDATION\" acts as no operation"),
+						 errdetail("If the new partition is a regular table, validation is performed "
 								"to make sure all the rows obey partition constraint. "
 								"If the new partition is external or foreign table, no validation is performed.")));
 			}
@@ -4183,8 +4183,8 @@ opt_table_partition_exchange_validate:
 			{
 				$$ = +0;
 				ereport(NOTICE,
-						(errmsg("specifying \"WITHOUT VALIDATION\" acts as no operation. "
-								"If the new partition is a regular table, validation is performed "
+						(errmsg("specifying \"WITHOUT VALIDATION\" acts as no operation"),
+						 errdetail("If the new partition is a regular table, validation is performed "
 								"to make sure all the rows obey partition constraint. "
 								"If the new partition is external or foreign table, no validation is performed.")));
 			}
diff --git a/src/test/regress/expected/partition.out b/src/test/regress/expected/partition.out
index 5fc25d0e0c..87dd44fe9e 100755
--- a/src/test/regress/expected/partition.out
+++ b/src/test/regress/expected/partition.out
@@ -390,8 +390,9 @@ alter table foo_p exchange partition for(6) with table bar_p;
 ERROR:  partition constraint of relation "bar_p" is violated by some row  (seg2 127.0.1.1:7004 pid=1927394)
 alter table foo_p exchange partition for(6) with table bar_p without
 validation;
-NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation. If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
-ERROR:  partition constraint of relation "bar_p" is violated by some row  (seg2 127.0.1.1:7004 pid=1927394)
+NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
+ERROR:  partition constraint of relation "bar_p" is violated by some row  (seg2 127.0.0.1:7004 pid=4189072)
 analyze foo_p;
 select * from foo_p;
  i 
diff --git a/src/test/regress/expected/partition1.out b/src/test/regress/expected/partition1.out
index 9460b73c41..d3b3cac65d 100644
--- a/src/test/regress/expected/partition1.out
+++ b/src/test/regress/expected/partition1.out
@@ -2816,11 +2816,13 @@ NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as
 HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
 INSERT INTO exchange_tbl VALUES (100);
 ALTER TABLE validation_syntax_tbl EXCHANGE PARTITION p1 WITH TABLE exchange_tbl WITH VALIDATION;
-NOTICE:  specifying "WITH VALIDATION" acts as no operation. If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
-ERROR:  partition constraint of relation "exchange_tbl" is violated by some row  (seg2 127.0.1.1:7004 pid=1927274)
+NOTICE:  specifying "WITH VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
+ERROR:  partition constraint of relation "exchange_tbl" is violated by some row  (seg2 127.0.0.1:7004 pid=4188949)
 ALTER TABLE validation_syntax_tbl EXCHANGE PARTITION p1 WITH TABLE exchange_tbl WITHOUT VALIDATION;
-NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation. If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
-ERROR:  partition constraint of relation "exchange_tbl" is violated by some row  (seg2 127.0.1.1:7004 pid=1927274)
+NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
+ERROR:  partition constraint of relation "exchange_tbl" is violated by some row  (seg2 127.0.0.1:7004 pid=4188949)
 DROP TABLE exchange_tbl;
 DROP TABLE validation_syntax_tbl;
 --
diff --git a/src/test/regress/expected/partition_optimizer.out b/src/test/regress/expected/partition_optimizer.out
index 8ff25b93d9..4e6270642d 100755
--- a/src/test/regress/expected/partition_optimizer.out
+++ b/src/test/regress/expected/partition_optimizer.out
@@ -390,7 +390,8 @@ alter table foo_p exchange partition for(6) with table bar_p;
 ERROR:  partition constraint of relation "bar_p" is violated by some row
 alter table foo_p exchange partition for(6) with table bar_p without
 validation;
-NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation. If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
+NOTICE:  specifying "WITHOUT VALIDATION" acts as no operation
+DETAIL:  If the new partition is a regular table, validation is performed to make sure all the rows obey partition constraint. If the new partition is external or foreign table, no validation is performed.
 ERROR:  partition constraint of relation "bar_p" is violated by some row
 analyze foo_p;
 select * from foo_p;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 19/25: Remove unnecessary trailing semicolons from Python scripts. (#15976)

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7fb9b5c68805a969df10b859cf66678db646fdea
Author: Richy Wang <wa...@users.noreply.github.com>
AuthorDate: Wed Sep 6 09:45:26 2023 +0800

    Remove unnecessary trailing semicolons from Python scripts. (#15976)
    
    Ref: https://pylint.pycqa.org/en/latest/user_guide/messages/warning/unnecessary-semicolon.html
---
 gpMgmt/bin/gpload.py                           | 8 ++++----
 gpMgmt/bin/gppylib/commands/gp.py              | 4 ++--
 gpMgmt/bin/gppylib/commands/unix.py            | 2 +-
 gpMgmt/bin/gppylib/gpparseopts.py              | 2 +-
 gpMgmt/bin/gppylib/programs/clsSystemState.py  | 2 +-
 gpcontrib/gp_replica_check/gp_replica_check.py | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gpMgmt/bin/gpload.py b/gpMgmt/bin/gpload.py
index 9ac5fb4577..074456cc40 100755
--- a/gpMgmt/bin/gpload.py
+++ b/gpMgmt/bin/gpload.py
@@ -838,11 +838,11 @@ class CatThread(threading.Thread):
 
 def cli_help():
     help_path = os.path.join(sys.path[0], '..', 'docs', 'cli_help', EXECNAME +
-                             '_help');
+                             '_help')
     f = None
     try:
         try:
-            f = open(help_path);
+            f = open(help_path)
             return f.read(-1)
         except:
             return ''
@@ -1309,7 +1309,7 @@ class gpload:
                 pass
 
         if level == self.ERROR:
-            self.exitValue = 2;
+            self.exitValue = 2
             sys.exit(self.exitValue)
 
     def getconfig(self, a, typ=None, default='error', extraStuff='', returnOriginal=False):
@@ -2545,7 +2545,7 @@ WHERE relname = 'staging_gpload_reusable_%s';""" % (encoding_conditions)
                 results = self.db.query(queryStr).getresult()
                 global NUM_WARN_ROWS
                 NUM_WARN_ROWS = (results[0])[0]
-                return (results[0])[0];
+                return (results[0])[0]
         return 0
 
     def report_errors(self):
diff --git a/gpMgmt/bin/gppylib/commands/gp.py b/gpMgmt/bin/gppylib/commands/gp.py
index 528cba7963..7a2b3a7bc1 100644
--- a/gpMgmt/bin/gppylib/commands/gp.py
+++ b/gpMgmt/bin/gppylib/commands/gp.py
@@ -343,7 +343,7 @@ class CoordinatorStart(Command):
 
         # build pg_ctl command
         c = PgCtlStartArgs(dataDir, b, era, wrapper, wrapper_args, wait, timeout)
-        logger.info("CoordinatorStart pg_ctl cmd is %s", c);
+        logger.info("CoordinatorStart pg_ctl cmd is %s", c)
         self.cmdStr = str(c)
 
         Command.__init__(self, name, self.cmdStr, ctxt, remoteHost)
@@ -400,7 +400,7 @@ class SegmentStart(Command):
 
         # build pg_ctl command
         c = PgCtlStartArgs(datadir, b, era, wrapper, wrapper_args, pg_ctl_wait, timeout)
-        logger.info("SegmentStart pg_ctl cmd is %s", c);
+        logger.info("SegmentStart pg_ctl cmd is %s", c)
         self.cmdStr = str(c) + ' 2>&1'
 
         Command.__init__(self, name, self.cmdStr, ctxt, remoteHost)
diff --git a/gpMgmt/bin/gppylib/commands/unix.py b/gpMgmt/bin/gppylib/commands/unix.py
index f7854834b3..4708b7ac57 100644
--- a/gpMgmt/bin/gppylib/commands/unix.py
+++ b/gpMgmt/bin/gppylib/commands/unix.py
@@ -640,6 +640,6 @@ elif curr_platform == DARWIN:
 elif curr_platform == FREEBSD:
     SYSTEM = FreeBsdPlatform()
 elif curr_platform == OPENBSD:
-    SYSTEM = OpenBSDPlatform();
+    SYSTEM = OpenBSDPlatform()
 else:
     raise Exception("Platform %s is not supported.  Supported platforms are: %s", SYSTEM, str(platform_list))
diff --git a/gpMgmt/bin/gppylib/gpparseopts.py b/gpMgmt/bin/gppylib/gpparseopts.py
index 94d91fc2f8..b133dae8ba 100644
--- a/gpMgmt/bin/gppylib/gpparseopts.py
+++ b/gpMgmt/bin/gppylib/gpparseopts.py
@@ -60,7 +60,7 @@ class OptParser(OptionParser):
         f = None
         try:
             try:
-                f = open(help_path);
+                f = open(help_path)
                 return f.read(-1)
             except:
                 return None
diff --git a/gpMgmt/bin/gppylib/programs/clsSystemState.py b/gpMgmt/bin/gppylib/programs/clsSystemState.py
index d6979c0f32..f003b66799 100644
--- a/gpMgmt/bin/gppylib/programs/clsSystemState.py
+++ b/gpMgmt/bin/gppylib/programs/clsSystemState.py
@@ -188,7 +188,7 @@ class GpStateData:
         self.__currentSegmentData["values"][key] = value
         self.__currentSegmentData["isWarning"][key] = isWarning
 
-        assert key in self.__allValues;
+        assert key in self.__allValues
 
     def isClusterProbablyDown(self, gpArray):
         """
diff --git a/gpcontrib/gp_replica_check/gp_replica_check.py b/gpcontrib/gp_replica_check/gp_replica_check.py
index 5d4a3b41e8..93e0c9221b 100755
--- a/gpcontrib/gp_replica_check/gp_replica_check.py
+++ b/gpcontrib/gp_replica_check/gp_replica_check.py
@@ -49,7 +49,7 @@ class ReplicaCheck(threading.Thread):
         self.ploc = segrow[4]
         self.mloc = segrow[5]
         self.datname = datname.decode()
-        self.relation_types = relation_types;
+        self.relation_types = relation_types
         self.result = False
         self.lock = threading.Lock()
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 04/25: Add test case for PR 15279.

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a902d1fadb6767dc46bf9d22608dcd4cb610959c
Author: Zhenghua Lyu <ka...@gmail.com>
AuthorDate: Wed May 24 14:19:30 2023 +0800

    Add test case for PR 15279.
---
 src/test/regress/expected/interrupt_holdoff_count.out | 18 ++++++++++++++++++
 src/test/regress/greenplum_schedule                   |  2 +-
 src/test/regress/sql/interrupt_holdoff_count.sql      | 18 ++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/test/regress/expected/interrupt_holdoff_count.out b/src/test/regress/expected/interrupt_holdoff_count.out
new file mode 100644
index 0000000000..44827d8b41
--- /dev/null
+++ b/src/test/regress/expected/interrupt_holdoff_count.out
@@ -0,0 +1,18 @@
+-- test for Github Issue 15278
+-- QD should reset InterruptHoldoffCount
+create table t_15278(a int, b int);
+NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
+HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
+insert into t_15278 values (-1,1);
+begin;
+declare c1 cursor for select count(*) from t_15278 group by sqrt(a);
+abort;
+ERROR:  cannot take square root of a negative number  (seg2 slice2 127.0.1.1:7004 pid=489428)
+-- Without fix, the above transaction will lead
+-- QD's global var InterruptHoldoffCount not reset to 0
+-- thus the below SQL will return t. After fixing, now
+-- the below SQL will print an error message, this is
+-- the correct behavior.
+select pg_cancel_backend(pg_backend_pid());
+ERROR:  canceling statement due to user request
+drop table t_15278;
diff --git a/src/test/regress/greenplum_schedule b/src/test/regress/greenplum_schedule
index 56212e9ef1..781ba141d2 100755
--- a/src/test/regress/greenplum_schedule
+++ b/src/test/regress/greenplum_schedule
@@ -169,7 +169,7 @@ test: wrkloadadmin
 test: trig auth_constraint role portals_updatable plpgsql_cache timeseries pg_stat_last_operation pg_stat_last_shoperation gp_numeric_agg partindex_test partition_pruning runtime_stats expand_table expand_table_ao expand_table_aoco expand_table_regression shrink_table
 
 # direct dispatch tests
-test: direct_dispatch bfv_dd bfv_dd_multicolumn bfv_dd_types
+test: direct_dispatch bfv_dd bfv_dd_multicolumn bfv_dd_types interrupt_holdoff_count
 
 test: bfv_catalog bfv_index bfv_olap bfv_aggregate bfv_partition_plans DML_over_joins bfv_statistic nested_case_null sort bb_mpph aggregate_with_groupingsets gporca gpsd
 # Run minirepro separately to avoid concurrent deletes erroring out the internal pg_dump call
diff --git a/src/test/regress/sql/interrupt_holdoff_count.sql b/src/test/regress/sql/interrupt_holdoff_count.sql
new file mode 100644
index 0000000000..e5e44fae29
--- /dev/null
+++ b/src/test/regress/sql/interrupt_holdoff_count.sql
@@ -0,0 +1,18 @@
+-- test for Github Issue 15278
+-- QD should reset InterruptHoldoffCount
+create table t_15278(a int, b int);
+insert into t_15278 values (-1,1);
+
+begin;
+declare c1 cursor for select count(*) from t_15278 group by sqrt(a);
+abort;
+
+-- Without fix, the above transaction will lead
+-- QD's global var InterruptHoldoffCount not reset to 0
+-- thus the below SQL will return t. After fixing, now
+-- the below SQL will print an error message, this is
+-- the correct behavior.
+select pg_cancel_backend(pg_backend_pid());
+
+drop table t_15278;
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 12/25: Remove a FIXME in tupser.c

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 33e877344a6cf7d36c6f6ff468fd0b1bd9651273
Author: Huansong Fu <fu...@gmail.com>
AuthorDate: Tue Aug 22 15:03:17 2023 -0700

    Remove a FIXME in tupser.c
    
    The benefit from this optimization idea is plausible (basically, avoiding one
    memcpy of the memtuple), but the changes incurred by this are just too
    backwards and invasive for the effort to be worthy:
    
    1. There is no memtuple to directly serialize from. The `PRIVATE_tts_memtuple`
    field in `TupleTableSlot` is gone after the FIXME was added (d20e071e879).
    Basically we do not store the memtuple outside of the AM layer anymore (like in
    the executor memory). I think bringing `PRIVATE_tts_memtuple` back to
    `TupleTableSlot` and utilize it everywhere is a clear backward change.
    
    2. Assuming we somehow pass the memtuple into `SerializeTuple` as a function
    argument. But on the deserialization side, we would still need to deserialize
    it back to minimal tuple because all the deserilization logic and else utilizes
    minimal tuple now. The only way to avoid that is to carry memtuple around and
    use it, which is basically same as bringing `PRIVATE_tts_memtuple` back to
    `TupleTableSlot`. We also might have to bring back the concept of
    `GenericTuple`, and revert a lot of the changes that we have made to bring GPDB
    aligned with the AM framework which is a big milestone in 7X. Not very
    worthwhile IMO.
---
 src/backend/cdb/motion/tupser.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/backend/cdb/motion/tupser.c b/src/backend/cdb/motion/tupser.c
index f94d0c5e1a..e85be9e4f5 100644
--- a/src/backend/cdb/motion/tupser.c
+++ b/src/backend/cdb/motion/tupser.c
@@ -380,11 +380,6 @@ SerializeTuple(TupleTableSlot *slot, SerTupInfo *pSerInfo, struct directTranspor
 	tcList->serialized_data_length = 0;
 	tcList->max_chunk_length = Gp_max_tuple_chunk_size;
 
-	/*
-	 * GPDB_12_MERGE_FIXME: This used to support serializing memtuples directly.
-	 * That got removed with MinimalTuples in the merge. Resurrect the MemtUple
-	 * support if there's a performance benefit.
-	 */
 	/* Check if the slot has external attribute */
 	for (int i = 0; i < natts; i++)
 	{


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 03/25: Possible qual postponing past ANTI-JOIN/LASJ_NOTIN-JOIN.

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cf583e890fdfd63d12bc45120ef7e484af5eaed8
Author: dh-cloud <60...@users.noreply.github.com>
AuthorDate: Fri Jan 20 07:27:50 2023 +0800

    Possible qual postponing past ANTI-JOIN/LASJ_NOTIN-JOIN.
    
    When optimizer is off.
    
    For qual (NOT(EXISTS_SUBLINK) and EXPR_SUBLINK)
      or qual (NOT(ANY_SUBLINK) AND EXPR_SUBLINK)
    
    In pull_up_sublinks_qual(), after NOT(EXISTS_SUBLINK) is converted to
    Anti-JOIN (or NOT(ANY_SUBLINK) => LASJ_NOTIN-JOIN), if EXPR_SUBLINK is
    also successfully converted to INNER-JOIN (see convert_EXPR_to_join)
    , we can encounter the scenario where qual is postponed past the anti
    or lasj_notin join. It will trigger assertion failure:
    
      Assert(j->jointype == JOIN_INNER || j->jointype == JOIN_SEMI);
    
    > FATAL:  Unexpected internal error (assert.c:48)
    > DETAIL:  FailedAssertion("!(j->jointype == JOIN_INNER || j->jointype == JOIN_SEMI)", File: "initsplan.c", Line: 1018)
    > server closed the connection unexpectedly
    > ...
    
    We can easily reproduce this issue in master and 6X branch:
    
    ```
    CREATE TABLE A(id int, tt timestamp)
      DISTRIBUTED BY (id);
    
    SET optimizer TO off;
    
    -- j->jointype == JOIN_LASJ_NOTIN
    SELECT
      t1.*
    FROM
      A t1
    WHERE
      t1.id NOT IN (SELECT id FROM A WHERE id != 4)
      AND
      t1.tt = (SELECT MIN(tt) FROM A WHERE id = t1.id);
    
    -- j->jointype == JOIN_ANTI
    SELECT
      t1.*
    FROM
      A t1
    WHERE
      NOT EXISTS (SELECT id FROM A WHERE id != 4 and id = t1.id)
      AND t1.tt = (SELECT MIN(tt) FROM A WHERE id = t1.id);
    ```
    
    Add these two jointype into the Assert(). I made several simple
    tests, results are ok. However, same as the code comment said, i
    am also unsure if postponing quals past anti-join/lasj_notin-join
    is always semantically correct.
---
 src/backend/optimizer/plan/initsplan.c            |  5 ++-
 src/test/regress/expected/bfv_joins.out           | 45 +++++++++++++----------
 src/test/regress/expected/bfv_joins_optimizer.out | 45 +++++++++++++----------
 src/test/regress/sql/bfv_joins.sql                | 39 ++++++++++----------
 4 files changed, 75 insertions(+), 59 deletions(-)

diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index b12c3c4f40..eff60e3e72 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -1269,8 +1269,11 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join,
 				 * semantically correct, see discussion on mailing list here:
 				 * "Regarding postponing quals past an semi join"
 				 * https://groups.google.com/a/greenplum.org/d/msg/gpdb-dev/YHYNIUZnecI/Rlum0VD3FwAJ
+				 *
+				 * MORE: In GPDB, ANTI-JOIN/LASJ_NOTIN-JOIN may come here.
 				 */
-				Assert(j->jointype == JOIN_INNER || j->jointype == JOIN_SEMI);
+				Assert(j->jointype == JOIN_INNER || j->jointype == JOIN_SEMI ||
+					   j->jointype == JOIN_ANTI || j->jointype == JOIN_LASJ_NOTIN);
 				*postponed_qual_list = lappend(*postponed_qual_list, pq);
 			}
 		}
diff --git a/src/test/regress/expected/bfv_joins.out b/src/test/regress/expected/bfv_joins.out
index 9a652ab12a..2859181e26 100644
--- a/src/test/regress/expected/bfv_joins.out
+++ b/src/test/regress/expected/bfv_joins.out
@@ -3827,27 +3827,34 @@ explain select * from o1 left join o2 on a1 = a2 left join o3 on a2 is not disti
 (18 rows)
 
 -- Test case from community Github PR 13722
--- CBDB_CHERRYPICK_FIXME: PG optimizer will got a assert false case.
--- create table t_13722(id int, tt timestamp)
---   distributed by (id);
+create table t_13722(id int, tt timestamp)
+  distributed by (id);
 -- j->jointype == join_lasj_notin
--- select
---   t1.*
--- from
---   t_13722 t1
--- where
---   t1.id not in (select id from t_13722 where id != 4)
---   and
---   t1.tt = (select min(tt) from t_13722 where id = t1.id);
+select
+  t1.*
+from
+  t_13722 t1
+where
+  t1.id not in (select id from t_13722 where id != 4)
+  and
+  t1.tt = (select min(tt) from t_13722 where id = t1.id);
+ id | tt 
+----+----
+(0 rows)
+
 -- j->jointype == join_anti
--- select
---   t1.*
--- from
---   t_13722 t1
--- where
---   not exists (select id from t_13722 where id != 4 and id = t1.id)
---   and t1.tt = (select min(tt) from t_13722 where id = t1.id);
--- drop table t_13722;
+select
+  t1.*
+from
+  t_13722 t1
+where
+  not exists (select id from t_13722 where id != 4 and id = t1.id)
+  and t1.tt = (select min(tt) from t_13722 where id = t1.id);
+ id | tt 
+----+----
+(0 rows)
+
+drop table t_13722;
 -- This test is introduced to verify incorrect result
 -- from hash join of char columns is fixed
 -- Notice when varchar/text is cast to bpchar and used for
diff --git a/src/test/regress/expected/bfv_joins_optimizer.out b/src/test/regress/expected/bfv_joins_optimizer.out
index accc82702f..1ea05132a0 100644
--- a/src/test/regress/expected/bfv_joins_optimizer.out
+++ b/src/test/regress/expected/bfv_joins_optimizer.out
@@ -3839,27 +3839,34 @@ explain select * from o1 left join o2 on a1 = a2 left join o3 on a2 is not disti
 (13 rows)
 
 -- Test case from community Github PR 13722
--- CBDB_CHERRYPICK_FIXME: PG optimizer will got a assert false case.
--- create table t_13722(id int, tt timestamp)
---   distributed by (id);
+create table t_13722(id int, tt timestamp)
+  distributed by (id);
 -- j->jointype == join_lasj_notin
--- select
---   t1.*
--- from
---   t_13722 t1
--- where
---   t1.id not in (select id from t_13722 where id != 4)
---   and
---   t1.tt = (select min(tt) from t_13722 where id = t1.id);
+select
+  t1.*
+from
+  t_13722 t1
+where
+  t1.id not in (select id from t_13722 where id != 4)
+  and
+  t1.tt = (select min(tt) from t_13722 where id = t1.id);
+ id | tt 
+----+----
+(0 rows)
+
 -- j->jointype == join_anti
--- select
---   t1.*
--- from
---   t_13722 t1
--- where
---   not exists (select id from t_13722 where id != 4 and id = t1.id)
---   and t1.tt = (select min(tt) from t_13722 where id = t1.id);
--- drop table t_13722;
+select
+  t1.*
+from
+  t_13722 t1
+where
+  not exists (select id from t_13722 where id != 4 and id = t1.id)
+  and t1.tt = (select min(tt) from t_13722 where id = t1.id);
+ id | tt 
+----+----
+(0 rows)
+
+drop table t_13722;
 -- This test is introduced to verify incorrect result
 -- from hash join of char columns is fixed
 -- Notice when varchar/text is cast to bpchar and used for
diff --git a/src/test/regress/sql/bfv_joins.sql b/src/test/regress/sql/bfv_joins.sql
index 2b1cdcea50..011a235b4a 100644
--- a/src/test/regress/sql/bfv_joins.sql
+++ b/src/test/regress/sql/bfv_joins.sql
@@ -435,30 +435,29 @@ explain select * from o1 left join o2 on a1 = a2 left join o3 on a2 is not disti
 explain select * from o1 left join o2 on a1 = a2 left join o3 on a2 is not distinct from a3 and b2 = b3;
 
 -- Test case from community Github PR 13722
--- CBDB_CHERRYPICK_FIXME: PG optimizer will got a assert false case.
--- create table t_13722(id int, tt timestamp)
---   distributed by (id);
+create table t_13722(id int, tt timestamp)
+  distributed by (id);
 
 -- j->jointype == join_lasj_notin
--- select
---   t1.*
--- from
---   t_13722 t1
--- where
---   t1.id not in (select id from t_13722 where id != 4)
---   and
---   t1.tt = (select min(tt) from t_13722 where id = t1.id);
+select
+  t1.*
+from
+  t_13722 t1
+where
+  t1.id not in (select id from t_13722 where id != 4)
+  and
+  t1.tt = (select min(tt) from t_13722 where id = t1.id);
 
 -- j->jointype == join_anti
--- select
---   t1.*
--- from
---   t_13722 t1
--- where
---   not exists (select id from t_13722 where id != 4 and id = t1.id)
---   and t1.tt = (select min(tt) from t_13722 where id = t1.id);
-
--- drop table t_13722;
+select
+  t1.*
+from
+  t_13722 t1
+where
+  not exists (select id from t_13722 where id != 4 and id = t1.id)
+  and t1.tt = (select min(tt) from t_13722 where id = t1.id);
+
+drop table t_13722;
 
 -- This test is introduced to verify incorrect result
 -- from hash join of char columns is fixed


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 11/25: Don't use PGC_S_OVERRIDE for setting gp_role GUC

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7ac7eb629ea19eba90a0a0fea67657c303986bfc
Author: Ashwin Agrawal <aa...@vmware.com>
AuthorDate: Tue Aug 22 12:29:02 2023 -0700

    Don't use PGC_S_OVERRIDE for setting gp_role GUC
    
    If gp_role value is not specified then internally "utility" is set as
    default. This is mainly for single node coordinator or
    segments. Changing that setting to use PGC_S_DYNAMIC_DEFAULT instead
    of PGC_S_OVERRIDE.
    
    The problem with using PGC_S_OVERRIDE is GUC value can't be set
    later. Since commit 260710, we rely on assign_gp_role() hook to set
    should_reject_connection. If PGC_S_OVERRIDE is used to
    SetConfigOption() while setting the default in PostmasterMain(), then
    later setting gp_role via PGOPTIONS or any other mechanism will not
    call the assign hook and hence misses to set
    should_reject_connection. The reason for change being safe is
    check_gp_role() only allows "utility" mode to set as value for this
    GUC and any other values like "execute" or "dispatch" are already
    banned from PGOPTIONS or postgresql.conf followed by reload.
    
    This problem was exposed by src/test/gpdb_pitr/test_gpdb_pitr.sh tests
    which gets fixed now.
    
    Reviewed-by: Marbin Tan <tm...@vmware.com>
---
 src/backend/postmaster/postmaster.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index e70e91b33f..66ed31cafd 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -1039,9 +1039,14 @@ PostmasterMain(int argc, char *argv[])
 		ExitPostmaster(1);
 	}
 
-	/* If gp_role is not set, use utility role instead.*/
+	/*
+	 * If gp_role is not set, use utility role instead.
+	 *
+	 * A single node coordinator or segment is set to utility, which is not
+	 * before Greenplum 7.
+	 */
 	if (Gp_role == GP_ROLE_UNDEFINED)
-		SetConfigOption("gp_role", "utility", PGC_POSTMASTER, PGC_S_OVERRIDE);
+		SetConfigOption("gp_role", "utility", PGC_POSTMASTER, PGC_S_DYNAMIC_DEFAULT);
 
 	/*
 	 * Locate the proper configuration files and data directory, and read


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 25/25: print log message with write_stderr when reach vmem or resgroup limit.

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fe8326add2575892aabf01bd09919e5c5143ffce
Author: Wenru Yan <94...@users.noreply.github.com>
AuthorDate: Fri Sep 29 08:45:26 2023 +0800

    print log message with write_stderr when reach vmem or resgroup limit.
    
    When memory usage have reached Vmem limit or resource group limit, it
    will loop in gp_malloc and gp_failed_to_alloc if new allocation happens,
    and then errors out with "ERRORDATA_STACK_SIZE exceeded".
    
    We are therefore printing the log message header using write_stderr.
---
 src/backend/utils/mmgr/memprot.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/backend/utils/mmgr/memprot.c b/src/backend/utils/mmgr/memprot.c
index baf4458238..aed20cee89 100644
--- a/src/backend/utils/mmgr/memprot.c
+++ b/src/backend/utils/mmgr/memprot.c
@@ -315,7 +315,13 @@ static void gp_failed_to_alloc(MemoryAllocationStatus ec, int en, int sz)
 	}
 	else if (ec == MemoryFailure_VmemExhausted)
 	{
-		elog(LOG, "Logging memory usage for reaching Vmem limit");
+		/*
+		 * The memory usage have reached Vmem limit, it will loop in gp_malloc
+		 * and gp_failed_to_alloc if new allocation happens, and then errors out
+		 * with "ERRORDATA_STACK_SIZE exceeded". We are therefore printing the
+		 * log message header using write_stderr.
+		 */
+		write_stderr("Logging memory usage for reaching Vmem limit");
 	}
 	else if (ec == MemoryFailure_SystemMemoryExhausted)
 	{
@@ -330,7 +336,10 @@ static void gp_failed_to_alloc(MemoryAllocationStatus ec, int en, int sz)
 	}
 	else if (ec == MemoryFailure_ResourceGroupMemoryExhausted)
 	{
-		elog(LOG, "Logging memory usage for reaching resource group limit");
+		/*
+		 * The behavior in resgroup group mode is the same as MemoryFailure_VmemExhausted.
+		 */
+		write_stderr("Logging memory usage for reaching resource group limit");
 	}
 	else
 		elog(ERROR, "Unknown memory failure error code");


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


(cloudberry) 15/25: Fix gpstop pipeline flakiness after #15727

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 04647e24486337d3f307b88388d3df0a65ef578e
Author: sruthip2 <sr...@vmware.com>
AuthorDate: Sat Aug 26 15:34:16 2023 +0530

    Fix gpstop pipeline flakiness after #15727
    
    Following the merging of changes from pull request #15727, there was an intermittent test failure in
    gpstop. This situation occurred when testing how the gpstart process behaves in the presence of a
    lock directory created by a previous gpstop operation.
    
    In this specific scenario, the expected behavior was that the lock directory from gpstop shouldn't
    disrupt the gpstart process. To examine this, a test was set up where a gpstop process was started
    and stopped before completion. This created a lock directory in COORDINATOR_DATA_DIRECTORY.
    Subsequently, an attempt was made to clean up any remaining parts of the postgres process on the
    coordinator using the 'pkill postgres' command. This was essential to prevent issues where
    gpstart might fail with errors like ‘Greenplum instance already exists’. But sometimes, the remaining
    parts of the postgres process didn't get cleaned up properly, causing the test to fail with the error
    ‘gpstart error: Coordinator instance process running’.
    
    To fix this, added a step for cleaning all the postgres processes on the host by removing the lock file
    ‘/tmp/.s.PGSQL.*' along with ‘pkill -9 postgres’ to make sure everything is cleaned up.
---
 gpMgmt/test/behave/mgmt_utils/steps/unreachable_hosts_mgmt_utils.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gpMgmt/test/behave/mgmt_utils/steps/unreachable_hosts_mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/unreachable_hosts_mgmt_utils.py
index d659e6f681..4296061fea 100644
--- a/gpMgmt/test/behave/mgmt_utils/steps/unreachable_hosts_mgmt_utils.py
+++ b/gpMgmt/test/behave/mgmt_utils/steps/unreachable_hosts_mgmt_utils.py
@@ -1,5 +1,6 @@
 import subprocess
 import tempfile
+import socket
 
 from behave import given, when, then
 
@@ -88,7 +89,10 @@ def _blackhole_route_helper(disconnect_host, hosts, disconnect=False):
         subprocess.check_output(["ssh", host, cmd])
 
 @given('all postgres processes are killed on "{disconnected}" hosts')
+@then('all postgres processes are killed on "{disconnected}" hosts')
 def impl(context, disconnected):
+    if disconnected == "current":
+        disconnected = socket.gethostname()
     disconnected_hosts = disconnected.split(',')
 
     # clean up disconnected


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org