You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2025/01/06 08:19:50 UTC

(cloudberry) branch main updated (c6b87f7355 -> c7397dc33f)

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

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


    from c6b87f7355 FIXME: It looks like PostgreSQL planner pruning feature does not work properly
     new c3926f05be test/regress: fix misleading error message
     new f2eafed28d FIXME: Remove redundant Get/SetStaticPruneResult
     new 03732b4373 Remove inaccurate FIXME message
     new a7cf6d679f Fix flaky bfv_partition_plans test
     new 12ba449dbd Test parallel retrieve cursor can be closed if sender wait in WatLatch when MQ has no space (#14925)
     new 934f513db4 Set the default value for option execute_on of gp_exttable_fdw (#14797)
     new 9c5f965245 Fix the failed unit test case (#14930)
     new 6dcf8c9bff correct fmtopts column format of pg_exttable (#14937)
     new 30d5429128 No need pstrdup to initialize the dispatched query string
     new 5c214df020 Inclusive Terminology for Greenplum 7 in gpload (#14979)
     new 7158e52a99 inclusive terminology for Greenplum 7 in gpfdist (#14987)
     new c7397dc33f Add magic number field in the ICProxyPkt (#14926)

The 12 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:
 contrib/interconnect/proxy/ic_proxy_backend.c      | 10 +++
 contrib/interconnect/proxy/ic_proxy_client.c       | 20 ++++++
 contrib/interconnect/proxy/ic_proxy_packet.c       |  6 +-
 contrib/interconnect/proxy/ic_proxy_packet.h       | 12 ++++
 contrib/interconnect/proxy/ic_proxy_peer.c         | 27 ++++++++
 contrib/interconnect/proxy/ic_proxy_router.c       |  3 +
 gpMgmt/bin/gpcheckresgroupimpl                     |  4 +-
 gpMgmt/bin/gpload.py                               |  2 +-
 .../test/unit/test_unit_gpcheckresgroupimpl.py     | 14 ++--
 gpcontrib/Makefile                                 |  1 +
 gpcontrib/gp_exttable_fdw/Makefile                 |  2 +-
 gpcontrib/gp_exttable_fdw/data/tableless.csv       |  3 +
 gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c        |  8 ++-
 .../gp_exttable_fdw/input/gp_exttable_fdw.source   | 17 +++++
 .../gp_exttable_fdw/output/gp_exttable_fdw.source  | 21 ++++++
 src/backend/access/external/external.c             |  7 ++
 .../gpopt/translate/CContextDXLToPlStmt.cpp        | 20 ------
 .../gpopt/translate/CTranslatorDXLToPlStmt.cpp     |  1 -
 src/backend/tcop/postgres.c                        |  5 +-
 src/bin/gpfdist/doc/init                           |  4 +-
 src/bin/gpfdist/doc/start                          |  6 +-
 src/include/gpopt/translate/CContextDXLToPlStmt.h  |  6 --
 .../parallel_retrieve_cursor/status_wait.source    | 22 +++++++
 .../parallel_retrieve_cursor/status_wait.source    | 75 ++++++++++++++++++++++
 src/test/regress/expected/bfv_partition_plans.out  |  2 +
 .../expected/bfv_partition_plans_optimizer.out     |  2 +
 src/test/regress/pg_regress.c                      | 40 ++++++++----
 src/test/regress/sql/bfv_partition_plans.sql       |  2 +
 28 files changed, 279 insertions(+), 63 deletions(-)
 create mode 100644 gpcontrib/gp_exttable_fdw/data/tableless.csv
 create mode 100644 gpcontrib/gp_exttable_fdw/input/gp_exttable_fdw.source
 create mode 100644 gpcontrib/gp_exttable_fdw/output/gp_exttable_fdw.source


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


(cloudberry) 05/12: Test parallel retrieve cursor can be closed if sender wait in WatLatch when MQ has no space (#14925)

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

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

commit 12ba449dbdf6202762e83238cd34af12c1a7154c
Author: xuejing zhao <80...@users.noreply.github.com>
AuthorDate: Thu Feb 9 09:54:29 2023 +0800

    Test parallel retrieve cursor can be closed if sender wait in WatLatch when MQ has no space (#14925)
    
    If foreign table has lots of data, and we only retrieve few tuples in retrieve conn,
    Sender will be waiting in WaitLatch due to MQ has no space.
    Add testcase to test sender can be notified when cursor is closed.
---
 .../parallel_retrieve_cursor/status_wait.source    | 22 +++++++
 .../parallel_retrieve_cursor/status_wait.source    | 75 ++++++++++++++++++++++
 2 files changed, 97 insertions(+)

diff --git a/src/test/isolation2/input/parallel_retrieve_cursor/status_wait.source b/src/test/isolation2/input/parallel_retrieve_cursor/status_wait.source
index 2e2294bdd6..514696db9d 100644
--- a/src/test/isolation2/input/parallel_retrieve_cursor/status_wait.source
+++ b/src/test/isolation2/input/parallel_retrieve_cursor/status_wait.source
@@ -288,3 +288,25 @@ insert into t1 select generate_series(1,100);
 -- check no endpoint info
 2: SELECT state FROM gp_get_endpoints() WHERE cursorname='c10';
 *U: SELECT senderpid<>-1, receiverpid<>-1, state FROM gp_get_segment_endpoints() WHERE cursorname='c10';
+0Rq:
+1Rq:
+
+--------- Test11: Test t1 has large amount of tuples, only retreive small number of tuples, we can still close cursor.
+1:DROP TABLE IF EXISTS t2;
+1:CREATE TABLE t2 (id integer, data text) DISTRIBUTED by (id);
+1:INSERT INTO t2 select id, 'test ' || id from generate_series(1,100000) id;
+
+1: BEGIN;
+1: DECLARE c11 PARALLEL RETRIEVE CURSOR FOR SELECT * FROM t2;
+1: @post_run 'parse_endpoint_info 11 1 2 3 4' : SELECT endpointname,auth_token,hostname,port,state FROM gp_get_endpoints() WHERE cursorname='c11';
+0R: @pre_run 'set_endpoint_variable @ENDPOINT11': RETRIEVE 5 FROM ENDPOINT "@ENDPOINT11";
+1R: @pre_run 'set_endpoint_variable @ENDPOINT11': RETRIEVE 5 FROM ENDPOINT "@ENDPOINT11";
+2R: @pre_run 'set_endpoint_variable @ENDPOINT11': RETRIEVE 5 FROM ENDPOINT "@ENDPOINT11";
+
+1: CLOSE c11;
+1: ROLLBACK;
+
+-- check no endpoint info
+1: SELECT auth_token,state FROM gp_get_endpoints() WHERE cursorname='c11';
+-- check no token info on QE after close PARALLEL RETRIEVE CURSOR
+*U: SELECT * FROM gp_get_segment_endpoints() WHERE cursorname='c11';
\ No newline at end of file
diff --git a/src/test/isolation2/output/parallel_retrieve_cursor/status_wait.source b/src/test/isolation2/output/parallel_retrieve_cursor/status_wait.source
index 9ec2cf6e17..cdb6488879 100644
--- a/src/test/isolation2/output/parallel_retrieve_cursor/status_wait.source
+++ b/src/test/isolation2/output/parallel_retrieve_cursor/status_wait.source
@@ -1451,3 +1451,78 @@ ROLLBACK
  ?column? | ?column? | state 
 ----------+----------+-------
 (0 rows)
+0Rq: ... <quitting>
+1Rq: ... <quitting>
+
+--------- Test11: Test t1 has large amount of tuples, only retreive small number of tuples, we can still close cursor.
+1:DROP TABLE IF EXISTS t2;
+DROP
+1:CREATE TABLE t2 (id integer, data text) DISTRIBUTED by (id);
+CREATE
+1:INSERT INTO t2 select id, 'test ' || id from generate_series(1,100000) id;
+INSERT 100000
+
+1: BEGIN;
+BEGIN
+1: DECLARE c11 PARALLEL RETRIEVE CURSOR FOR SELECT * FROM t2;
+DECLARE
+1: @post_run 'parse_endpoint_info 11 1 2 3 4' : SELECT endpointname,auth_token,hostname,port,state FROM gp_get_endpoints() WHERE cursorname='c11';
+ endpoint_id11 | token_id | host_id | port_id | READY
+ endpoint_id11 | token_id | host_id | port_id | READY
+ endpoint_id11 | token_id | host_id | port_id | READY
+(3 rows)
+0R: @pre_run 'set_endpoint_variable @ENDPOINT11': RETRIEVE 5 FROM ENDPOINT "@ENDPOINT11";
+ id | data   
+----+--------
+ 2  | test 2 
+ 3  | test 3 
+ 4  | test 4 
+ 7  | test 7 
+ 8  | test 8 
+(5 rows)
+1R: @pre_run 'set_endpoint_variable @ENDPOINT11': RETRIEVE 5 FROM ENDPOINT "@ENDPOINT11";
+ id | data    
+----+---------
+ 1  | test 1  
+ 12 | test 12 
+ 15 | test 15 
+ 20 | test 20 
+ 23 | test 23 
+(5 rows)
+2R: @pre_run 'set_endpoint_variable @ENDPOINT11': RETRIEVE 5 FROM ENDPOINT "@ENDPOINT11";
+ id | data    
+----+---------
+ 5  | test 5  
+ 6  | test 6  
+ 9  | test 9  
+ 10 | test 10 
+ 11 | test 11 
+(5 rows)
+
+1: CLOSE c11;
+CLOSE
+1: ROLLBACK;
+ROLLBACK
+
+-- check no endpoint info
+1: SELECT auth_token,state FROM gp_get_endpoints() WHERE cursorname='c11';
+ auth_token | state 
+------------+-------
+(0 rows)
+-- check no token info on QE after close PARALLEL RETRIEVE CURSOR
+*U: SELECT * FROM gp_get_segment_endpoints() WHERE cursorname='c11';
+ auth_token | databaseid | senderpid | receiverpid | state | gp_segment_id | sessionid | username | endpointname | cursorname 
+------------+------------+-----------+-------------+-------+---------------+-----------+----------+--------------+------------
+(0 rows)
+
+ auth_token | databaseid | senderpid | receiverpid | state | gp_segment_id | sessionid | username | endpointname | cursorname 
+------------+------------+-----------+-------------+-------+---------------+-----------+----------+--------------+------------
+(0 rows)
+
+ auth_token | databaseid | senderpid | receiverpid | state | gp_segment_id | sessionid | username | endpointname | cursorname 
+------------+------------+-----------+-------------+-------+---------------+-----------+----------+--------------+------------
+(0 rows)
+
+ auth_token | databaseid | senderpid | receiverpid | state | gp_segment_id | sessionid | username | endpointname | cursorname 
+------------+------------+-----------+-------------+-------+---------------+-----------+----------+--------------+------------
+(0 rows)


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


(cloudberry) 08/12: correct fmtopts column format of pg_exttable (#14937)

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

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

commit 6dcf8c9bffe2fce4404918853196f2acfe8f0c6b
Author: Huiliang.liu <lh...@vmware.com>
AuthorDate: Mon Feb 13 10:03:51 2023 +0800

    correct fmtopts column format of pg_exttable (#14937)
    
    make each external table options delimited by space.
    
    currently only csv and text fmtopts output is delimited by space. This commit makes all formatters align
---
 gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c b/gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c
index 9831fed4bd..6832a7e475 100644
--- a/gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c
+++ b/gpcontrib/gp_exttable_fdw/gp_exttable_fdw.c
@@ -136,10 +136,9 @@ formatOptionsToTextDatum(List *options, char formattype)
 	StringInfoData cfbuf;
 
 	initStringInfo(&cfbuf);
+	bool isfirst = true;
 	if (fmttype_is_text(formattype) || fmttype_is_csv(formattype))
 	{
-		bool isfirst = true;
-
 		/*
 		 * Note: the order of the options should be same with the original
 		 * pg_exttable catalog's fmtopt field.
@@ -178,6 +177,11 @@ formatOptionsToTextDatum(List *options, char formattype)
 			char	   *key = defel->defname;
 			char	   *val = (char *) defGetString(defel);
 
+			if (isfirst)
+				isfirst = false;
+			else
+				appendStringInfo(&cfbuf, " ");
+
 			appendStringInfo(&cfbuf, "%s '%s'", key, val);
 		}
 	}


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


(cloudberry) 01/12: test/regress: fix misleading error message

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

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

commit c3926f05beabfdeb757fd2ad03b20c5aea83fce4
Author: HustonMmmavr <hu...@gmail.com>
AuthorDate: Tue Jan 24 09:35:13 2023 -0800

    test/regress: fix misleading error message
    
    This patch fixes misleading error message when test binaries
    `pg_regress/pg_isolation2_regress` are executed with the newer version
    of `.pm` scripts.
    
    For example: test binaries are builded at previous gpdb version
    (previous commit) and `./configure` script is called again, so
    `src/test/regress/GPTest.pm` (which stores version of gpdb at
    `$VERSION` constant) file is generated with newer version. And run of
    these tests exits with next error message: "The program "gpdiff.pl" is
    needed by pg_regress but was not found in the same\n directory as
    "/.../src/test/regress/pg_regress". But the real problem is next:
    `GP_VERSION` from binaries doesn't equal `$VERSION` from `GPTest.pm`
    script.
---
 src/test/regress/pg_regress.c | 40 ++++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index aa35e345c9..99d7c5c827 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -2511,6 +2511,24 @@ run_single_test(const char *test, test_start_function startfunc,
 	status_end();
 }
 
+/*
+ * Get error message pattern based on return code
+ */
+static const char *
+get_helper_err_pattern(int rc)
+{
+	if (rc == -2)
+	{
+		return "The program \"%s\" is needed by %s "
+			"has differece in build version (check \"GpTest.pm\" import) with "
+			"\"%s\".\nPlease rebuild tests or reconfigure the project.\n";
+	}
+	/* default error message pattern */
+	return "The program \"%s\" is needed by %s "
+		"but was not found in the same directory as \"%s\".\n"
+		"Please check that file exists (or is it a regular file).\n";
+}
+
 /*
  * Find the other binaries that we need. Currently, gpdiff.pl and
  * gpstringsubs.pl.
@@ -2518,31 +2536,29 @@ run_single_test(const char *test, test_start_function startfunc,
 static void
 find_helper_programs(const char *argv0)
 {
-	if (find_other_exec(argv0, "gpdiff.pl", "gpdiff.pl " GP_VERSION"\n", gpdiffprog) != 0)
+	int 		rc;
+	char		full_path[MAXPGPATH];
+	const char 	*msg;
+
+	if ((rc = find_other_exec(argv0, "gpdiff.pl", "gpdiff.pl " GP_VERSION"\n", gpdiffprog)) != 0)
 	{
-		char		full_path[MAXPGPATH];
+		msg = get_helper_err_pattern(rc);
 
 		if (find_my_exec(argv0, full_path) < 0)
 			strlcpy(full_path, progname, sizeof(full_path));
 
-		fprintf(stderr,
-				_("The program \"gpdiff.pl\" is needed by %s "
-				  "but was not found in the same directory as \"%s\".\n"),
-				progname, full_path);
+		fprintf(stderr, _(msg), "gpdiff.pl", progname, full_path);
 		exit(1);
 	}
 
-	if (find_other_exec(argv0, "gpstringsubs.pl", "gpstringsubs.pl " GP_VERSION"\n", gpstringsubsprog) != 0)
+	if ((rc = find_other_exec(argv0, "gpstringsubs.pl", "gpstringsubs.pl " GP_VERSION"\n", gpstringsubsprog)) != 0)
 	{
-		char		full_path[MAXPGPATH];
+		msg = get_helper_err_pattern(rc);
 
 		if (find_my_exec(argv0, full_path) < 0)
 			strlcpy(full_path, progname, sizeof(full_path));
 
-		fprintf(stderr,
-				_("The program \"gpstringsubs.pl\" is needed by %s "
-				  "but was not found in the same directory as \"%s\".\n"),
-				progname, full_path);
+		fprintf(stderr, _(msg), "gpstringsubs.pl", progname, full_path);
 		exit(1);
 	}
 }


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


(cloudberry) 02/12: FIXME: Remove redundant Get/SetStaticPruneResult

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

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

commit f2eafed28d340cb30a1b4371246f02ebc2a9d312
Author: Jingyu Wang <wj...@vmware.com>
AuthorDate: Fri Jan 20 15:51:40 2023 -0800

    FIXME: Remove redundant Get/SetStaticPruneResult
    
    Fixme:
    src/backend/gpopt/translate/CContextDXLToPlStmt.cpp:
    // GPDB_12_MERGE_FIXME: we haven't seen the scan id yet, this scan id is likely
    // for dynamic pruning.
    
    Action:
    Check not used elsewhere. Static partition elimination result now referenced by
    m_part_indexes. Check and redundant declaration removed.
---
 src/backend/gpopt/translate/CContextDXLToPlStmt.cpp | 20 --------------------
 src/include/gpopt/translate/CContextDXLToPlStmt.h   |  6 ------
 2 files changed, 26 deletions(-)

diff --git a/src/backend/gpopt/translate/CContextDXLToPlStmt.cpp b/src/backend/gpopt/translate/CContextDXLToPlStmt.cpp
index 8b7b93896e..21bfc3f6c3 100644
--- a/src/backend/gpopt/translate/CContextDXLToPlStmt.cpp
+++ b/src/backend/gpopt/translate/CContextDXLToPlStmt.cpp
@@ -518,26 +518,6 @@ CContextDXLToPlStmt::GetDistributionHashFuncForType(Oid typid)
 	return hashproc;
 }
 
-List *
-CContextDXLToPlStmt::GetStaticPruneResult(ULONG scanId)
-{
-	// GPDB_12_MERGE_FIXME: we haven't seen the scan id yet, this scan id is likely for dynamic pruning.
-	// When we can, remove this check
-	if ((scanId - 1) >= m_static_prune_results.size())
-	{
-		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXL2PlStmtConversion,
-				   GPOS_WSZ_LIT("dynamic pruning"));
-	}
-	return m_static_prune_results[scanId - 1];
-}
-void
-CContextDXLToPlStmt::SetStaticPruneResult(ULONG scanId,
-										  List *static_prune_result)
-{
-	m_static_prune_results.resize(scanId);
-	m_static_prune_results[scanId - 1] = static_prune_result;
-}
-
 ULONG
 CContextDXLToPlStmt::GetParamIdForSelector(OID oid_type, ULONG selectorId)
 {
diff --git a/src/include/gpopt/translate/CContextDXLToPlStmt.h b/src/include/gpopt/translate/CContextDXLToPlStmt.h
index 844f4c123d..9a2ebfd443 100644
--- a/src/include/gpopt/translate/CContextDXLToPlStmt.h
+++ b/src/include/gpopt/translate/CContextDXLToPlStmt.h
@@ -132,9 +132,6 @@ private:
 	// CTAS distribution policy
 	GpPolicy *m_distribution_policy;
 
-	// FXIME: this uses NEW/DELETE, should we use palloc/pfree/memory pool?
-	std::vector<List *> m_static_prune_results;
-
 	UlongToUlongMap *m_part_selector_to_param_map;
 
 
@@ -252,9 +249,6 @@ public:
 	Oid GetDistributionHashOpclassForType(Oid typid);
 	Oid GetDistributionHashFuncForType(Oid typid);
 
-	List *GetStaticPruneResult(ULONG scanId);
-	void SetStaticPruneResult(ULONG scanId, List *static_prune_result);
-
 	ULONG GetParamIdForSelector(OID oid_type, const ULONG selectorId);
 
 	Index FindRTE(Oid reloid);


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


(cloudberry) 06/12: Set the default value for option execute_on of gp_exttable_fdw (#14797)

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

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

commit 934f513db4391a51b47947287107acfb77558b01
Author: Jingwen Yang <ji...@outlook.com>
AuthorDate: Thu Feb 9 11:00:20 2023 +0800

    Set the default value for option execute_on of gp_exttable_fdw (#14797)
    
    * This commit is to fix issue #14528.
    
    Now we usually use CREATE EXTERNAL TABLE syntax to create an external table in gpdb, which can set default value while missing some options, such as option `execute_on`.
    
    But if we use CREATE FOREIGN TABLE syntax to create an external table, it won't set the default value while missing option `execute_on`.
    In this case, missing option `execute_on` will cause gpdb crashing. (Issue #14528)
    
    In this commit, when using CREATE FOREIGN TABLE syntax to create an external table and missing option `execute_on` , we will set default value for option `execute_on`.
---
 gpcontrib/Makefile                                  |  1 +
 gpcontrib/gp_exttable_fdw/Makefile                  |  2 +-
 gpcontrib/gp_exttable_fdw/data/tableless.csv        |  3 +++
 .../gp_exttable_fdw/input/gp_exttable_fdw.source    | 17 +++++++++++++++++
 .../gp_exttable_fdw/output/gp_exttable_fdw.source   | 21 +++++++++++++++++++++
 src/backend/access/external/external.c              |  7 +++++++
 6 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/gpcontrib/Makefile b/gpcontrib/Makefile
index 4750a8ce8a..5360083164 100644
--- a/gpcontrib/Makefile
+++ b/gpcontrib/Makefile
@@ -98,3 +98,4 @@ installcheck:
 	if [ "$(with_quicklz)" = "yes" ]; then $(MAKE) -C quicklz installcheck; fi
 	$(MAKE) -C gp_sparse_vector installcheck
 	$(MAKE) -C gp_toolkit installcheck
+	$(MAKE) -C gp_exttable_fdw installcheck
diff --git a/gpcontrib/gp_exttable_fdw/Makefile b/gpcontrib/gp_exttable_fdw/Makefile
index c38c05278d..2d31fbe597 100644
--- a/gpcontrib/gp_exttable_fdw/Makefile
+++ b/gpcontrib/gp_exttable_fdw/Makefile
@@ -8,7 +8,7 @@ OBJS = gp_exttable_fdw.o extaccess.o
 EXTENSION = gp_exttable_fdw
 DATA = gp_exttable_fdw--1.0.sql
 
-REGRESS =
+REGRESS = gp_exttable_fdw
 
 HEADERS = extaccess.h
 
diff --git a/gpcontrib/gp_exttable_fdw/data/tableless.csv b/gpcontrib/gp_exttable_fdw/data/tableless.csv
new file mode 100644
index 0000000000..2fc500fd9f
--- /dev/null
+++ b/gpcontrib/gp_exttable_fdw/data/tableless.csv
@@ -0,0 +1,3 @@
+1,12
+2,22
+3,32
diff --git a/gpcontrib/gp_exttable_fdw/input/gp_exttable_fdw.source b/gpcontrib/gp_exttable_fdw/input/gp_exttable_fdw.source
new file mode 100644
index 0000000000..089de06ba1
--- /dev/null
+++ b/gpcontrib/gp_exttable_fdw/input/gp_exttable_fdw.source
@@ -0,0 +1,17 @@
+--
+-- Test foreign-data wrapper gp_exttable_fdw.
+--
+
+CREATE EXTENSION IF NOT EXISTS gp_exttable_fdw;
+
+CREATE SERVER IF NOT EXISTS gp_exttable_server FOREIGN DATA WRAPPER gp_exttable_fdw;
+
+-- create table without execute_on option
+CREATE FOREIGN TABLE tableless_ext_fdw(a int, b int)
+SERVER gp_exttable_server
+OPTIONS (format 'csv', delimiter ',', format_type 'c',
+         location_uris 'file://@hostname@@abs_srcdir@/data/tableless.csv',
+         log_errors 'f', encoding '6', is_writable 'false');
+
+SELECT * FROM tableless_ext_fdw;
+
diff --git a/gpcontrib/gp_exttable_fdw/output/gp_exttable_fdw.source b/gpcontrib/gp_exttable_fdw/output/gp_exttable_fdw.source
new file mode 100644
index 0000000000..d25e622dd4
--- /dev/null
+++ b/gpcontrib/gp_exttable_fdw/output/gp_exttable_fdw.source
@@ -0,0 +1,21 @@
+--
+-- Test foreign-data wrapper gp_exttable_fdw.
+--
+CREATE EXTENSION IF NOT EXISTS gp_exttable_fdw;
+NOTICE:  extension "gp_exttable_fdw" already exists, skipping
+CREATE SERVER IF NOT EXISTS gp_exttable_server FOREIGN DATA WRAPPER gp_exttable_fdw;
+NOTICE:  server "gp_exttable_server" already exists, skipping
+-- create table without execute_on option
+CREATE FOREIGN TABLE tableless_ext_fdw(a int, b int)
+SERVER gp_exttable_server
+OPTIONS (format 'csv', delimiter ',', format_type 'c',
+         location_uris 'file://@hostname@@abs_srcdir@/data/tableless.csv',
+         log_errors 'f', encoding '6', is_writable 'false');
+SELECT * FROM tableless_ext_fdw;
+ a | b  
+---+----
+ 1 | 12
+ 2 | 22
+ 3 | 32
+(3 rows)
+
diff --git a/src/backend/access/external/external.c b/src/backend/access/external/external.c
index 3909194062..549d74c7cd 100644
--- a/src/backend/access/external/external.c
+++ b/src/backend/access/external/external.c
@@ -179,6 +179,7 @@ GetExtFromForeignTableOptions(List *ftoptons, Oid relid)
 	bool				iswritable_found = false;
 	bool				locationuris_found = false;
 	bool				command_found = false;
+	bool				executeon_found = false;
 
 	extentry = (ExtTableEntry *) palloc0(sizeof(ExtTableEntry));
 
@@ -196,6 +197,7 @@ GetExtFromForeignTableOptions(List *ftoptons, Oid relid)
 		if (pg_strcasecmp(def->defname, "execute_on") == 0)
 		{
 			extentry->execlocations = list_make1(makeString(defGetString(def)));
+			executeon_found = true;
 			continue;
 		}
 
@@ -298,6 +300,11 @@ GetExtFromForeignTableOptions(List *ftoptons, Oid relid)
 	else
 		extentry->rejectlimittype = -1;
 
+	if (!executeon_found)
+	{
+		extentry->execlocations = list_make1(makeString("ALL_SEGMENTS"));
+	}
+
 	if (!PG_VALID_ENCODING(extentry->encoding))
 		elog(ERROR, "invalid encoding found for external table");
 


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


(cloudberry) 07/12: Fix the failed unit test case (#14930)

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

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

commit 9c5f9652455c7c3b9cb38a0ad3e2ad976374487e
Author: Zhenglong Li <lz...@vmware.com>
AuthorDate: Thu Feb 9 13:41:46 2023 +0800

    Fix the failed unit test case (#14930)
    
    This is the negligence of PR #14733.
    
    As the title said, this PR is just trying to fix the failed unit test of test_unit_gpcheckresgroupimpl.py
---
 gpMgmt/bin/gpcheckresgroupimpl                             |  4 ++--
 .../bin/gppylib/test/unit/test_unit_gpcheckresgroupimpl.py | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gpMgmt/bin/gpcheckresgroupimpl b/gpMgmt/bin/gpcheckresgroupimpl
index 85945cbe68..f74d60d012 100755
--- a/gpMgmt/bin/gpcheckresgroupimpl
+++ b/gpMgmt/bin/gpcheckresgroupimpl
@@ -37,7 +37,7 @@ class CgroupValidation(object):
         return ""
 
 
-class CgroupValidationVersionAlpha(CgroupValidation):
+class CgroupValidationVersionOne(CgroupValidation):
     def __init__(self):
         self.mount_point = self.detect_cgroup_mount_point()
         self.tab = {"r": os.R_OK, "w": os.W_OK, "x": os.X_OK, "f": os.F_OK}
@@ -185,7 +185,7 @@ class CgroupValidationVersionAlpha(CgroupValidation):
 if __name__ == '__main__':
     if sys.platform.startswith('linux'):
         try:
-            CgroupValidationVersionAlpha().validate_all()
+            CgroupValidationVersionOne().validate_all()
         except ValidationException as e:
             exit(e.message)
     else:
diff --git a/gpMgmt/bin/gppylib/test/unit/test_unit_gpcheckresgroupimpl.py b/gpMgmt/bin/gppylib/test/unit/test_unit_gpcheckresgroupimpl.py
index 31e5f270ea..954f0d1e84 100644
--- a/gpMgmt/bin/gppylib/test/unit/test_unit_gpcheckresgroupimpl.py
+++ b/gpMgmt/bin/gppylib/test/unit/test_unit_gpcheckresgroupimpl.py
@@ -30,7 +30,7 @@ class GpCheckResGroupImplCGroup(unittest.TestCase):
         os.mkdir(os.path.join(self.cgroup_mntpnt, "cpuacct"), 0o755)
         os.mkdir(os.path.join(self.cgroup_mntpnt, "cpuset"), 0o755)
 
-        self.cgroup = gpcheckresgroupimpl.cgroup()
+        self.cgroup = gpcheckresgroupimpl.CgroupValidationVersionOne()
         self.cgroup.mount_point = self.cgroup_mntpnt
         self.cgroup.die = self.mock_cgroup_die
         self.cgroup.compdirs = self.cgroup.fallback_comp_dirs()
@@ -116,13 +116,13 @@ class GpCheckResGroupImplCGroup(unittest.TestCase):
 
     def test_proper_setup_with_non_default_cgroup_comp_dirs(self):
         # set comp dir to comp.dir
-        compdirs = self.cgroup.compdirs
-        self.cgroup.compdirs = {}
-        for comp in list(compdirs.keys()):
-            self.cgroup.compdirs[comp] = comp + '.dir'
+        component_dirs = self.cgroup.component_dirs
+        self.cgroup.component_dirs = {}
+        for comp in list(component_dirs.keys()):
+            self.cgroup.component_dirs[comp] = comp + '.dir'
         # move /sys/fs/cgroup/comp to /sys/fs/cgroup/comp/comp.dir
-        for comp in list(self.cgroup.compdirs.keys()):
-            compdir = self.cgroup.compdirs[comp]
+        for comp in list(self.cgroup.component_dirs.keys()):
+            compdir = self.cgroup.component_dirs[comp]
             olddir = os.path.join(self.cgroup_mntpnt, comp)
             tmpdir = os.path.join(self.cgroup_mntpnt, compdir)
             shutil.move(olddir, tmpdir)


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


(cloudberry) 11/12: inclusive terminology for Greenplum 7 in gpfdist (#14987)

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

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

commit 7158e52a99bd21d249dce08a750e8176496f6a84
Author: hyongtao-db <99...@users.noreply.github.com>
AuthorDate: Thu Feb 16 13:32:53 2023 +0800

    inclusive terminology for Greenplum 7 in gpfdist (#14987)
    
    rename master to coordinator in gpfdist
    
    **Signed-off-by:** Yongtao Huang <yo...@vmware.com>
---
 src/bin/gpfdist/doc/init  | 4 ++--
 src/bin/gpfdist/doc/start | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/bin/gpfdist/doc/init b/src/bin/gpfdist/doc/init
index e0b9e64f5e..c8a8e66e39 100644
--- a/src/bin/gpfdist/doc/init
+++ b/src/bin/gpfdist/doc/init
@@ -52,7 +52,7 @@ MA
 ===
 
 1.  do initdb for all segment except standby QD
-2.  copy data drom master QD to standby QD
-    "scp -r %s %s:%s" % ( seginfo[master_qd_idx].dir,
+2.  copy data from coordinator QD to standby QD
+    "scp -r %s %s:%s" % ( seginfo[coordinator_qd_idx].dir,
 	    seginfo[standby_qd_idx].host,
 	    seginfo[standby_qd_idx].dir)
diff --git a/src/bin/gpfdist/doc/start b/src/bin/gpfdist/doc/start
index c72e6f4907..d300bca726 100644
--- a/src/bin/gpfdist/doc/start
+++ b/src/bin/gpfdist/doc/start
@@ -20,12 +20,12 @@ waitflag = (wait ? "-w" : "")
 
 
 
-Start master QD
+Start coordinator QD
 =====================
 
 1.  kill gpsyncmaster
 
-2.  start master QD
+2.  start coordinator QD
 
 waitflag = (wait ? "-w" : "")
 
@@ -50,7 +50,7 @@ fi
 
 
 
-Start Standby Sync master
+Start Standby Sync coordinator
 =========================
 
 $GPHOME/bin/gpsyncmaster -p %d -D %s -i >> %s.log 2>&1 &" % (pgport, datadir, datadir)


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


(cloudberry) 04/12: Fix flaky bfv_partition_plans test

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

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

commit a7cf6d679f91dc70ce0cb119a08225f1277becdc
Author: Chris Hajas <ch...@vmware.com>
AuthorDate: Wed Feb 8 11:43:18 2023 -0800

    Fix flaky bfv_partition_plans test
    
    Strip out segment number when comparing ICW diff
---
 src/test/regress/expected/bfv_partition_plans.out           | 2 ++
 src/test/regress/expected/bfv_partition_plans_optimizer.out | 2 ++
 src/test/regress/sql/bfv_partition_plans.sql                | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/src/test/regress/expected/bfv_partition_plans.out b/src/test/regress/expected/bfv_partition_plans.out
index f5ac4f3c5b..129aad449c 100644
--- a/src/test/regress/expected/bfv_partition_plans.out
+++ b/src/test/regress/expected/bfv_partition_plans.out
@@ -11,6 +11,8 @@
 -- s/Buckets: \d+/Buckets: ###/
 -- m/Batches: \d+/
 -- s/Batches: \d+/Batches: ###/
+-- m/segment \d+/
+-- s/segment \d+/segment ###/
 -- m/using \d+ of \d+ buckets/
 -- s/using \d+ of \d+ buckets/using ## of ### buckets/
 -- end_matchsubs
diff --git a/src/test/regress/expected/bfv_partition_plans_optimizer.out b/src/test/regress/expected/bfv_partition_plans_optimizer.out
index 9d5be75da2..cbefbf8759 100644
--- a/src/test/regress/expected/bfv_partition_plans_optimizer.out
+++ b/src/test/regress/expected/bfv_partition_plans_optimizer.out
@@ -11,6 +11,8 @@
 -- s/Buckets: \d+/Buckets: ###/
 -- m/Batches: \d+/
 -- s/Batches: \d+/Batches: ###/
+-- m/segment \d+/
+-- s/segment \d+/segment ###/
 -- m/using \d+ of \d+ buckets/
 -- s/using \d+ of \d+ buckets/using ## of ### buckets/
 -- end_matchsubs
diff --git a/src/test/regress/sql/bfv_partition_plans.sql b/src/test/regress/sql/bfv_partition_plans.sql
index 12538a3f3f..b640e3e1f7 100644
--- a/src/test/regress/sql/bfv_partition_plans.sql
+++ b/src/test/regress/sql/bfv_partition_plans.sql
@@ -11,6 +11,8 @@
 -- s/Buckets: \d+/Buckets: ###/
 -- m/Batches: \d+/
 -- s/Batches: \d+/Batches: ###/
+-- m/segment \d+/
+-- s/segment \d+/segment ###/
 -- m/using \d+ of \d+ buckets/
 -- s/using \d+ of \d+ buckets/using ## of ### buckets/
 -- end_matchsubs


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


(cloudberry) 12/12: Add magic number field in the ICProxyPkt (#14926)

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

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

commit c7397dc33f3af5b07fe2aebb918d513aeb02d362
Author: Hongxu Ma <in...@outlook.com>
AuthorDate: Fri Feb 17 16:14:51 2023 +0800

    Add magic number field in the ICProxyPkt (#14926)
    
    icproxy processes communicate with each other with the public addr:port (see gp_interconnect_proxy_addresses), but no auth control here. So, any connection may connect in and send any byte, it may cause some unexpected exceptions (e.g. OOM).
    
    In the PR, introduces a magic number field in the ICProxyPkt and does a sanity check: drop the corresponding package if magic number doesn't match.
    
    This method does not attempt to solve all problems, but only as a simple solution to avoid internal misaccess, looks it's good enough.
---
 contrib/interconnect/proxy/ic_proxy_backend.c | 10 ++++++++++
 contrib/interconnect/proxy/ic_proxy_client.c  | 20 ++++++++++++++++++++
 contrib/interconnect/proxy/ic_proxy_packet.c  |  6 ++++--
 contrib/interconnect/proxy/ic_proxy_packet.h  | 12 ++++++++++++
 contrib/interconnect/proxy/ic_proxy_peer.c    | 27 +++++++++++++++++++++++++++
 contrib/interconnect/proxy/ic_proxy_router.c  |  3 +++
 6 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/contrib/interconnect/proxy/ic_proxy_backend.c b/contrib/interconnect/proxy/ic_proxy_backend.c
index 91131eeff2..b8a213832e 100644
--- a/contrib/interconnect/proxy/ic_proxy_backend.c
+++ b/contrib/interconnect/proxy/ic_proxy_backend.c
@@ -182,6 +182,16 @@ ic_proxy_backend_on_read_hello_ack(uv_stream_t *stream, ssize_t nread, const uv_
 
 	/* we have received a complete HELLO ACK message */
 	pkt = (ICProxyPkt *)backend->buffer;
+
+	/* sanity check: drop the packet with incorrect magic number */
+	if (!ic_proxy_pkt_is_valid(pkt))
+	{
+		elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG1,
+			"ic-proxy: backend %s: received %s, dropping the invalid package (magic number mismatch)",
+					ic_proxy_key_to_str(&backend->key), ic_proxy_pkt_to_str(pkt));
+		return;
+	}
+
 	Assert(ic_proxy_pkt_is(pkt, IC_PROXY_MESSAGE_HELLO_ACK));
 	uv_read_stop(stream);
 
diff --git a/contrib/interconnect/proxy/ic_proxy_client.c b/contrib/interconnect/proxy/ic_proxy_client.c
index b60c928139..5c57f5bccb 100644
--- a/contrib/interconnect/proxy/ic_proxy_client.c
+++ b/contrib/interconnect/proxy/ic_proxy_client.c
@@ -659,6 +659,15 @@ ic_proxy_client_on_hello_pkt(void *opaque, const void *data, uint16 size)
 	ICProxyKey	key;
 	ICProxyPkt *ackpkt;
 
+	/* sanity check: drop the packet with incorrect magic number */
+	if (!ic_proxy_pkt_is_valid(pkt))
+	{
+		elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG1,
+			"ic-proxy: %s: received %s, dropping the invalid package (magic number mismatch)",
+					ic_proxy_client_get_name(client), ic_proxy_pkt_to_str(pkt));
+		return;
+	}
+
 	/* we only expect one HELLO message */
 	uv_read_stop((uv_stream_t *) &client->pipe);
 
@@ -1176,6 +1185,15 @@ void
 ic_proxy_client_on_p2c_data(ICProxyClient *client, ICProxyPkt *pkt,
 							ic_proxy_sent_cb callback, void *opaque)
 {
+	/* sanity check: drop the packet with incorrect magic number */
+	if (!ic_proxy_pkt_is_valid(pkt))
+	{
+		elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG1,
+			"ic-proxy: %s: received %s, dropping the invalid package (magic number mismatch)",
+					ic_proxy_client_get_name(client), ic_proxy_pkt_to_str(pkt));
+		return;
+	}
+
 	/* A placeholder does not send any packets, it always cache them */
 	if (client->state & IC_PROXY_CLIENT_STATE_PLACEHOLDER)
 	{
@@ -1256,6 +1274,8 @@ ic_proxy_client_cache_p2c_pkt(ICProxyClient *client, ICProxyPkt *pkt)
 	/* TODO: drop out-of-date pkt directly */
 	/* TODO: verify the pkt is to client */
 
+	Assert(ic_proxy_pkt_is_valid(pkt));
+
 	client->pkts = lappend(client->pkts, pkt);
 
 	elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG3,
diff --git a/contrib/interconnect/proxy/ic_proxy_packet.c b/contrib/interconnect/proxy/ic_proxy_packet.c
index 8234ac8df2..56b7f1ba1a 100644
--- a/contrib/interconnect/proxy/ic_proxy_packet.c
+++ b/contrib/interconnect/proxy/ic_proxy_packet.c
@@ -82,6 +82,7 @@ void
 ic_proxy_message_init(ICProxyPkt *pkt, ICProxyMessageType type,
 					  const ICProxyKey *key)
 {
+	pkt->magicNumber = IC_PROXY_PKT_MAGIC_NUMBER;
 	pkt->type = type;
 	pkt->len = sizeof(*pkt);
 
@@ -156,13 +157,14 @@ ic_proxy_pkt_to_str(const ICProxyPkt *pkt)
 	static char	buf[256];
 
 	snprintf(buf, sizeof(buf),
-			 "%s [con%d,cmd%d,slice[%hd->%hd] %hu bytes seg%hd:dbid%hu:p%d->seg%hd:dbid%hu:p%d]",
+			 "%s [con%d,cmd%d,slice[%hd->%hd] %hu bytes seg%hd:dbid%hu:p%d->seg%hd:dbid%hu:p%d magic%u]",
 			 ic_proxy_message_type_to_str(pkt->type),
 			 pkt->sessionId, pkt->commandId,
 			 pkt->sendSliceIndex, pkt->recvSliceIndex,
 			 pkt->len,
 			 pkt->srcContentId, pkt->srcDbid, pkt->srcPid,
-			 pkt->dstContentId, pkt->dstDbid, pkt->dstPid);
+			 pkt->dstContentId, pkt->dstDbid, pkt->dstPid,
+			 pkt->magicNumber);
 
 	return buf;
 }
diff --git a/contrib/interconnect/proxy/ic_proxy_packet.h b/contrib/interconnect/proxy/ic_proxy_packet.h
index eec86e2e6b..17caca1f8a 100644
--- a/contrib/interconnect/proxy/ic_proxy_packet.h
+++ b/contrib/interconnect/proxy/ic_proxy_packet.h
@@ -22,6 +22,7 @@ typedef struct ICProxyPkt ICProxyPkt;
 #include "ic_proxy_key.h"
 
 #define IC_PROXY_MAX_PKT_SIZE (Gp_max_packet_size + sizeof(ICProxyPkt))
+#define IC_PROXY_PKT_MAGIC_NUMBER (0xBADDCAFE)
 
 typedef enum
 {
@@ -41,6 +42,9 @@ typedef enum
 
 struct ICProxyPkt
 {
+	/* for the sanity check of package */
+	uint32		magicNumber;
+
 	uint16		len;
 	uint16		type;
 
@@ -97,4 +101,12 @@ ic_proxy_pkt_is(const ICProxyPkt *pkt, ICProxyMessageType type)
 	return type == pkt->type;
 }
 
+/* check the validity of a package by magicNumber */
+static inline bool
+ic_proxy_pkt_is_valid(const ICProxyPkt *pkt)
+{
+	Assert(pkt);
+	return pkt->magicNumber == IC_PROXY_PKT_MAGIC_NUMBER;
+}
+
 #endif   /* IC_PROXY_PACKET_H */
diff --git a/contrib/interconnect/proxy/ic_proxy_peer.c b/contrib/interconnect/proxy/ic_proxy_peer.c
index b0c5a990b1..46bca00154 100644
--- a/contrib/interconnect/proxy/ic_proxy_peer.c
+++ b/contrib/interconnect/proxy/ic_proxy_peer.c
@@ -290,6 +290,15 @@ ic_proxy_peer_on_data_pkt(void *opaque, const void *data, uint16 size)
 	elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG5,
 		   "ic-proxy: %s: received %s", peer->name, ic_proxy_pkt_to_str(pkt));
 
+	/* sanity check: drop the packet with incorrect magic number */
+	if (!ic_proxy_pkt_is_valid(pkt))
+	{
+		elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG1,
+			"ic-proxy: %s: received %s, dropping the invalid package (magic number mismatch)",
+					peer->name, ic_proxy_pkt_to_str(pkt));
+		return;
+	}
+
 	if (!(peer->state & IC_PROXY_PEER_STATE_READY_FOR_DATA))
 	{
 		elog(WARNING, "ic-proxy: %s: not ready to receive DATA yet: %s",
@@ -529,6 +538,15 @@ ic_proxy_peer_on_hello_pkt(void *opaque, const void *data, uint16 size)
 	ICProxyPeer *peer = opaque;
 	ICProxyKey	key;
 
+	/* sanity check: drop the packet with incorrect magic number */
+	if (!ic_proxy_pkt_is_valid(pkt))
+	{
+		elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG1,
+			"ic-proxy: %s: received %s, dropping the invalid package (magic number mismatch)",
+					peer->name, ic_proxy_pkt_to_str(pkt));
+		return;
+	}
+
 	/* we only expect one hello message */
 	uv_read_stop((uv_stream_t *) &peer->tcp);
 
@@ -636,6 +654,15 @@ ic_proxy_peer_on_hello_ack_pkt(void *opaque, const void *data, uint16 size)
 		elog(ERROR, "ic-proxy: %s: received incomplete HELLO ACK: size = %d",
 					 peer->name, size);
 
+	/* sanity check: drop the packet with incorrect magic number */
+	if (!ic_proxy_pkt_is_valid(pkt))
+	{
+		elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG1,
+			"ic-proxy: %s: received %s, dropping the invalid package (magic number mismatch)",
+					peer->name, ic_proxy_pkt_to_str(pkt));
+		return;
+	}
+
 	if (peer->state & IC_PROXY_PEER_STATE_RECEIVED_HELLO_ACK)
 	{
 		/*
diff --git a/contrib/interconnect/proxy/ic_proxy_router.c b/contrib/interconnect/proxy/ic_proxy_router.c
index 77b5f36bb6..9ff19b3b47 100644
--- a/contrib/interconnect/proxy/ic_proxy_router.c
+++ b/contrib/interconnect/proxy/ic_proxy_router.c
@@ -202,6 +202,7 @@ void
 ic_proxy_router_route(uv_loop_t *loop, ICProxyPkt *pkt,
 					  ic_proxy_sent_cb callback, void *opaque)
 {
+	Assert(ic_proxy_pkt_is_valid(pkt));
 	if (pkt->dstDbid == pkt->srcDbid)
 	{
 		/*
@@ -254,6 +255,8 @@ ic_proxy_router_on_write(uv_write_t *req, int status)
 	ICProxyWriteReq *wreq = (ICProxyWriteReq *) req;
 	ICProxyPkt *pkt = req->data;
 
+	Assert(ic_proxy_pkt_is_valid(pkt));
+
 	if (status < 0)
 	{
 		elogif(gp_log_interconnect >= GPVARS_VERBOSITY_DEBUG, DEBUG5,


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


(cloudberry) 10/12: Inclusive Terminology for Greenplum 7 in gpload (#14979)

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

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

commit 5c214df020c8da3508751560cf87ab4c785c8ba2
Author: hyongtao-db <99...@users.noreply.github.com>
AuthorDate: Wed Feb 15 20:34:05 2023 +0800

    Inclusive Terminology for Greenplum 7 in gpload (#14979)
    
    rename master to main in gpload.py
    
    **Signed-off-by:** Yongtao Huang <yo...@vmware.com>
---
 gpMgmt/bin/gpload.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gpMgmt/bin/gpload.py b/gpMgmt/bin/gpload.py
index c33ca30819..c313ec93e4 100755
--- a/gpMgmt/bin/gpload.py
+++ b/gpMgmt/bin/gpload.py
@@ -726,7 +726,7 @@ def match_notice_obj(notice):
 
 
 def notice_processor_Notice(notice):
-    # process the notice in master branch
+    # process the notice in main branch
     # notice is a class which is different in 6X, we need a new function to process
     global NUM_WARN_ROWS
     if windowsPlatform == True:


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


(cloudberry) 03/12: Remove inaccurate FIXME message

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

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

commit 03732b43730a9433c7d7f6c000b1e7748f3d9147
Author: Jingyu Wang <wj...@vmware.com>
AuthorDate: Fri Jan 20 15:56:43 2023 -0800

    Remove inaccurate FIXME message
    
    Fixme:
    src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp:
    // GPDB_12_MERGE_FIXME: this duplicates a check in ExecInitProjectSet
    
    Action:
    None. Function SanityCheckProjectSetTargetList share some code with
    ExecInitProjectSet. But refactoring isn't trivial and will involve changes to
    upstream .c files. This check will be removed after PR #14302 is merged. For
    now, remove the FIXME tag to avoid confusion.
---
 src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp b/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
index efef8d4ff3..0a9737ebc1 100644
--- a/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
+++ b/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
@@ -3319,7 +3319,6 @@ ContainsSetReturningFuncOrOp(const CDXLNode *project_list_dxlnode,
 	return false;
 }
 
-// GPDB_12_MERGE_FIXME: this duplicates a check in ExecInitProjectSet
 static bool
 SanityCheckProjectSetTargetList(List *targetlist)
 {


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


(cloudberry) 09/12: No need pstrdup to initialize the dispatched query string

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

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

commit 30d542912808f5d91578546edce47f3b46bd506b
Author: Huansong Fu <fu...@gmail.com>
AuthorDate: Mon Jan 30 14:56:42 2023 -0800

    No need pstrdup to initialize the dispatched query string
    
    Minor correction that we don't need to call pstrdup() when initializing
    the query string. exec_mpp_query() would fill in a dummy string if it
    is empty.
    
    Noticed this when testing some specific workloads and seeing overheads
    in memory allocator caused by this. Didn't dig more into the impact but
    let's just fix it anyway.
---
 src/backend/tcop/postgres.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 09671cb2fd..7ffccb7830 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -5616,11 +5616,8 @@ PostgresMain(int argc, char *argv[],
 					/*
 					 * This is exactly like 'Q' above except we peel off and
 					 * set the snapshot information right away.
-					 *
-					 * Since PortalDefineQuery() does not take NULL query string,
-					 * we initialize it with a constant empty string.
 					 */
-					const char *query_string = pstrdup("");
+					const char *query_string = "";
 
 					const char *serializedDtxContextInfo = NULL;
 					const char *serializedPlantree = NULL;


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