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/02/13 01:05:46 UTC
(cloudberry) branch main updated (dd5aa2092f -> b99b12bae7)
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 dd5aa2092f Fix "unexpected gang size" issue.
new 28facb8dcf Remove unportable use of timezone in recent test
new fc5bb44ef8 Use __gp_aoblkdir() in alter_table_set_am.sql
new 52f696e381 Ignore any local .psqlrc when running tests.
new 03b31902f6 Resolve a FIXME in MergeAttributes()
new 659823ef11 Revert "Suppress Clang's register deprecation warning."
new a00b90563a Enhance logging for dispatch conn liveness checks
new 6441a88564 Guc gp_resgroup_memory_query_fixed_mem cannot be larger than max_statement_mem.
new 13c72534bb Fail the SplitUpdate if table's any child has update triggers (#17227)
new 2a73f3bec4 Update fix_mdps.py script to python3 syntax
new 821e59ea8a [gpdemo] polish checkDemoConfig (#13672)
new b99b12bae7 Error out when create or put role into system_group.
The 11 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:
configure | 58 ------------
configure.ac | 12 ---
contrib/interconnect/udp/ic_udpifc.c | 51 ++++++-----
gpAux/gpdemo/demo_cluster.sh | 5 +-
src/backend/cdb/cdbpath.c | 2 +-
src/backend/cdb/cdbvars.c | 16 ++++
src/backend/commands/createas.c | 1 +
src/backend/commands/exttablecmds.c | 1 +
src/backend/commands/sequence.c | 1 +
src/backend/commands/tablecmds.c | 18 ++--
src/backend/commands/typecmds.c | 1 +
src/backend/commands/user.c | 13 +++
src/backend/commands/view.c | 1 +
src/backend/gpopt/gpdbwrappers.cpp | 2 +-
src/backend/gporca/scripts/fix_mdps.py | 26 +++---
src/backend/nodes/copyfuncs.c | 1 +
src/backend/nodes/equalfuncs.c | 1 +
src/backend/nodes/outfuncs.c | 1 +
src/backend/nodes/readfast.c | 1 +
src/backend/parser/gram.y | 6 ++
src/backend/parser/parse_partition_gp.c | 1 +
src/backend/utils/cache/lsyscache.c | 101 +++++++--------------
src/backend/utils/misc/guc_gp.c | 2 +-
src/include/nodes/parsenodes.h | 1 +
src/include/utils/guc.h | 1 +
src/include/utils/lsyscache.h | 3 +-
.../expected/resgroup/resgroup_memory_limit.out | 10 ++
.../expected/resgroup/resgroup_syntax.out | 10 ++
.../sql/resgroup/resgroup_memory_limit.sql | 5 +
.../isolation2/sql/resgroup/resgroup_syntax.sql | 6 ++
src/test/modules/brin/t/02_wal_consistency.pl | 2 +-
src/test/regress/expected/alter_table_set_am.out | 59 +++++++-----
src/test/regress/expected/async.out | 2 +-
src/test/regress/expected/dboptions.out | 6 +-
.../regress/expected/distributed_transactions.out | 4 +-
src/test/regress/expected/minirepro.out | 6 +-
src/test/regress/expected/triggers_gp.out | 45 ++++++++-
src/test/regress/input/createdb.source | 6 +-
src/test/regress/input/gpcopy.source | 2 +-
src/test/regress/output/createdb.source | 8 +-
src/test/regress/output/gpcopy.source | 2 +-
src/test/regress/sql/alter_table_set_am.sql | 20 ++--
src/test/regress/sql/async.sql | 2 +-
src/test/regress/sql/dboptions.sql | 4 +-
src/test/regress/sql/distributed_transactions.sql | 2 +-
src/test/regress/sql/gpsd.sql | 4 +-
src/test/regress/sql/minirepro.sql | 6 +-
src/test/regress/sql/triggers_gp.sql | 39 +++++++-
48 files changed, 315 insertions(+), 262 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 01/11: Remove unportable use of timezone in recent 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 28facb8dcf04cfef678b0b5ccb0bf9d305112322
Author: Alvaro Herrera <al...@alvh.no-ip.org>
AuthorDate: Sun Aug 7 10:19:40 2022 +0200
Remove unportable use of timezone in recent test
Per buildfarm member snapper
Discussion: https://postgr.es/m/129951.1659812518@sss.pgh.pa.us
---
src/test/modules/brin/t/02_wal_consistency.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/modules/brin/t/02_wal_consistency.pl b/src/test/modules/brin/t/02_wal_consistency.pl
index 47e8be2896..41d920a66c 100644
--- a/src/test/modules/brin/t/02_wal_consistency.pl
+++ b/src/test/modules/brin/t/02_wal_consistency.pl
@@ -44,7 +44,7 @@ $whiskey->safe_psql(
do
$$
declare
- current timestamp with time zone := '2019-03-27 08:14:01.123456789 America/Punta_Arenas';
+ current timestamp with time zone := '2019-03-27 08:14:01.123456789 UTC';
begin
loop
insert into tbl_timestamp0 select i from
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 08/11: Fail the SplitUpdate if table's any child has update triggers (#17227)
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 13c72534bb7662627c67ea9cc26a8a94edabd73e
Author: Adam Lee <ad...@gmail.com>
AuthorDate: Wed Mar 27 16:37:52 2024 +0800
Fail the SplitUpdate if table's any child has update triggers (#17227)
The SplitUpdate is supposed to fail if any child has update triggers,
but Greenplum with ORCA skipped the check on the table's children while
merging PostgreSQL 12.
This commit gets the check back.
---
src/backend/cdb/cdbpath.c | 2 +-
src/backend/gpopt/gpdbwrappers.cpp | 2 +-
src/backend/utils/cache/lsyscache.c | 101 ++++++++++--------------------
src/include/utils/lsyscache.h | 3 +-
src/test/regress/expected/triggers_gp.out | 45 +++++++++++--
src/test/regress/sql/triggers_gp.sql | 39 ++++++++++--
6 files changed, 110 insertions(+), 82 deletions(-)
diff --git a/src/backend/cdb/cdbpath.c b/src/backend/cdb/cdbpath.c
index 6f24d77bd0..b24445b8e4 100644
--- a/src/backend/cdb/cdbpath.c
+++ b/src/backend/cdb/cdbpath.c
@@ -2864,7 +2864,7 @@ make_splitupdate_path(PlannerInfo *root, Path *subpath, Index rti)
* So an update trigger is not allowed when updating the
* distribution key.
*/
- if (has_update_triggers(rte->relid))
+ if (has_update_triggers(rte->relid, false))
ereport(ERROR,
(errcode(ERRCODE_GP_FEATURE_NOT_YET),
errmsg("UPDATE on distributed key column not allowed on relation with update triggers")));
diff --git a/src/backend/gpopt/gpdbwrappers.cpp b/src/backend/gpopt/gpdbwrappers.cpp
index ecf9f03d26..aa7e1d944b 100644
--- a/src/backend/gpopt/gpdbwrappers.cpp
+++ b/src/backend/gpopt/gpdbwrappers.cpp
@@ -2168,7 +2168,7 @@ gpdb::HasUpdateTriggers(Oid relid)
{
GP_WRAP_START;
{
- return has_update_triggers(relid);
+ return has_update_triggers(relid, true);
}
GP_WRAP_END;
return false;
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index cb2cd4112e..5d80ec0193 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -1744,15 +1744,22 @@ get_oprjoin(Oid opno)
/* ---------- TRIGGER CACHE ---------- */
-/* Does table have update triggers? */
+/*
+ * Does table have update triggers?
+ *
+ * From Greenplum 7, the Postgres planner expands partitioned table's children,
+ * including directly and indirectly, and generates a plan for each child table,
+ * but ORCA doesn't do that.
+ *
+ * So having an extra parameter including_children only for ORCA.
+ */
bool
-has_update_triggers(Oid relid)
+has_update_triggers(Oid relid, bool including_children)
{
Relation relation;
bool result = false;
- /* Assume the caller already holds a suitable lock. */
- relation = table_open(relid, NoLock);
+ relation = RelationIdGetRelation(relid);
if (relation->rd_rel->relhastriggers)
{
@@ -1769,15 +1776,33 @@ has_update_triggers(Oid relid)
found = trigger_enabled(trigger.tgoid) &&
(get_trigger_type(trigger.tgoid) & TRIGGER_TYPE_UPDATE) == TRIGGER_TYPE_UPDATE;
if (found)
+ {
+ result = true;
break;
+ }
}
}
+ }
- /* GPDB_96_MERGE_FIXME: Why is this not allowed? */
- if (found || child_triggers(relation->rd_id, TRIGGER_TYPE_UPDATE))
- result = true;
+ if (including_children && !result && relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
+ {
+ List *partitions = find_inheritance_children(relid, NoLock);
+ ListCell *lc;
+
+ foreach(lc, partitions)
+ {
+ Oid partrelid = lfirst_oid(lc);
+ if (has_update_triggers(partrelid, true))
+ {
+ result = true;
+ break;
+ }
+ }
+
+ list_free(partitions);
}
- table_close(relation, NoLock);
+
+ RelationClose(relation);
return result;
}
@@ -4657,66 +4682,6 @@ child_distribution_mismatch(Relation rel)
return false;
}
-/*
- * child_triggers
- * Return true if the table is partitioned and any of the child partitions
- * have a trigger of the given type.
- */
-bool
-child_triggers(Oid relationId, int32 triggerType)
-{
-/* GPDB_12_MERGE_FIXME */
- return false;
-#if 0
- Assert(InvalidOid != relationId);
- if (PART_STATUS_NONE == rel_part_status(relationId))
- {
- /* not a partitioned table */
- return false;
- }
-
- List *childOids = find_all_inheritors(relationId, NoLock, NULL);
- ListCell *lc;
-
- bool found = false;
- foreach (lc, childOids)
- {
- Oid oidChild = lfirst_oid(lc);
- Relation relChild = RelationIdGetRelation(oidChild);
- Assert(NULL != relChild);
-
- if (relChild->rd_rel->relhastriggers && NULL == relChild->trigdesc)
- {
- RelationBuildTriggers(relChild);
- if (NULL == relChild->trigdesc)
- {
- relChild->rd_rel->relhastriggers = false;
- }
- }
-
- if (relChild->rd_rel->relhastriggers)
- {
- for (int i = 0; i < relChild->trigdesc->numtriggers && !found; i++)
- {
- Trigger trigger = relChild->trigdesc->triggers[i];
- found = trigger_enabled(trigger.tgoid) &&
- (get_trigger_type(trigger.tgoid) & triggerType) == triggerType;
- }
- }
-
- RelationClose(relChild);
- if (found)
- {
- break;
- }
- }
-
- list_free(childOids);
-
- /* no child triggers matching the given type */
- return found;
-#endif
-}
/*
* get_range_multirange
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 0ff1afde4e..0822b1ae49 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -140,7 +140,7 @@ extern Oid get_commutator(Oid opno);
extern Oid get_negator(Oid opno);
extern RegProcedure get_oprrest(Oid opno);
extern RegProcedure get_oprjoin(Oid opno);
-extern bool has_update_triggers(Oid relid);
+extern bool has_update_triggers(Oid relid, bool including_children);
extern int32 get_trigger_type(Oid triggerid);
extern bool trigger_enabled(Oid triggerid);
extern char *get_func_name(Oid funcid);
@@ -251,7 +251,6 @@ Oid get_check_constraint_relid(Oid oidCheckconstraint);
extern bool has_subclass_slow(Oid relationId);
extern GpPolicy *relation_policy(Relation rel);
extern bool child_distribution_mismatch(Relation rel);
-extern bool child_triggers(Oid relationId, int32 triggerType);
extern bool get_cast_func(Oid oidSrc, Oid oidDest, bool *is_binary_coercible, Oid *oidCastFunc, CoercionPathType *pathtype);
diff --git a/src/test/regress/expected/triggers_gp.out b/src/test/regress/expected/triggers_gp.out
index 5899327ea3..2ee4caead9 100644
--- a/src/test/regress/expected/triggers_gp.out
+++ b/src/test/regress/expected/triggers_gp.out
@@ -71,7 +71,11 @@ create table parted_trig2 partition of parted_trig for values in (2);
NOTICE: table has parent, setting distribution columns to match parent table
create table parted_trig3 partition of parted_trig for values in (3);
NOTICE: table has parent, setting distribution columns to match parent table
-create table parted_trig4 partition of parted_trig for values in (4);
+create table parted_trig4 partition of parted_trig for values in (4,5) partition by list (partkey);
+NOTICE: table has parent, setting distribution columns to match parent table
+create table parted_trig4_1 partition of parted_trig4 for values in (4);
+NOTICE: table has parent, setting distribution columns to match parent table
+create table parted_trig4_2 partition of parted_trig4 for values in (5);
NOTICE: table has parent, setting distribution columns to match parent table
/* Could create similar structure with this legacy GPDB syntax:
create table parted_trig (partkey int, nonkey int, distkey int)
@@ -80,8 +84,6 @@ create table parted_trig (partkey int, nonkey int, distkey int)
*/
create trigger trig_ins_after after insert on parted_trig
for each row execute procedure insert_notice_trig();
-create trigger trig_upd_after after update on parted_trig
- for each row execute procedure update_notice_trig();
create trigger trig_del_after after delete on parted_trig
for each row execute procedure delete_notice_trig();
-- Inserts. Should fire the INSERT trigger.
@@ -89,19 +91,48 @@ insert into parted_trig values (1, 1, 1);
NOTICE: insert trigger fired on parted_trig1 for INSERT (seg1 127.0.0.1:40001 pid=10560)
insert into parted_trig values (2, 2, 2);
NOTICE: insert trigger fired on parted_trig2 for INSERT (seg0 127.0.0.1:40000 pid=10559)
+insert into parted_trig values (5, 5, 5);
+NOTICE: insert trigger fired on parted_trig4_2 for INSERT (seg2 127.0.0.1:40002 pid=250082)
+-- Have an UPDATE trigger on the middle level partition.
+create trigger trig_upd_after after update on parted_trig4
+ for each row execute procedure update_notice_trig();
+-- Update distribution key column on each level partition. Throws an error, currently.
+update parted_trig set distkey = 4 where distkey = 5;
+update parted_trig4 set distkey = 4 where distkey = 5;
+ERROR: UPDATE on distributed key column not allowed on relation with update triggers
+update parted_trig4_1 set distkey = 4 where distkey = 5;
+ERROR: UPDATE on distributed key column not allowed on relation with update triggers
+drop trigger trig_upd_after on parted_trig4;
+-- Have an UPDATE trigger on a leaf partition.
+create trigger trig_upd_after after update on parted_trig4_1
+ for each row execute procedure update_notice_trig();
+-- Update distribution key column on each level partition. Throws an error, currently.
+update parted_trig set distkey = 3 where distkey = 4;
+update parted_trig4 set distkey = 3 where distkey = 4;
+ERROR: UPDATE on distributed key column not allowed on relation with update triggers
+update parted_trig4_1 set distkey = 3 where distkey = 4;
+ERROR: UPDATE on distributed key column not allowed on relation with update triggers
+drop trigger trig_upd_after on parted_trig4_1;
+-- Have an UPDATE trigger on the top level partition.
+create trigger trig_upd_after after update on parted_trig
+ for each row execute procedure update_notice_trig();
-- Update non-key column. Should fire the UPDATE trigger.
update parted_trig set nonkey = 3 where nonkey = 1;
NOTICE: update trigger fired on parted_trig1 for UPDATE (seg1 127.0.0.1:40001 pid=10560)
--- Update distribution key column. Throws an error, currently.
+-- Update distribution key column on each level partition. Throws an error, currently.
update parted_trig set distkey = 3 where distkey = 1;
ERROR: UPDATE on distributed key column not allowed on relation with update triggers
+update parted_trig4 set distkey = 3 where distkey = 1;
+ERROR: UPDATE on distributed key column not allowed on relation with update triggers
+update parted_trig4_1 set distkey = 3 where distkey = 1;
+ERROR: UPDATE on distributed key column not allowed on relation with update triggers
-- Update partitioning key column. Should fire the DELETE+INSERT triggers,
-- like in PostgreSQL.
update parted_trig set partkey = 3 where partkey = 1;
NOTICE: delete trigger fired on parted_trig1 for DELETE (seg1 127.0.0.1:40001 pid=10560)
NOTICE: insert trigger fired on parted_trig3 for INSERT (seg1 127.0.0.1:40001 pid=10560)
-- Update everything in one statement. Throws an error, currently, because
--- updating the distributon key is not allowed.
+-- updating the distribution key is not allowed.
update parted_trig set partkey = partkey + 1, distkey = distkey + 1;
ERROR: UPDATE on distributed key column not allowed on relation with update triggers
-- Should fire the DELETE trigger.
@@ -128,7 +159,11 @@ SET gp_enable_statement_trigger = off;
-- Currently disabled.
--
create table trigtest_ao(a int) using ao_row;
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Cloudberry 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.
create table trigtest_co(a int) using ao_column;
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Cloudberry 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.
create trigger trig_ao after insert on trigtest_ao for each row execute function insert_notice_trig();
create trigger trig_co after insert on trigtest_co for each row execute function insert_notice_trig();
insert into trigtest_ao values(1);
diff --git a/src/test/regress/sql/triggers_gp.sql b/src/test/regress/sql/triggers_gp.sql
index f9761e632f..46dacfa475 100644
--- a/src/test/regress/sql/triggers_gp.sql
+++ b/src/test/regress/sql/triggers_gp.sql
@@ -74,7 +74,9 @@ create table parted_trig (partkey int, nonkey int, distkey int)
create table parted_trig1 partition of parted_trig for values in (1);
create table parted_trig2 partition of parted_trig for values in (2);
create table parted_trig3 partition of parted_trig for values in (3);
-create table parted_trig4 partition of parted_trig for values in (4);
+create table parted_trig4 partition of parted_trig for values in (4,5) partition by list (partkey);
+create table parted_trig4_1 partition of parted_trig4 for values in (4);
+create table parted_trig4_2 partition of parted_trig4 for values in (5);
/* Could create similar structure with this legacy GPDB syntax:
create table parted_trig (partkey int, nonkey int, distkey int)
@@ -84,27 +86,54 @@ create table parted_trig (partkey int, nonkey int, distkey int)
create trigger trig_ins_after after insert on parted_trig
for each row execute procedure insert_notice_trig();
-create trigger trig_upd_after after update on parted_trig
- for each row execute procedure update_notice_trig();
create trigger trig_del_after after delete on parted_trig
for each row execute procedure delete_notice_trig();
-- Inserts. Should fire the INSERT trigger.
insert into parted_trig values (1, 1, 1);
insert into parted_trig values (2, 2, 2);
+insert into parted_trig values (5, 5, 5);
+
+-- Have an UPDATE trigger on the middle level partition.
+create trigger trig_upd_after after update on parted_trig4
+ for each row execute procedure update_notice_trig();
+
+-- Update distribution key column on each level partition. Throws an error, currently.
+update parted_trig set distkey = 4 where distkey = 5;
+update parted_trig4 set distkey = 4 where distkey = 5;
+update parted_trig4_1 set distkey = 4 where distkey = 5;
+
+drop trigger trig_upd_after on parted_trig4;
+
+-- Have an UPDATE trigger on a leaf partition.
+create trigger trig_upd_after after update on parted_trig4_1
+ for each row execute procedure update_notice_trig();
+
+-- Update distribution key column on each level partition. Throws an error, currently.
+update parted_trig set distkey = 3 where distkey = 4;
+update parted_trig4 set distkey = 3 where distkey = 4;
+update parted_trig4_1 set distkey = 3 where distkey = 4;
+
+drop trigger trig_upd_after on parted_trig4_1;
+
+-- Have an UPDATE trigger on the top level partition.
+create trigger trig_upd_after after update on parted_trig
+ for each row execute procedure update_notice_trig();
-- Update non-key column. Should fire the UPDATE trigger.
update parted_trig set nonkey = 3 where nonkey = 1;
--- Update distribution key column. Throws an error, currently.
+-- Update distribution key column on each level partition. Throws an error, currently.
update parted_trig set distkey = 3 where distkey = 1;
+update parted_trig4 set distkey = 3 where distkey = 1;
+update parted_trig4_1 set distkey = 3 where distkey = 1;
-- Update partitioning key column. Should fire the DELETE+INSERT triggers,
-- like in PostgreSQL.
update parted_trig set partkey = 3 where partkey = 1;
-- Update everything in one statement. Throws an error, currently, because
--- updating the distributon key is not allowed.
+-- updating the distribution key is not allowed.
update parted_trig set partkey = partkey + 1, distkey = distkey + 1;
-- Should fire the DELETE trigger.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 04/11: Resolve a FIXME in MergeAttributes()
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 03b31902f60577f1c389c8821244e3f3b8b30702
Author: Huansong Fu <fu...@gmail.com>
AuthorDate: Mon Aug 29 08:23:35 2022 -0700
Resolve a FIXME in MergeAttributes()
In MergeAttributes() when we merge attributes of the parents, we
avoided checking their refcount because in GPDB, ALTER TABLE ...
ADD PARTITION or SPLIT PARTITION couldn't meet the upstream
expectation that at this point the partition root shouldn't be
in use.
But that seems to be an overkill. That check would be useful for
majority of the other cases. Therefore, now adding a new filed
in CreateStmt and passing that to MergeAttributes() so that we
only avoid doing so for ALTER TABLE ... ADD|SPLIT PARTITION.
Also make sure to set the new field to false in all the other
occurrences but it should be OK if we miss some because CreateStmt
should be palloc'ed.
---
src/backend/commands/createas.c | 1 +
src/backend/commands/exttablecmds.c | 1 +
src/backend/commands/sequence.c | 1 +
src/backend/commands/tablecmds.c | 18 ++++++++++++------
src/backend/commands/typecmds.c | 1 +
src/backend/commands/view.c | 1 +
src/backend/nodes/copyfuncs.c | 1 +
src/backend/nodes/equalfuncs.c | 1 +
src/backend/nodes/outfuncs.c | 1 +
src/backend/nodes/readfast.c | 1 +
src/backend/parser/gram.y | 6 ++++++
src/backend/parser/parse_partition_gp.c | 1 +
src/include/nodes/parsenodes.h | 1 +
13 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c
index 6d72d0d087..72cc4ffc03 100644
--- a/src/backend/commands/createas.c
+++ b/src/backend/commands/createas.c
@@ -167,6 +167,7 @@ create_ctas_internal(List *attrList, IntoClause *into, QueryDesc *queryDesc, boo
create->oncommit = into->onCommit;
create->tablespacename = into->tableSpaceName;
create->if_not_exists = false;
+ create->gp_style_alter_part = false;
create->distributedBy = NULL; /* We will pass a pre-made intoPolicy instead */
create->partitionBy = NULL; /* CTAS does not not support partition. */
diff --git a/src/backend/commands/exttablecmds.c b/src/backend/commands/exttablecmds.c
index 1a0a28a61d..c48abe700d 100644
--- a/src/backend/commands/exttablecmds.c
+++ b/src/backend/commands/exttablecmds.c
@@ -120,6 +120,7 @@ DefineExternalRelation(CreateExternalStmt *createExtStmt)
createStmt->distributedBy = createExtStmt->distributedBy; /* policy was set in transform */
createStmt->ownerid = userid;
createStmt->tags = createExtStmt->tags;
+ createStmt->gp_style_alter_part = false;
switch (exttypeDesc->exttabletype)
{
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index e989a7db05..b5aad4b328 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -260,6 +260,7 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq)
stmt->if_not_exists = seq->if_not_exists;
stmt->relKind = RELKIND_SEQUENCE;
stmt->ownerid = GetUserId();
+ stmt->gp_style_alter_part = false;
address = DefineRelation(stmt, RELKIND_SEQUENCE, seq->ownerId, NULL, NULL,
false, /* dispatch */
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index a2a2d7d291..4a7249f9c5 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -299,7 +299,7 @@ static void truncate_check_activity(Relation rel);
static void RangeVarCallbackForTruncate(const RangeVar *relation,
Oid relId, Oid oldRelId, void *arg);
static List *MergeAttributes(List *schema, List *supers, char relpersistence,
- bool is_partition, List **supconstr);
+ bool is_partition, List **supconstr, bool gp_alter_part);
static void MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel);
static bool MergeCheckConstraint(List *constraints, char *name, Node *expr);
static void MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel);
@@ -1005,7 +1005,8 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
MergeAttributes(schema, inheritOids,
stmt->relation->relpersistence,
stmt->partbound != NULL,
- &old_constraints);
+ &old_constraints,
+ stmt->gp_style_alter_part);
}
else
{
@@ -2962,7 +2963,7 @@ storage_name(char c)
*/
List *
MergeAttributes(List *schema, List *supers, char relpersistence,
- bool is_partition, List **supconstr)
+ bool is_partition, List **supconstr, bool gp_style_alter_part)
{
List *inhSchema = NIL;
List *constraints = NIL;
@@ -3088,10 +3089,14 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
* Check for active uses of the parent partitioned table in the
* current transaction, such as being used in some manner by an
* enclosing command.
+ *
+ * GPDB-style ALTER TABLE ADD|SPLIT PARTITION can't meet this
+ * upstream expectation on QD. As during alter, reference is
+ * already held by alter command, and when we generate CREATE
+ * STMT and execute them we have 2 reference instead on 1 here.
*/
- /* SINGLENODE_FIXME: check and enable partition operations */
- if (is_partition && (Gp_role != GP_ROLE_DISPATCH && !IS_SINGLENODE()))
- CheckTableNotInUse(relation, "CREATE TABLE .. PARTITION OF or ALTER TABLE ADD PARTITION");
+ if (is_partition && ((Gp_role != GP_ROLE_DISPATCH && !IS_SINGLENODE()) || !gp_style_alter_part))
+ CheckTableNotInUse(relation, "CREATE TABLE .. PARTITION OF");
/*
* We do not allow partitioned tables and partitions to participate in
@@ -18160,6 +18165,7 @@ prebuild_temp_table(Relation rel, RangeVar *tmpname, DistributedBy *distro,
cs->ownerid = rel->rd_rel->relowner;
cs->tablespacename = get_tablespace_name(rel->rd_rel->reltablespace);
cs->buildAoBlkdir = false;
+ cs->gp_style_alter_part = false;
if (isTmpTableAo &&
rel->rd_rel->relhasindex)
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 92dce29096..bd38417020 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -2640,6 +2640,7 @@ DefineCompositeType(RangeVar *typevar, List *coldeflist)
createStmt->oncommit = ONCOMMIT_NOOP;
createStmt->tablespacename = NULL;
createStmt->if_not_exists = false;
+ createStmt->gp_style_alter_part = false;
/*
* Check for collision with an existing type name. If there is one and
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 98c3264563..49232040b7 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -255,6 +255,7 @@ DefineVirtualRelation(RangeVar *relation, List *tlist, bool replace,
createStmt->tablespacename = NULL;
createStmt->relKind = RELKIND_VIEW;
createStmt->if_not_exists = false;
+ createStmt->gp_style_alter_part = false;
/*
* Create the relation (this will error out if there's an existing
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index f0d1513147..7b68dac9d9 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -4201,6 +4201,7 @@ CopyCreateStmtFields(const CreateStmt *from, CreateStmt *newnode)
COPY_STRING_FIELD(tablespacename);
COPY_STRING_FIELD(accessMethod);
COPY_SCALAR_FIELD(if_not_exists);
+ COPY_SCALAR_FIELD(gp_style_alter_part);
COPY_NODE_FIELD(distributedBy);
COPY_NODE_FIELD(partitionBy);
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 1d548acfb8..be6433578c 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -1386,6 +1386,7 @@ _equalCreateStmt(const CreateStmt *a, const CreateStmt *b)
COMPARE_STRING_FIELD(tablespacename);
COMPARE_STRING_FIELD(accessMethod);
COMPARE_SCALAR_FIELD(if_not_exists);
+ COMPARE_SCALAR_FIELD(gp_style_alter_part);
COMPARE_NODE_FIELD(distributedBy);
COMPARE_SCALAR_FIELD(relKind);
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 528f402f19..0f6d60983e 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -2966,6 +2966,7 @@ _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
WRITE_STRING_FIELD(tablespacename);
WRITE_STRING_FIELD(accessMethod);
WRITE_BOOL_FIELD(if_not_exists);
+ WRITE_BOOL_FIELD(gp_style_alter_part);
WRITE_NODE_FIELD(distributedBy);
WRITE_NODE_FIELD(partitionBy);
diff --git a/src/backend/nodes/readfast.c b/src/backend/nodes/readfast.c
index e82d84126b..13f9a15c9e 100644
--- a/src/backend/nodes/readfast.c
+++ b/src/backend/nodes/readfast.c
@@ -751,6 +751,7 @@ _readCreateStmt_common(CreateStmt *local_node)
READ_STRING_FIELD(tablespacename);
READ_STRING_FIELD(accessMethod);
READ_BOOL_FIELD(if_not_exists);
+ READ_BOOL_FIELD(gp_style_alter_part);
READ_NODE_FIELD(distributedBy);
READ_NODE_FIELD(partitionBy);
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index a6d0a83b82..7b010aec9c 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -5077,6 +5077,7 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
n->oncommit = $12;
n->tablespacename = $13;
n->if_not_exists = false;
+ n->gp_style_alter_part = false;
n->distributedBy = (DistributedBy *) $14;
n->tags = $16;
n->relKind = RELKIND_RELATION;
@@ -5108,6 +5109,7 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
n->oncommit = $15;
n->tablespacename = $16;
n->if_not_exists = true;
+ n->gp_style_alter_part = false;
n->distributedBy = (DistributedBy *) $17;
n->tags = $19;
n->relKind = RELKIND_RELATION;
@@ -5140,6 +5142,7 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
n->oncommit = $11;
n->tablespacename = $12;
n->if_not_exists = false;
+ n->gp_style_alter_part = false;
n->distributedBy = (DistributedBy *) $13;
n->tags = $15;
n->relKind = RELKIND_RELATION;
@@ -5172,6 +5175,7 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
n->oncommit = $14;
n->tablespacename = $15;
n->if_not_exists = true;
+ n->gp_style_alter_part = false;
n->distributedBy = (DistributedBy *) $16;
n->tags = $18;
n->relKind = RELKIND_RELATION;
@@ -5204,6 +5208,7 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
n->oncommit = $13;
n->tablespacename = $14;
n->if_not_exists = false;
+ n->gp_style_alter_part = false;
n->distributedBy = NULL;
n->tags = $16;
n->relKind = RELKIND_RELATION;
@@ -5236,6 +5241,7 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
n->oncommit = $16;
n->tablespacename = $17;
n->if_not_exists = true;
+ n->gp_style_alter_part = false;
n->distributedBy = NULL;
n->tags = $19;
n->relKind = RELKIND_RELATION;
diff --git a/src/backend/parser/parse_partition_gp.c b/src/backend/parser/parse_partition_gp.c
index 5313acb3c7..ba775093dd 100644
--- a/src/backend/parser/parse_partition_gp.c
+++ b/src/backend/parser/parse_partition_gp.c
@@ -922,6 +922,7 @@ makePartitionCreateStmt(Relation parentrel, char *partname, PartitionBoundSpec *
childstmt->tablespacename = elem->tablespacename ? pstrdup(elem->tablespacename) : NULL;
childstmt->accessMethod = elem->accessMethod ? pstrdup(elem->accessMethod) : NULL;
childstmt->if_not_exists = false;
+ childstmt->gp_style_alter_part = true;
childstmt->distributedBy = make_distributedby_for_rel(parentrel);
childstmt->partitionBy = NULL;
childstmt->relKind = 0;
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 948f3874b0..5e21e4eaa6 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2502,6 +2502,7 @@ typedef struct CreateStmt
char *tablespacename; /* table space to use, or NULL */
char *accessMethod; /* table access method */
bool if_not_exists; /* just do nothing if it already exists? */
+ bool gp_style_alter_part; /* is this due to a GP-style ALTER on partition tables? */
DistributedBy *distributedBy; /* what columns we distribute the data by */
Node *partitionBy; /* what columns we partition the data by */
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 05/11: Revert "Suppress Clang's register deprecation warning."
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 659823ef113555ee9c95722a5670a9b8d15103cf
Author: Brent Doil <bd...@vmware.com>
AuthorDate: Mon Jan 9 20:27:41 2023 -0500
Revert "Suppress Clang's register deprecation warning."
Uses of register have been removed in 03bf971d2dc701d473705fd00891028d140dd5ae
This reverts commit 9a472294bebfe080e4a6d6b5fb15132879c82127.
---
configure | 58 ----------------------------------------------------------
configure.ac | 12 ------------
2 files changed, 70 deletions(-)
diff --git a/configure b/configure
index 6b46424ed4..afb75756c7 100755
--- a/configure
+++ b/configure
@@ -6870,64 +6870,6 @@ fi
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-stringop-truncation"
fi
- # GPDB_12_MERGE_FIXME: there's a chance we can rearrange our #include's to
- # avoid the specific headers that use "register" once we merge with Postgres
- # 12
-
- # Cloudberry's ORCA translator includes a lot of C headers, and Clang will
- # warn us about the use of the "register" keyword in Postgres' inline
- # functions which we can do nothing about. Silence it.
- NOT_THE_CXXFLAGS=""
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports -Wdeprecated-register" >&5
-$as_echo_n "checking whether $CXX supports -Wdeprecated-register... " >&6; }
-if ${pgac_cv_prog_cxx_cxxflags__Wdeprecated_register+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- pgac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="$pgac_save_CXXFLAGS -Wdeprecated-register"
-ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-ac_cxx_werror_flag=yes
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
- pgac_cv_prog_cxx_cxxflags__Wdeprecated_register=yes
-else
- pgac_cv_prog_cxx_cxxflags__Wdeprecated_register=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-CXXFLAGS="$pgac_save_CXXFLAGS"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cxx_cxxflags__Wdeprecated_register" >&5
-$as_echo "$pgac_cv_prog_cxx_cxxflags__Wdeprecated_register" >&6; }
-if test x"$pgac_cv_prog_cxx_cxxflags__Wdeprecated_register" = x"yes"; then
- NOT_THE_CXXFLAGS="${NOT_THE_CXXFLAGS} -Wdeprecated-register"
-fi
-
- if test -n "$NOT_THE_CXXFLAGS"; then
- CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"
- fi
elif test "$ICC" = yes; then
# Intel's compiler has a bug/misoptimization in checking for
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
diff --git a/configure.ac b/configure.ac
index 1310ff80ad..4fd6f8c737 100644
--- a/configure.ac
+++ b/configure.ac
@@ -631,18 +631,6 @@ if test "$GCC" = yes -a "$ICC" = no; then
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-stringop-truncation"
fi
- # GPDB_12_MERGE_FIXME: there's a chance we can rearrange our #include's to
- # avoid the specific headers that use "register" once we merge with Postgres
- # 12
-
- # Cloudberry's ORCA translator includes a lot of C headers, and Clang will
- # warn us about the use of the "register" keyword in Postgres' inline
- # functions which we can do nothing about. Silence it.
- NOT_THE_CXXFLAGS=""
- PGAC_PROG_CXX_VAR_OPT(NOT_THE_CXXFLAGS, [-Wdeprecated-register])
- if test -n "$NOT_THE_CXXFLAGS"; then
- CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"
- fi
elif test "$ICC" = yes; then
# Intel's compiler has a bug/misoptimization in checking for
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 07/11: Guc gp_resgroup_memory_query_fixed_mem cannot be larger than max_statement_mem.
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 6441a88564e80138df8b42a5094bc0ad7da0c0f7
Author: Zhenghua Lyu <ka...@gmail.com>
AuthorDate: Tue May 30 07:27:11 2023 +0000
Guc gp_resgroup_memory_query_fixed_mem cannot be larger than max_statement_mem.
---
src/backend/cdb/cdbvars.c | 16 ++++++++++++++++
src/backend/utils/misc/guc_gp.c | 2 +-
src/include/utils/guc.h | 1 +
.../expected/resgroup/resgroup_memory_limit.out | 10 ++++++++++
.../isolation2/sql/resgroup/resgroup_memory_limit.sql | 5 +++++
5 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/backend/cdb/cdbvars.c b/src/backend/cdb/cdbvars.c
index 76fb47dcba..2bc20f7b35 100644
--- a/src/backend/cdb/cdbvars.c
+++ b/src/backend/cdb/cdbvars.c
@@ -582,6 +582,22 @@ gpvars_check_statement_mem(int *newval, void **extra, GucSource source)
return true;
}
+/*
+ * gpvars_check_rg_query_fixed_mem
+ */
+bool
+gpvars_check_rg_query_fixed_mem(int *newval, void **extra, GucSource source)
+{
+ if (*newval >= max_statement_mem)
+ {
+ GUC_check_errmsg("Invalid input for gp_resgroup_memory_query_fixed_mem, must be less than max_statement_mem (%d kB)",
+ max_statement_mem);
+ return false;
+ }
+
+ return true;
+}
+
/*
* increment_command_count
* Increment gp_command_count. If the new command count is 0 or a negative number, reset it to 1.
diff --git a/src/backend/utils/misc/guc_gp.c b/src/backend/utils/misc/guc_gp.c
index 2fc110aac8..df4f59bce1 100644
--- a/src/backend/utils/misc/guc_gp.c
+++ b/src/backend/utils/misc/guc_gp.c
@@ -4185,7 +4185,7 @@ struct config_int ConfigureNamesInt_gp[] =
},
&gp_resgroup_memory_query_fixed_mem,
0, 0, INT_MAX,
- NULL, NULL, NULL
+ gpvars_check_rg_query_fixed_mem, NULL, NULL
},
{
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 4fb38e0ee3..164ea47f6b 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -837,6 +837,7 @@ extern const char *gpvars_show_gp_resource_manager_policy(void);
extern const char *gpvars_assign_gp_resqueue_memory_policy(const char *newval, bool doit, GucSource source);
extern const char *gpvars_show_gp_resqueue_memory_policy(void);
extern bool gpvars_check_statement_mem(int *newval, void **extra, GucSource source);
+extern bool gpvars_check_rg_query_fixed_mem(int *newval, void **extra, GucSource source);
extern int guc_name_compare(const char *namea, const char *nameb);
extern void DispatchSyncPGVariable(struct config_generic * gconfig);
diff --git a/src/test/isolation2/expected/resgroup/resgroup_memory_limit.out b/src/test/isolation2/expected/resgroup/resgroup_memory_limit.out
index d83db05430..04ae26049f 100644
--- a/src/test/isolation2/expected/resgroup/resgroup_memory_limit.out
+++ b/src/test/isolation2/expected/resgroup/resgroup_memory_limit.out
@@ -67,6 +67,16 @@ RESET
1: RESET ROLE;
RESET
+
+-- gp_resgroup_memory_query_fixed_mem cannot larger than max_statement_mem
+show max_statement_mem;
+ max_statement_mem
+-------------------
+ 2000MB
+(1 row)
+set gp_resgroup_memory_query_fixed_mem ='2048MB';
+ERROR: Invalid input for gp_resgroup_memory_query_fixed_mem, must be less than max_statement_mem (2048000 kB)
+
-- clean
DROP FUNCTION func_memory_test(text);
DROP
diff --git a/src/test/isolation2/sql/resgroup/resgroup_memory_limit.sql b/src/test/isolation2/sql/resgroup/resgroup_memory_limit.sql
index 1a0ea61ab2..45deaa10d6 100644
--- a/src/test/isolation2/sql/resgroup/resgroup_memory_limit.sql
+++ b/src/test/isolation2/sql/resgroup/resgroup_memory_limit.sql
@@ -55,6 +55,11 @@ CREATE ROLE role_memory_test RESOURCE GROUP rg_memory_test;
1: RESET gp_resgroup_memory_query_fixed_mem;
1: RESET ROLE;
+
+-- gp_resgroup_memory_query_fixed_mem cannot larger than max_statement_mem
+show max_statement_mem;
+set gp_resgroup_memory_query_fixed_mem ='2048MB';
+
-- clean
DROP FUNCTION func_memory_test(text);
DROP TABLE t_memory_limit;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 03/11: Ignore any local .psqlrc when running tests.
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 52f696e3810c9e8a8ab4ae290819868b7e296501
Author: Jianghua Yang <yj...@gmail.com>
AuthorDate: Tue Feb 11 19:32:26 2025 +0800
Ignore any local .psqlrc when running tests.
---
src/test/regress/expected/async.out | 2 +-
src/test/regress/expected/dboptions.out | 6 +++---
src/test/regress/expected/distributed_transactions.out | 4 ++--
src/test/regress/expected/minirepro.out | 6 +++---
src/test/regress/input/createdb.source | 6 +++---
src/test/regress/input/gpcopy.source | 2 +-
src/test/regress/output/createdb.source | 8 ++++----
src/test/regress/output/gpcopy.source | 2 +-
src/test/regress/sql/async.sql | 2 +-
src/test/regress/sql/dboptions.sql | 4 ++--
src/test/regress/sql/distributed_transactions.sql | 2 +-
src/test/regress/sql/gpsd.sql | 4 ++--
src/test/regress/sql/minirepro.sql | 6 +++---
13 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/test/regress/expected/async.out b/src/test/regress/expected/async.out
index 277b8963fa..784de2e99f 100644
--- a/src/test/regress/expected/async.out
+++ b/src/test/regress/expected/async.out
@@ -46,7 +46,7 @@ SELECT pg_notification_queue_usage();
-- end_matchsubs
\c postgres
LISTEN notify_async3;
-\! psql postgres -c "notify notify_async3;"
+\! psql postgres -Xc "notify notify_async3;"
NOTIFY
SELECT;
--
diff --git a/src/test/regress/expected/dboptions.out b/src/test/regress/expected/dboptions.out
index 683c196d75..3dfdf91cc4 100644
--- a/src/test/regress/expected/dboptions.out
+++ b/src/test/regress/expected/dboptions.out
@@ -41,7 +41,7 @@ select pg_reload_conf();
(1 row)
-- should fail, because the connection limit is 0
-\! psql -h /tmp limitdb -c "select 'connected'" -U connlimit_test_user
+\! psql -h /tmp limitdb -Xc "select 'connected'" -U connlimit_test_user
psql: error: connection to server on socket "/tmp/.s.PGSQL.7000" failed: FATAL: too many connections for database "limitdb"
-- Test ALLOW_CONNECTIONS
create database limitdb2 allow_connections = true;
@@ -71,7 +71,7 @@ order by gp_segment_id;
(4 rows)
-- should fail, as we have disallowed connections
-\! psql -h /tmp limitdb2 -c "select 'connected'" -U connlimit_test_user
+\! psql -h /tmp limitdb2 -Xc "select 'connected'" -U connlimit_test_user
psql: error: connection to server on socket "/tmp/.s.PGSQL.7000" failed: FATAL: database "limitdb2" is not currently accepting connections
-- Test IS_TEMPLATE
create database templatedb is_template=true;
@@ -89,7 +89,7 @@ order by gp_segment_id;
\c templatedb
create table templatedb_table(i int);
-NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
\c regression
create database copieddb template templatedb;
diff --git a/src/test/regress/expected/distributed_transactions.out b/src/test/regress/expected/distributed_transactions.out
index 63af7f2723..67c1df6ced 100755
--- a/src/test/regress/expected/distributed_transactions.out
+++ b/src/test/regress/expected/distributed_transactions.out
@@ -355,8 +355,8 @@ end;
drop table if exists dtmcurse_foo;
drop table if exists dtmcurse_bar;
-- Test distribute transaction if 'COMMIT/END' is included in a multi-queries command.
-\! psql postgres -c "begin;end; create table dtx_test1(c1 int); drop table dtx_test1;"
-NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c1' as the Cloudberry Database data distribution key for this table.
+\! psql postgres -Xc "begin;end; create table dtx_test1(c1 int); drop table dtx_test1;"
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c1' 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.
DROP TABLE
-- Test two phase commit for extended query
diff --git a/src/test/regress/expected/minirepro.out b/src/test/regress/expected/minirepro.out
index cad9f00dcc..2c06ccfdf9 100644
--- a/src/test/regress/expected/minirepro.out
+++ b/src/test/regress/expected/minirepro.out
@@ -158,7 +158,7 @@ analyze minirepro_foo;
-- end_ignore
-- Run minirepro
drop table minirepro_foo; -- this will also delete the pg_statistic tuples for minirepro_foo and minirepro_foo_1
-\! psql -f data/minirepro.sql regression
+\! psql -Xf data/minirepro.sql regression
You are now connected to database "regression" as user "pivotal".
SET
SET
@@ -243,7 +243,7 @@ update pg_statistic set stavalues3='{"hello", "''world''"}'::text[] where starel
-- end_ignore
-- Run minirepro
drop table minirepro_foo; -- this should also delete the pg_statistic tuple for minirepro_foo
-\! psql -f data/minirepro.sql regression
+\! psql -Xf data/minirepro.sql regression
You are now connected to database "regression" as user "pivotal".
SET
SET
@@ -285,7 +285,7 @@ drop table minirepro_foo;
-- Caution: The following operation will remove the pg_statistic tuple
-- corresponding to pg_tablespace before it re-inserts it, which may lead to
-- corrupted stats for pg_tablespace. But, that shouldn't matter too much?
-\! psql -f data/minirepro.sql regression
+\! psql -Xf data/minirepro.sql regression
You are now connected to database "regression" as user "pivotal".
SET
SET
diff --git a/src/test/regress/input/createdb.source b/src/test/regress/input/createdb.source
index 8adb627471..7118513bb1 100644
--- a/src/test/regress/input/createdb.source
+++ b/src/test/regress/input/createdb.source
@@ -22,9 +22,9 @@ select force_mirrors_to_catch_up();
select count(*)=0 as result from
(select db_dirs(oid) from pg_database where datname = 'dowell') as foo;
-\! psql -d dowell -c "create table test1(a int, b text)"
-\! psql -d dowell -c "insert into test1 values (1, '111'), (2, '222'), (3, '333')"
-\! psql -d dowell -c "select * from test1"
+\! psql -d dowell -Xc "create table test1(a int, b text)"
+\! psql -d dowell -Xc "insert into test1 values (1, '111'), (2, '222'), (3, '333')"
+\! psql -d dowell -Xc "select * from test1"
drop database dowell;
diff --git a/src/test/regress/input/gpcopy.source b/src/test/regress/input/gpcopy.source
index 76e03ac487..3328c96627 100644
--- a/src/test/regress/input/gpcopy.source
+++ b/src/test/regress/input/gpcopy.source
@@ -669,7 +669,7 @@ COPY (SELECT * FROM segment_reject_limit_from) TO '/tmp/segment_reject_limit<SEG
-- 'COPY (SELECT ...) TO' on utility mode
CREATE EXTERNAL WEB TABLE copy_cmd_utility(a text, b int)
EXECUTE E'PGOPTIONS="-c gp_role=utility" \\
- psql -p $GP_MASTER_PORT $GP_DATABASE $GP_USER -c \\
+ psql -X -p $GP_MASTER_PORT $GP_DATABASE $GP_USER -c \\
"COPY (SELECT * FROM pg_class) TO \'/dev/null\'"'
ON COORDINATOR FORMAT 'text' (DELIMITER ' ');
SELECT a FROM copy_cmd_utility;
diff --git a/src/test/regress/output/createdb.source b/src/test/regress/output/createdb.source
index a0b117ae9c..6bcb3d8627 100644
--- a/src/test/regress/output/createdb.source
+++ b/src/test/regress/output/createdb.source
@@ -34,13 +34,13 @@ select count(*)=0 as result from
f
(1 row)
-\! psql -d dowell -c "create table test1(a int, b text)"
-NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Cloudberry Database data distribution key for this table.
+\! psql -d dowell -Xc "create table test1(a int, b text)"
+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.
CREATE TABLE
-\! psql -d dowell -c "insert into test1 values (1, '111'), (2, '222'), (3, '333')"
+\! psql -d dowell -Xc "insert into test1 values (1, '111'), (2, '222'), (3, '333')"
INSERT 0 3
-\! psql -d dowell -c "select * from test1"
+\! psql -d dowell -Xc "select * from test1"
a | b
---+-----
2 | 222
diff --git a/src/test/regress/output/gpcopy.source b/src/test/regress/output/gpcopy.source
index 092ebb76e7..a5fd552c2b 100755
--- a/src/test/regress/output/gpcopy.source
+++ b/src/test/regress/output/gpcopy.source
@@ -704,7 +704,7 @@ COPY (SELECT * FROM segment_reject_limit_from) TO '/tmp/segment_reject_limit<SEG
-- 'COPY (SELECT ...) TO' on utility mode
CREATE EXTERNAL WEB TABLE copy_cmd_utility(a text, b int)
EXECUTE E'PGOPTIONS="-c gp_role=utility" \\
- psql -p $GP_MASTER_PORT $GP_DATABASE $GP_USER -c \\
+ psql -X -p $GP_MASTER_PORT $GP_DATABASE $GP_USER -c \\
"COPY (SELECT * FROM pg_class) TO \'/dev/null\'"'
ON COORDINATOR FORMAT 'text' (DELIMITER ' ');
SELECT a FROM copy_cmd_utility;
diff --git a/src/test/regress/sql/async.sql b/src/test/regress/sql/async.sql
index bff0c3760c..4cc7f7ad80 100644
--- a/src/test/regress/sql/async.sql
+++ b/src/test/regress/sql/async.sql
@@ -28,6 +28,6 @@ SELECT pg_notification_queue_usage();
-- end_matchsubs
\c postgres
LISTEN notify_async3;
-\! psql postgres -c "notify notify_async3;"
+\! psql postgres -Xc "notify notify_async3;"
SELECT;
\c -
diff --git a/src/test/regress/sql/dboptions.sql b/src/test/regress/sql/dboptions.sql
index 7df79e585b..e98f7112f1 100644
--- a/src/test/regress/sql/dboptions.sql
+++ b/src/test/regress/sql/dboptions.sql
@@ -24,7 +24,7 @@ create user connlimit_test_user;
select pg_reload_conf();
-- should fail, because the connection limit is 0
-\! psql -h /tmp limitdb -c "select 'connected'" -U connlimit_test_user
+\! psql -h /tmp limitdb -Xc "select 'connected'" -U connlimit_test_user
-- Test ALLOW_CONNECTIONS
create database limitdb2 allow_connections = true;
@@ -40,7 +40,7 @@ select gp_segment_id, datconnlimit, datallowconn from gp_dist_random('pg_databas
order by gp_segment_id;
-- should fail, as we have disallowed connections
-\! psql -h /tmp limitdb2 -c "select 'connected'" -U connlimit_test_user
+\! psql -h /tmp limitdb2 -Xc "select 'connected'" -U connlimit_test_user
-- Test IS_TEMPLATE
create database templatedb is_template=true;
diff --git a/src/test/regress/sql/distributed_transactions.sql b/src/test/regress/sql/distributed_transactions.sql
index 7dc7bd3d67..6e4ee9aee1 100644
--- a/src/test/regress/sql/distributed_transactions.sql
+++ b/src/test/regress/sql/distributed_transactions.sql
@@ -299,7 +299,7 @@ drop table if exists dtmcurse_foo;
drop table if exists dtmcurse_bar;
-- Test distribute transaction if 'COMMIT/END' is included in a multi-queries command.
-\! psql postgres -c "begin;end; create table dtx_test1(c1 int); drop table dtx_test1;"
+\! psql postgres -Xc "begin;end; create table dtx_test1(c1 int); drop table dtx_test1;"
-- Test two phase commit for extended query
\! ./twophase_pqexecparams dbname=regression
diff --git a/src/test/regress/sql/gpsd.sql b/src/test/regress/sql/gpsd.sql
index 494d708e89..224f663d08 100644
--- a/src/test/regress/sql/gpsd.sql
+++ b/src/test/regress/sql/gpsd.sql
@@ -35,7 +35,7 @@ drop database gpsd_db_without_hll;
create database gpsd_db_without_hll;
-- start_ignore
-\! psql -f data/gpsd-without-hll.sql gpsd_db_without_hll
+\! psql -Xf data/gpsd-without-hll.sql gpsd_db_without_hll
-- end_ignore
\c gpsd_db_without_hll
@@ -101,7 +101,7 @@ drop database gpsd_db_with_hll;
create database gpsd_db_with_hll;
-- start_ignore
-\! psql -f data/gpsd-with-hll.sql gpsd_db_with_hll
+\! psql -Xf data/gpsd-with-hll.sql gpsd_db_with_hll
-- end_ignore
\c gpsd_db_with_hll
diff --git a/src/test/regress/sql/minirepro.sql b/src/test/regress/sql/minirepro.sql
index 397bb614b8..207a76feb5 100644
--- a/src/test/regress/sql/minirepro.sql
+++ b/src/test/regress/sql/minirepro.sql
@@ -87,7 +87,7 @@ analyze minirepro_foo;
-- Run minirepro
drop table minirepro_foo; -- this will also delete the pg_statistic tuples for minirepro_foo and minirepro_foo_1
-\! psql -f data/minirepro.sql regression
+\! psql -Xf data/minirepro.sql regression
select
staattnum,
@@ -146,7 +146,7 @@ update pg_statistic set stavalues3='{"hello", "''world''"}'::text[] where starel
-- Run minirepro
drop table minirepro_foo; -- this should also delete the pg_statistic tuple for minirepro_foo
-\! psql -f data/minirepro.sql regression
+\! psql -Xf data/minirepro.sql regression
select stavalues3 from pg_statistic where starelid='minirepro_foo'::regclass;
@@ -168,7 +168,7 @@ drop table minirepro_foo;
-- Caution: The following operation will remove the pg_statistic tuple
-- corresponding to pg_tablespace before it re-inserts it, which may lead to
-- corrupted stats for pg_tablespace. But, that shouldn't matter too much?
-\! psql -f data/minirepro.sql regression
+\! psql -Xf data/minirepro.sql regression
select
staattnum,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 06/11: Enhance logging for dispatch conn liveness checks
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 a00b90563af897d45bf506a8d972e21d036c7634
Author: Soumyadeep Chakraborty <so...@gmail.com>
AuthorDate: Thu Mar 2 10:29:09 2023 -0800
Enhance logging for dispatch conn liveness checks
Finish the job started in 13902f8b335.
Improvements:
(1) We should print the error message from errno iff recv returned -1.
We were printing the errno message even if recv returned 0 (indicating
conn close).
(2) We should print a specific error message when 0 is returned from
recv(), or if the backend socket is invalid.
---
contrib/interconnect/udp/ic_udpifc.c | 51 ++++++++++++++++++------------------
1 file changed, 26 insertions(+), 25 deletions(-)
diff --git a/contrib/interconnect/udp/ic_udpifc.c b/contrib/interconnect/udp/ic_udpifc.c
index 2fe2426d3d..f8e3384fbc 100644
--- a/contrib/interconnect/udp/ic_udpifc.c
+++ b/contrib/interconnect/udp/ic_udpifc.c
@@ -738,7 +738,7 @@ static void freeDisorderedPackets(MotionConn *conn);
static void prepareRxConnForRead(MotionConn *conn);
static TupleChunkListItem receiveChunksUDPIFC(ChunkTransportState *pTransportStates, ChunkTransportStateEntry *pEntry,
int16 motNodeID, int16 *srcRoute, MotionConn *conn);
-static bool dispatcherAYT(void);
+static void dispatcherAYT(void);
static void checkQDConnectionAlive(void);
@@ -6101,9 +6101,10 @@ SendStopMessageUDPIFC(ChunkTransportState *transportStates, int16 motNodeID)
*
* The connection is a struct Port, stored in the global MyProcPort.
*
- * Return true if the dispatcher connection is still alive.
+ * ERROR out if the connection was closed or if we encountered an unrecoverable
+ * error trying to recv().
*/
-static bool
+static void
dispatcherAYT(void)
{
ssize_t ret;
@@ -6114,10 +6115,15 @@ dispatcherAYT(void)
* As a result, MyProcPort is NULL. We should skip dispatcherAYT check here.
*/
if (MyProcPort == NULL)
- return true;
+ return;
- if (MyProcPort->sock < 0)
- return false;
+ if (MyProcPort->sock == PGINVALID_SOCKET)
+ {
+ ereport(COMMERROR,
+ (errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
+ errmsg("backend socket is invalid (recv)"),
+ errdetail("it could already have been closed")));
+ }
#ifndef WIN32
ret = recv(MyProcPort->sock, &buf, 1, MSG_PEEK | MSG_DONTWAIT);
@@ -6126,21 +6132,23 @@ dispatcherAYT(void)
#endif
if (ret == 0) /* socket has been closed. EOF */
- return false;
-
- if (ret > 0) /* data waiting on socket, it must be OK. */
- return true;
+ {
+ ereport(COMMERROR,
+ (errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
+ errmsg("dispatch connection lost (recv)"),
+ errdetail("peer socket has been closed, eof received")));
+ }
if (ret == -1) /* error, or would be block. */
{
if (errno == EAGAIN || errno == EINPROGRESS)
- return true; /* connection intact, no data available */
- else
- return false;
+ return; /* connection intact, no data available */
+ else /* unrecoverable error */
+ ereport(COMMERROR,
+ (errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
+ errmsg("dispatch connection lost (recv): %m")));
}
- /* not reached */
-
- return true;
+ /* data waiting on socket, it must be OK. */
}
/*
@@ -6150,16 +6158,9 @@ dispatcherAYT(void)
static void
checkQDConnectionAlive(void)
{
- if (!dispatcherAYT())
+ if (Gp_role == GP_ROLE_EXECUTE)
{
- if (Gp_role == GP_ROLE_EXECUTE)
- ereport(ERROR,
- (errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
- errmsg("interconnect error segment lost contact with master (recv)")));
- else
- ereport(ERROR,
- (errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
- errmsg("interconnect error master lost contact with client (recv)")));
+ dispatcherAYT();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 02/11: Use __gp_aoblkdir() in alter_table_set_am.sql
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 fc5bb44ef83f27e1e4f090494aecbe7565c83698
Author: Soumyadeep Chakraborty <so...@gmail.com>
AuthorDate: Mon Aug 8 12:24:53 2022 -0700
Use __gp_aoblkdir() in alter_table_set_am.sql
Pedantic change: Also, update the invocations of __gp_aovisimap() to
execute on the segments.
---
src/test/regress/expected/alter_table_set_am.out | 59 ++++++++++++++----------
src/test/regress/sql/alter_table_set_am.sql | 20 ++++----
2 files changed, 45 insertions(+), 34 deletions(-)
diff --git a/src/test/regress/expected/alter_table_set_am.out b/src/test/regress/expected/alter_table_set_am.out
index 9dcb0fe049..3fbdcaf173 100644
--- a/src/test/regress/expected/alter_table_set_am.out
+++ b/src/test/regress/expected/alter_table_set_am.out
@@ -138,7 +138,6 @@ SELECT * FROM relfilebeforeao INTERSECT SELECT * FROM relfileafterao;
(0 rows)
-- aux tables are created, pg_appendonly row is created
--- FIXME: add check for gp_aoblkdir
SELECT * FROM gp_toolkit.__gp_aoseg('heap2ao');
segment_id | segno | eof | tupcount | varblockcount | eof_uncompressed | modcount | formatversion | state
------------+-------+-----+----------+---------------+------------------+----------+---------------+-------
@@ -147,11 +146,19 @@ SELECT * FROM gp_toolkit.__gp_aoseg('heap2ao');
1 | 0 | 40 | 1 | 1 | 40 | 1 | 3 | 1
(3 rows)
-SELECT * FROM gp_toolkit.__gp_aovisimap('heap2ao');
- tid | segno | row_num
------+-------+---------
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heap2ao')).* FROM gp_dist_random('gp_id');
+ gp_segment_id | tid | segno | row_num
+---------------+-----+-------+---------
(0 rows)
+SELECT gp_segment_id, (gp_toolkit.__gp_aoblkdir('heap2ao')).* FROM gp_dist_random('gp_id');
+ gp_segment_id | tupleid | segno | columngroup_no | entry_no | first_row_no | file_offset | row_count
+---------------+---------+-------+----------------+----------+--------------+-------------+-----------
+ 0 | (0,1) | 0 | 0 | 0 | 1 | 0 | 3
+ 1 | (0,1) | 0 | 0 | 0 | 1 | 0 | 1
+ 2 | (0,1) | 0 | 0 | 0 | 1 | 0 | 1
+(3 rows)
+
SELECT * FROM gp_toolkit.__gp_aoseg('heap2ao2');
segment_id | segno | eof | tupcount | varblockcount | eof_uncompressed | modcount | formatversion | state
------------+-------+-----+----------+---------------+------------------+----------+---------------+-------
@@ -160,9 +167,9 @@ SELECT * FROM gp_toolkit.__gp_aoseg('heap2ao2');
0 | 0 | 72 | 3 | 1 | 88 | 1 | 3 | 1
(3 rows)
-SELECT * FROM gp_toolkit.__gp_aovisimap('heap2ao2');
- tid | segno | row_num
------+-------+---------
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heap2ao2')).* FROM gp_dist_random('gp_id');
+ gp_segment_id | tid | segno | row_num
+---------------+-----+-------+---------
(0 rows)
-- pg_appendonly should have entries associated with the new AO tables
@@ -312,9 +319,9 @@ SELECT * FROM gp_toolkit.__gp_aoseg('heapbase');
2 | 0 | 40 | 1 | 1 | 40 | 1 | 3 | 1
(3 rows)
-SELECT * FROM gp_toolkit.__gp_aovisimap('heapbase');
- tid | segno | row_num
------+-------+---------
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heapbase')).* FROM gp_dist_random('gp_id');
+ gp_segment_id | tid | segno | row_num
+---------------+-----+-------+---------
(0 rows)
SELECT * FROM gp_toolkit.__gp_aoseg('heapbase2');
@@ -325,9 +332,9 @@ SELECT * FROM gp_toolkit.__gp_aoseg('heapbase2');
0 | 0 | 72 | 3 | 1 | 88 | 1 | 3 | 1
(3 rows)
-SELECT * FROM gp_toolkit.__gp_aovisimap('heapbase2');
- tid | segno | row_num
------+-------+---------
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heapbase2')).* FROM gp_dist_random('gp_id');
+ gp_segment_id | tid | segno | row_num
+---------------+-----+-------+---------
(0 rows)
SELECT c.relname FROM pg_class c, pg_appendonly p WHERE c.relname LIKE 'heapbase%' AND c.oid = p.relid;
@@ -339,13 +346,13 @@ SELECT c.relname FROM pg_class c, pg_appendonly p WHERE c.relname LIKE 'heapbase
-- aux tables are not created for child table
SELECT * FROM gp_toolkit.__gp_aoseg('heapchild');
-ERROR: 'heapchild' is not an append-only row relation (seg0 slice1 127.0.0.1:7002 pid=29947)
-SELECT * FROM gp_toolkit.__gp_aovisimap('heapchild');
-ERROR: function not supported on relation
+ERROR: 'heapchild' is not an append-only row relation (seg0 slice1 192.168.0.148:7002 pid=674753)
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heapchild')).* FROM gp_dist_random('gp_id');
+ERROR: function not supported on relation (seg0 slice1 192.168.0.148:7002 pid=674753)
SELECT * FROM gp_toolkit.__gp_aoseg('heapchild2');
-ERROR: 'heapchild2' is not an append-only row relation (seg0 slice1 127.0.0.1:7002 pid=29947)
-SELECT * FROM gp_toolkit.__gp_aovisimap('heapchild2');
-ERROR: function not supported on relation
+ERROR: 'heapchild2' is not an append-only row relation (seg0 slice1 192.168.0.148:7002 pid=674753)
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heapchild2')).* FROM gp_dist_random('gp_id');
+ERROR: function not supported on relation (seg0 slice1 192.168.0.148:7002 pid=674753)
SELECT c.relname FROM pg_class c, pg_appendonly p WHERE c.relname LIKE 'heapchild%' AND c.oid = p.relid;
relname
---------
@@ -422,13 +429,15 @@ SELECT * FROM ao2heap2;
-- No AO aux tables should be left
SELECT * FROM gp_toolkit.__gp_aoseg('ao2heap');
-ERROR: 'ao2heap' is not an append-only row relation (seg0 slice1 127.0.1.1:7002 pid=6817)
-SELECT * FROM gp_toolkit.__gp_aovisimap('ao2heap');
-ERROR: function not supported on relation
+ERROR: 'ao2heap' is not an append-only row relation (seg0 slice1 192.168.0.148:7002 pid=674753)
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('ao2heap')).* FROM gp_dist_random('gp_id');
+ERROR: function not supported on relation (seg0 slice1 192.168.0.148:7002 pid=674753)
+SELECT gp_segment_id, (gp_toolkit.__gp_aoblkdir('ao2heap')).* FROM gp_dist_random('gp_id');
+ERROR: function not supported on non append-optimized relation (seg2 slice1 192.168.0.148:7004 pid=1401173)
SELECT * FROM gp_toolkit.__gp_aoseg('ao2heap2');
-ERROR: 'ao2heap2' is not an append-only row relation (seg0 slice1 127.0.1.1:7002 pid=6817)
-SELECT * FROM gp_toolkit.__gp_aovisimap('ao2heap2');
-ERROR: function not supported on relation
+ERROR: 'ao2heap2' is not an append-only row relation (seg0 slice1 192.168.0.148:7002 pid=674753)
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('ao2heap2')).* FROM gp_dist_random('gp_id');
+ERROR: function not supported on relation (seg0 slice1 192.168.0.148:7002 pid=674753)
-- No pg_appendonly entries should be left too
SELECT c.relname FROM pg_class c, pg_appendonly p WHERE c.relname LIKE 'ao2heap%' AND c.oid = p.relid;
relname
diff --git a/src/test/regress/sql/alter_table_set_am.sql b/src/test/regress/sql/alter_table_set_am.sql
index 336025d7e4..ed01c50676 100644
--- a/src/test/regress/sql/alter_table_set_am.sql
+++ b/src/test/regress/sql/alter_table_set_am.sql
@@ -86,11 +86,12 @@ CREATE TEMP TABLE relfileafterao AS
SELECT * FROM relfilebeforeao INTERSECT SELECT * FROM relfileafterao;
-- aux tables are created, pg_appendonly row is created
--- FIXME: add check for gp_aoblkdir
SELECT * FROM gp_toolkit.__gp_aoseg('heap2ao');
-SELECT * FROM gp_toolkit.__gp_aovisimap('heap2ao');
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heap2ao')).* FROM gp_dist_random('gp_id');
+SELECT gp_segment_id, (gp_toolkit.__gp_aoblkdir('heap2ao')).* FROM gp_dist_random('gp_id');
+
SELECT * FROM gp_toolkit.__gp_aoseg('heap2ao2');
-SELECT * FROM gp_toolkit.__gp_aovisimap('heap2ao2');
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heap2ao2')).* FROM gp_dist_random('gp_id');
-- pg_appendonly should have entries associated with the new AO tables
SELECT c.relname FROM pg_class c, pg_appendonly p WHERE c.relname LIKE 'heap2ao%' AND c.oid = p.relid;
@@ -154,16 +155,16 @@ SELECT count(*) FROM (SELECT * FROM inheritchildrelfilebefore UNION SELECT * FRO
-- aux tables are created, pg_appendonly row is created
SELECT * FROM gp_toolkit.__gp_aoseg('heapbase');
-SELECT * FROM gp_toolkit.__gp_aovisimap('heapbase');
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heapbase')).* FROM gp_dist_random('gp_id');
SELECT * FROM gp_toolkit.__gp_aoseg('heapbase2');
-SELECT * FROM gp_toolkit.__gp_aovisimap('heapbase2');
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heapbase2')).* FROM gp_dist_random('gp_id');
SELECT c.relname FROM pg_class c, pg_appendonly p WHERE c.relname LIKE 'heapbase%' AND c.oid = p.relid;
-- aux tables are not created for child table
SELECT * FROM gp_toolkit.__gp_aoseg('heapchild');
-SELECT * FROM gp_toolkit.__gp_aovisimap('heapchild');
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heapchild')).* FROM gp_dist_random('gp_id');
SELECT * FROM gp_toolkit.__gp_aoseg('heapchild2');
-SELECT * FROM gp_toolkit.__gp_aovisimap('heapchild2');
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('heapchild2')).* FROM gp_dist_random('gp_id');
SELECT c.relname FROM pg_class c, pg_appendonly p WHERE c.relname LIKE 'heapchild%' AND c.oid = p.relid;
-- Scenario 3: AO to Heap
@@ -205,9 +206,10 @@ SELECT * FROM ao2heap2;
-- No AO aux tables should be left
SELECT * FROM gp_toolkit.__gp_aoseg('ao2heap');
-SELECT * FROM gp_toolkit.__gp_aovisimap('ao2heap');
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('ao2heap')).* FROM gp_dist_random('gp_id');
+SELECT gp_segment_id, (gp_toolkit.__gp_aoblkdir('ao2heap')).* FROM gp_dist_random('gp_id');
SELECT * FROM gp_toolkit.__gp_aoseg('ao2heap2');
-SELECT * FROM gp_toolkit.__gp_aovisimap('ao2heap2');
+SELECT gp_segment_id, (gp_toolkit.__gp_aovisimap('ao2heap2')).* FROM gp_dist_random('gp_id');
-- No pg_appendonly entries should be left too
SELECT c.relname FROM pg_class c, pg_appendonly p WHERE c.relname LIKE 'ao2heap%' AND c.oid = p.relid;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 10/11: [gpdemo] polish checkDemoConfig (#13672)
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 821e59ea8a288ed3bcff12c37797ebb4445900d3
Author: Junwang Zhao <zh...@gmail.com>
AuthorDate: Fri Jun 17 13:59:45 2022 +0800
[gpdemo] polish checkDemoConfig (#13672)
Here is the case:
If one gpdemo cluster with `PORT_BASE=7008` is running on the
machine, then a second gpdemo cluster with `PORT_BASE=7000`
runs `make check` will fail due to extra segment ports check.
It make no sense to check `4 * $NUM_PRIMARY_MIRROR_PAIRS` ports
since the needed segment ports are already list in
${DEMO_SEG_PORTS_LIST}, check only what we need.
Signed-off-by: Junwang Zhao <zh...@gmail.com>
---
gpAux/gpdemo/demo_cluster.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/gpAux/gpdemo/demo_cluster.sh b/gpAux/gpdemo/demo_cluster.sh
index 3c2eeee59b..153e222b80 100755
--- a/gpAux/gpdemo/demo_cluster.sh
+++ b/gpAux/gpdemo/demo_cluster.sh
@@ -90,9 +90,8 @@ checkDemoConfig(){
return 1
fi
- for (( i=0; i<`expr 4 \* $NUM_PRIMARY_MIRROR_PAIRS`; i++ )); do
- PORT_NUM=`expr $DEMO_PORT_BASE + $i`
-
+ # Check if all Segment Ports are free
+ for PORT_NUM in ${DEMO_SEG_PORTS_LIST}; do
echo " Segment port check .. : ${PORT_NUM}"
PORT_FILE="/tmp/.s.PGSQL.${PORT_NUM}"
if [ -f ${PORT_FILE} -o -S ${PORT_FILE} ] ; then
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 09/11: Update fix_mdps.py script to python3 syntax
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 2a73f3bec462b4bb554bfd9c5624cef94b26e421
Author: David Kimura <dk...@vmware.com>
AuthorDate: Mon Jan 29 10:07:47 2024 -0800
Update fix_mdps.py script to python3 syntax
- Ran: "2to3 -w -n fix_mdps.py"
- Removed absolute python path
---
src/backend/gporca/scripts/fix_mdps.py | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/backend/gporca/scripts/fix_mdps.py b/src/backend/gporca/scripts/fix_mdps.py
index 86304617ae..35550081e6 100755
--- a/src/backend/gporca/scripts/fix_mdps.py
+++ b/src/backend/gporca/scripts/fix_mdps.py
@@ -1,4 +1,4 @@
-#!/usr/local/bin/python
+#!/usr/bin/env python
#
# updates plan and plan size in mdp files. Run ./fix_mdps.py --help for detailed description
# Should be run from within <orca_src>/build directory
@@ -72,7 +72,7 @@ def processLogFile(logFileLines):
current_file = line.split()[-1]
current_file = current_file.split('\"')[0]
if read_plan > 0:
- print "Log file contains partial plans for %s, please update this file by hand" % (current_file)
+ print("Log file contains partial plans for %s, please update this file by hand" % (current_file))
read_plan = 0
elif actualPlanMatch:
read_plan = 1
@@ -85,14 +85,14 @@ def processLogFile(logFileLines):
actual_plan = actual_plan + " " + line
if not dryrun:
replacePlanInFile(current_file, actual_plan )
- print "Changed query plan in %s \n" % (current_file)
+ print("Changed query plan in %s \n" % (current_file))
else:
- print "Query plan is different in %s \n" % (current_file)
+ print("Query plan is different in %s \n" % (current_file))
elif read_plan > 1:
actual_plan = actual_plan + " " + line
if re.search(r',TRACE,', line):
# we reached the end of the plan section without finding the end plan tag
- print "Log file contains partial plans for %s, please update this file by hand" % (current_file)
+ print("Log file contains partial plans for %s, please update this file by hand" % (current_file))
read_plan = 0
elif actualSizeMatch:
actualSize = re.search('Actual size: (\d+)', line).group(1)
@@ -100,23 +100,23 @@ def processLogFile(logFileLines):
expectedSize = re.search('Expected size: (\d+)', line).group(1)
if not dryrun:
replacePlanSize(current_file, actualSize, expectedSize)
- print "Changed plan size in %s \n" % (current_file)
+ print("Changed plan size in %s \n" % (current_file))
else:
- print "Plan size is different in %s \n" % (current_file)
+ print("Plan size is different in %s \n" % (current_file))
failureMatch = 0
elif errorLogMatch:
- print "Error in file %s: %s" % (current_file, line)
+ print("Error in file %s: %s" % (current_file, line))
elif failureMatch:
if not re.search(r'Plan [a-z ]*comparison', line) and not re.search(r'Unittest', line):
if errorfile != current_file:
- print "File %s failed for some other reason\n" % (current_file)
+ print("File %s failed for some other reason\n" % (current_file))
errorfile = current_file
def runTests(testFileNames):
tests_to_fix = parseInputFile(testFileNames)
for test in tests_to_fix:
command = "./server/gporca_test -U " + test
- print "Running test: " + test
+ print("Running test: " + test)
command = command.split()
all_lines = run_command(command)
processLogFile(all_lines)
@@ -140,13 +140,13 @@ def main():
logfile = args.logFile
if inputfile is None and logfile is None:
- print "Either a file with failed tests or a log file needs to be specified\n"
+ print("Either a file with failed tests or a log file needs to be specified\n")
exit(1)
elif inputfile is not None and logfile is not None:
- print "If a file with failed tests is specified, the --logFile is not allowed\n"
+ print("If a file with failed tests is specified, the --logFile is not allowed\n")
exit(1)
- print "File: %s, dryrun %s, logfile %s\n" % (inputfile, dryrun, logfile)
+ print("File: %s, dryrun %s, logfile %s\n" % (inputfile, dryrun, logfile))
if inputfile is not None:
runTests(inputfile)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 11/11: Error out when create or put role into system_group.
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 b99b12bae7b62fccf7510e4f07063b024a80856b
Author: Zhenghua Lyu <ka...@gmail.com>
AuthorDate: Tue May 30 02:41:22 2023 +0000
Error out when create or put role into system_group.
system_group is a resgroup to hold processes except QD or QEs.
It is not allowed to create or alter role in a system group.
---
src/backend/commands/user.c | 13 +++++++++++++
src/test/isolation2/expected/resgroup/resgroup_syntax.out | 10 ++++++++++
src/test/isolation2/sql/resgroup/resgroup_syntax.sql | 6 ++++++
3 files changed, 29 insertions(+)
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index a3e5025076..a97b09cecd 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -679,11 +679,17 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
Oid rsgid;
rsgid = get_resgroup_oid(resgroup, false);
+
if (rsgid == ADMINRESGROUP_OID && !issuper)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("only superuser can be assigned to admin resgroup")));
+ if (rsgid == SYSTEMRESGROUP_OID)
+ ereport(ERROR,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ errmsg("assigning to system resgroup is not allowed")));
+
ResGroupCheckForRole(rsgid);
new_record[Anum_pg_authid_rolresgroup - 1] = ObjectIdGetDatum(rsgid);
@@ -1760,10 +1766,17 @@ AlterRole(AlterRoleStmt *stmt)
}
rsgid = get_resgroup_oid(resgroup, false);
+
if (rsgid == ADMINRESGROUP_OID && !bWas_super)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("only superuser can be assigned to admin resgroup")));
+
+ if (rsgid == SYSTEMRESGROUP_OID)
+ ereport(ERROR,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ errmsg("assigning to system resgroup is not allowed")));
+
ResGroupCheckForRole(rsgid);
new_record[Anum_pg_authid_rolresgroup - 1] =
ObjectIdGetDatum(rsgid);
diff --git a/src/test/isolation2/expected/resgroup/resgroup_syntax.out b/src/test/isolation2/expected/resgroup/resgroup_syntax.out
index 5a06d47697..577940f4d2 100644
--- a/src/test/isolation2/expected/resgroup/resgroup_syntax.out
+++ b/src/test/isolation2/expected/resgroup/resgroup_syntax.out
@@ -72,6 +72,14 @@ ERROR: resource group "non_exist_group" does not exist
ALTER ROLE rg_test_role RESOURCE GROUP admin_group;
ERROR: only superuser can be assigned to admin resgroup
+--cannot create or put role in system_group, should error out
+CREATE ROLE r_test_system_group RESOURCE GROUP system_group;
+ERROR: assigning to system resgroup is not allowed
+CREATE ROLE r_test_system_group;
+CREATE
+ALTER ROLE r_test_system_group RESOURCE GROUP system_group;
+ERROR: assigning to system resgroup is not allowed
+
CREATE ROLE rg_test_role1 RESOURCE GROUP non_exist_group;
ERROR: resource group "non_exist_group" does not exist
-- nonsuper user should not be assigned to admin group
@@ -83,6 +91,8 @@ DROP ROLE rg_test_role;
DROP
DROP ROLE rg_test_role_super;
DROP
+DROP ROLE r_test_system_group;
+DROP
-- ----------------------------------------------------------------------
-- Test: create/drop a resource group
diff --git a/src/test/isolation2/sql/resgroup/resgroup_syntax.sql b/src/test/isolation2/sql/resgroup/resgroup_syntax.sql
index 4d03a0b220..557b80af71 100644
--- a/src/test/isolation2/sql/resgroup/resgroup_syntax.sql
+++ b/src/test/isolation2/sql/resgroup/resgroup_syntax.sql
@@ -29,6 +29,11 @@ SELECT rolresgroup FROM pg_authid WHERE rolname = 'rg_test_role_super';
ALTER ROLE rg_test_role RESOURCE GROUP non_exist_group;
ALTER ROLE rg_test_role RESOURCE GROUP admin_group;
+--cannot create or put role in system_group, should error out
+CREATE ROLE r_test_system_group RESOURCE GROUP system_group;
+CREATE ROLE r_test_system_group;
+ALTER ROLE r_test_system_group RESOURCE GROUP system_group;
+
CREATE ROLE rg_test_role1 RESOURCE GROUP non_exist_group;
-- nonsuper user should not be assigned to admin group
CREATE ROLE rg_test_role1 RESOURCE GROUP admin_group;
@@ -36,6 +41,7 @@ CREATE ROLE rg_test_role1 RESOURCE GROUP admin_group;
-- cleanup
DROP ROLE rg_test_role;
DROP ROLE rg_test_role_super;
+DROP ROLE r_test_system_group;
-- ----------------------------------------------------------------------
-- Test: create/drop a resource group
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org