From 1da99f8423fcc4cf639cb166a5cce147f490341e Mon Sep 17 00:00:00 2001 From: Naisila Puka <37271756+naisila@users.noreply.github.com> Date: Tue, 12 Sep 2023 12:47:37 +0300 Subject: [PATCH 1/3] PG16 - Don't propagate GRANT ROLE with INHERIT/SET option (#7190) We currently don't support propagating these options in Citus Relevant PG commits: https://github.com/postgres/postgres/commit/e3ce2de https://github.com/postgres/postgres/commit/3d14e17 Limitation: We also need to take care of generated GRANT statements by dependencies in attempt to distribute something else. Specifically, this part of the code in `GenerateGrantRoleStmtsOfRole`: ``` grantRoleStmt->admin_opt = membership->admin_option; ``` In PG16, membership also has `inherit_option` and `set_option` which need to properly be part of the `grantRoleStmt`. We can skip for now since #7164 will take care of this soon, and also this is not an expected use-case. --- src/backend/distributed/commands/role.c | 35 ++++++++++ src/test/regress/expected/pg16.out | 89 +++++++++++++++++++++++++ src/test/regress/sql/pg16.sql | 63 +++++++++++++++++ 3 files changed, 187 insertions(+) diff --git a/src/backend/distributed/commands/role.c b/src/backend/distributed/commands/role.c index 99ce4fb9f..63ede986d 100644 --- a/src/backend/distributed/commands/role.c +++ b/src/backend/distributed/commands/role.c @@ -78,6 +78,7 @@ static const char * WrapQueryInAlterRoleIfExistsCall(const char *query, RoleSpec static VariableSetStmt * MakeVariableSetStmt(const char *config); static int ConfigGenericNameCompare(const void *lhs, const void *rhs); static List * RoleSpecToObjectAddress(RoleSpec *role, bool missing_ok); +static bool IsGrantRoleWithInheritOrSetOption(GrantRoleStmt *stmt); /* controlled via GUC */ bool EnableCreateRolePropagation = true; @@ -1141,6 +1142,19 @@ PreprocessGrantRoleStmt(Node *node, const char *queryString, return NIL; } + if (IsGrantRoleWithInheritOrSetOption(stmt)) + { + if (EnableUnsupportedFeatureMessages) + { + ereport(NOTICE, (errmsg("not propagating GRANT/REVOKE commands with specified" + " INHERIT/SET options to worker nodes"), + errhint( + "Connect to worker nodes directly to manually run the same" + " GRANT/REVOKE command after disabling DDL propagation."))); + } + return NIL; + } + /* * Postgres don't seem to use the grantor. Even dropping the grantor doesn't * seem to affect the membership. If this changes, we might need to add grantors @@ -1190,6 +1204,27 @@ PostprocessGrantRoleStmt(Node *node, const char *queryString) } +/* + * IsGrantRoleWithInheritOrSetOption returns true if the given + * GrantRoleStmt has inherit or set option specified in its options + */ +static bool +IsGrantRoleWithInheritOrSetOption(GrantRoleStmt *stmt) +{ +#if PG_VERSION_NUM >= PG_VERSION_16 + DefElem *opt = NULL; + foreach_ptr(opt, stmt->opt) + { + if (strcmp(opt->defname, "inherit") == 0 || strcmp(opt->defname, "set") == 0) + { + return true; + } + } +#endif + return false; +} + + /* * ConfigGenericNameCompare compares two config_generic structs based on their * name fields. If the name fields contain the same strings two structs are diff --git a/src/test/regress/expected/pg16.out b/src/test/regress/expected/pg16.out index 4d1b9bda8..8d47b6f1b 100644 --- a/src/test/regress/expected/pg16.out +++ b/src/test/regress/expected/pg16.out @@ -1009,6 +1009,95 @@ DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx REVOKE role1 FROM role2; RESET citus.log_remote_commands; RESET citus.grep_remote_commands; +-- +-- PG16 added new options to GRANT ROLE +-- inherit: https://github.com/postgres/postgres/commit/e3ce2de +-- set: https://github.com/postgres/postgres/commit/3d14e17 +-- We don't propagate for now in Citus +-- +GRANT role1 TO role2 WITH INHERIT FALSE; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH INHERIT TRUE; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH INHERIT OPTION; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH SET FALSE; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH SET TRUE; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH SET OPTION; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +REVOKE role1 FROM role2; +-- connect to worker node +GRANT role1 TO role2 WITH ADMIN OPTION, INHERIT FALSE, SET FALSE; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +SELECT roleid::regrole::text AS role, member::regrole::text, +admin_option, inherit_option, set_option FROM pg_auth_members +WHERE roleid::regrole::text = 'role1' ORDER BY 1, 2; + role | member | admin_option | inherit_option | set_option +--------------------------------------------------------------------- + role1 | role2 | t | f | f +(1 row) + +\c - - - :worker_1_port +SELECT roleid::regrole::text AS role, member::regrole::text, +admin_option, inherit_option, set_option FROM pg_auth_members +WHERE roleid::regrole::text = 'role1' ORDER BY 1, 2; + role | member | admin_option | inherit_option | set_option +--------------------------------------------------------------------- +(0 rows) + +SET citus.enable_ddl_propagation TO off; +GRANT role1 TO role2 WITH ADMIN OPTION, INHERIT FALSE, SET FALSE; +RESET citus.enable_ddl_propagation; +SELECT roleid::regrole::text AS role, member::regrole::text, +admin_option, inherit_option, set_option FROM pg_auth_members +WHERE roleid::regrole::text = 'role1' ORDER BY 1, 2; + role | member | admin_option | inherit_option | set_option +--------------------------------------------------------------------- + role1 | role2 | t | f | f +(1 row) + +\c - - - :master_port +REVOKE role1 FROM role2; +-- test REVOKES as well +GRANT role1 TO role2; +REVOKE SET OPTION FOR role1 FROM role2; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +REVOKE INHERIT OPTION FOR role1 FROM role2; +NOTICE: not propagating GRANT/REVOKE commands with specified INHERIT/SET options to worker nodes +HINT: Connect to worker nodes directly to manually run the same GRANT/REVOKE command after disabling DDL propagation. +DROP ROLE role1, role2; +-- test that everything works fine for roles that are not propagated +SET citus.enable_ddl_propagation TO off; +CREATE ROLE role3; +CREATE ROLE role4; +CREATE ROLE role5; +RESET citus.enable_ddl_propagation; +-- by default, admin option is false, inherit is true, set is true +GRANT role3 TO role4; +GRANT role3 TO role5 WITH ADMIN TRUE, INHERIT FALSE, SET FALSE; +SELECT roleid::regrole::text AS role, member::regrole::text, admin_option, inherit_option, set_option FROM pg_auth_members WHERE roleid::regrole::text = 'role3' ORDER BY 1, 2; + role | member | admin_option | inherit_option | set_option +--------------------------------------------------------------------- + role3 | role4 | f | t | t + role3 | role5 | t | f | f +(2 rows) + +DROP ROLE role3, role4, role5; \set VERBOSITY terse SET client_min_messages TO ERROR; DROP EXTENSION postgres_fdw CASCADE; diff --git a/src/test/regress/sql/pg16.sql b/src/test/regress/sql/pg16.sql index fb18a1b58..82e9edf1e 100644 --- a/src/test/regress/sql/pg16.sql +++ b/src/test/regress/sql/pg16.sql @@ -591,6 +591,69 @@ REVOKE role1 FROM role2; RESET citus.log_remote_commands; RESET citus.grep_remote_commands; +-- +-- PG16 added new options to GRANT ROLE +-- inherit: https://github.com/postgres/postgres/commit/e3ce2de +-- set: https://github.com/postgres/postgres/commit/3d14e17 +-- We don't propagate for now in Citus +-- +GRANT role1 TO role2 WITH INHERIT FALSE; +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH INHERIT TRUE; +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH INHERIT OPTION; +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH SET FALSE; +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH SET TRUE; +REVOKE role1 FROM role2; +GRANT role1 TO role2 WITH SET OPTION; +REVOKE role1 FROM role2; + +-- connect to worker node +GRANT role1 TO role2 WITH ADMIN OPTION, INHERIT FALSE, SET FALSE; + +SELECT roleid::regrole::text AS role, member::regrole::text, +admin_option, inherit_option, set_option FROM pg_auth_members +WHERE roleid::regrole::text = 'role1' ORDER BY 1, 2; + +\c - - - :worker_1_port + +SELECT roleid::regrole::text AS role, member::regrole::text, +admin_option, inherit_option, set_option FROM pg_auth_members +WHERE roleid::regrole::text = 'role1' ORDER BY 1, 2; + +SET citus.enable_ddl_propagation TO off; +GRANT role1 TO role2 WITH ADMIN OPTION, INHERIT FALSE, SET FALSE; +RESET citus.enable_ddl_propagation; + +SELECT roleid::regrole::text AS role, member::regrole::text, +admin_option, inherit_option, set_option FROM pg_auth_members +WHERE roleid::regrole::text = 'role1' ORDER BY 1, 2; + +\c - - - :master_port +REVOKE role1 FROM role2; + +-- test REVOKES as well +GRANT role1 TO role2; +REVOKE SET OPTION FOR role1 FROM role2; +REVOKE INHERIT OPTION FOR role1 FROM role2; + +DROP ROLE role1, role2; + +-- test that everything works fine for roles that are not propagated +SET citus.enable_ddl_propagation TO off; +CREATE ROLE role3; +CREATE ROLE role4; +CREATE ROLE role5; +RESET citus.enable_ddl_propagation; +-- by default, admin option is false, inherit is true, set is true +GRANT role3 TO role4; +GRANT role3 TO role5 WITH ADMIN TRUE, INHERIT FALSE, SET FALSE; +SELECT roleid::regrole::text AS role, member::regrole::text, admin_option, inherit_option, set_option FROM pg_auth_members WHERE roleid::regrole::text = 'role3' ORDER BY 1, 2; + +DROP ROLE role3, role4, role5; + \set VERBOSITY terse SET client_min_messages TO ERROR; DROP EXTENSION postgres_fdw CASCADE; From e5e64b74541261bd06505a536c89fd5a0f5dc278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrkan=20=C4=B0ndibay?= Date: Tue, 12 Sep 2023 14:09:15 +0300 Subject: [PATCH 2/3] Adds alter database propagation - with and refresh collation (#7172) DESCRIPTION: Adds ALTER DATABASE WITH ... and REFRESH COLLATION VERSION support This PR adds supports for basic ALTER DATABASE statements propagation support. Below statements are supported: ALTER DATABASE with IS_TEMPLATE ; ALTER DATABASE with CONNECTION LIMIT ; ALTER DATABASE REFRESH COLLATION VERSION; --------- Co-authored-by: Jelte Fennema-Nio --- src/backend/distributed/commands/database.c | 65 ++++++++++++++ .../commands/distribute_object_ops.c | 37 +++++++- .../deparser/deparse_database_stmts.c | 85 ++++++++++++++++++- src/include/distributed/commands.h | 8 ++ src/include/distributed/deparser.h | 2 + .../expected/alter_database_propagation.out | 36 ++++++++ src/test/regress/expected/pg15.out | 7 ++ src/test/regress/multi_1_schedule | 1 + .../sql/alter_database_propagation.sql | 18 ++++ src/test/regress/sql/pg15.sql | 5 ++ 10 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 src/test/regress/expected/alter_database_propagation.out create mode 100644 src/test/regress/sql/alter_database_propagation.sql diff --git a/src/backend/distributed/commands/database.c b/src/backend/distributed/commands/database.c index ce46b2995..78061aa63 100644 --- a/src/backend/distributed/commands/database.c +++ b/src/backend/distributed/commands/database.c @@ -147,3 +147,68 @@ PreprocessGrantOnDatabaseStmt(Node *node, const char *queryString, return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); } + + +/* + * PreprocessAlterDatabaseStmt is executed before the statement is applied to the local + * postgres instance. + * + * In this stage we can prepare the commands that need to be run on all workers to grant + * on databases. + */ +List * +PreprocessAlterDatabaseStmt(Node *node, const char *queryString, + ProcessUtilityContext processUtilityContext) +{ + if (!ShouldPropagate()) + { + return NIL; + } + + AlterDatabaseStmt *stmt = castNode(AlterDatabaseStmt, node); + + EnsureCoordinator(); + + char *sql = DeparseTreeNode((Node *) stmt); + + List *commands = list_make3(DISABLE_DDL_PROPAGATION, + (void *) sql, + ENABLE_DDL_PROPAGATION); + + return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); +} + + +#if PG_VERSION_NUM >= PG_VERSION_15 + +/* + * PreprocessAlterDatabaseSetStmt is executed before the statement is applied to the local + * postgres instance. + * + * In this stage we can prepare the commands that need to be run on all workers to grant + * on databases. + */ +List * +PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *queryString, + ProcessUtilityContext processUtilityContext) +{ + if (!ShouldPropagate()) + { + return NIL; + } + + AlterDatabaseRefreshCollStmt *stmt = castNode(AlterDatabaseRefreshCollStmt, node); + + EnsureCoordinator(); + + char *sql = DeparseTreeNode((Node *) stmt); + + List *commands = list_make3(DISABLE_DDL_PROPAGATION, + (void *) sql, + ENABLE_DDL_PROPAGATION); + + return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); +} + + +#endif diff --git a/src/backend/distributed/commands/distribute_object_ops.c b/src/backend/distributed/commands/distribute_object_ops.c index 607a6db31..e31fda7b0 100644 --- a/src/backend/distributed/commands/distribute_object_ops.c +++ b/src/backend/distributed/commands/distribute_object_ops.c @@ -444,6 +444,30 @@ static DistributeObjectOps Database_Grant = { .markDistributed = false, }; +static DistributeObjectOps Database_Alter = { + .deparse = DeparseAlterDatabaseStmt, + .qualify = NULL, + .preprocess = PreprocessAlterDatabaseStmt, + .postprocess = NULL, + .objectType = OBJECT_DATABASE, + .operationType = DIST_OPS_ALTER, + .address = NULL, + .markDistributed = false, +}; + +#if PG_VERSION_NUM >= PG_VERSION_15 +static DistributeObjectOps Database_RefreshColl = { + .deparse = DeparseAlterDatabaseRefreshCollStmt, + .qualify = NULL, + .preprocess = PreprocessAlterDatabaseRefreshCollStmt, + .postprocess = NULL, + .objectType = OBJECT_DATABASE, + .operationType = DIST_OPS_ALTER, + .address = NULL, + .markDistributed = false, +}; +#endif + static DistributeObjectOps Domain_Alter = { .deparse = DeparseAlterDomainStmt, .qualify = QualifyAlterDomainStmt, @@ -1272,7 +1296,6 @@ static DistributeObjectOps Trigger_Rename = { .markDistributed = false, }; - /* * GetDistributeObjectOps looks up the DistributeObjectOps which handles the node. * @@ -1283,6 +1306,18 @@ GetDistributeObjectOps(Node *node) { switch (nodeTag(node)) { + case T_AlterDatabaseStmt: + { + return &Database_Alter; + } + +#if PG_VERSION_NUM >= PG_VERSION_15 + case T_AlterDatabaseRefreshCollStmt: + { + return &Database_RefreshColl; + } + +#endif case T_AlterDomainStmt: { return &Domain_Alter; diff --git a/src/backend/distributed/deparser/deparse_database_stmts.c b/src/backend/distributed/deparser/deparse_database_stmts.c index f1aaaa63b..8a24f738a 100644 --- a/src/backend/distributed/deparser/deparse_database_stmts.c +++ b/src/backend/distributed/deparser/deparse_database_stmts.c @@ -20,9 +20,12 @@ #include "distributed/deparser.h" #include "distributed/citus_ruleutils.h" +#include "commands/defrem.h" +#include "distributed/deparser.h" +#include "distributed/log_utils.h" static void AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt); - +static void AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt); char * DeparseAlterDatabaseOwnerStmt(Node *node) @@ -82,6 +85,52 @@ AppendGrantOnDatabaseStmt(StringInfo buf, GrantStmt *stmt) } +static void +AppendDefElemConnLimit(StringInfo buf, DefElem *def) +{ + appendStringInfo(buf, " CONNECTION LIMIT %ld", (long int) defGetNumeric(def)); +} + + +static void +AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt) +{ + appendStringInfo(buf, "ALTER DATABASE %s ", quote_identifier(stmt->dbname)); + + if (stmt->options) + { + ListCell *cell = NULL; + appendStringInfo(buf, "WITH "); + foreach(cell, stmt->options) + { + DefElem *def = castNode(DefElem, lfirst(cell)); + if (strcmp(def->defname, "is_template") == 0) + { + appendStringInfo(buf, "IS_TEMPLATE %s", + quote_literal_cstr(strVal(def->arg))); + } + else if (strcmp(def->defname, "connection_limit") == 0) + { + AppendDefElemConnLimit(buf, def); + } + else if (strcmp(def->defname, "allow_connections") == 0) + { + ereport(ERROR, + errmsg("ALLOW_CONNECTIONS is not supported")); + } + else + { + ereport(ERROR, + errmsg("unrecognized ALTER DATABASE option: %s", + def->defname)); + } + } + } + + appendStringInfo(buf, ";"); +} + + char * DeparseGrantOnDatabaseStmt(Node *node) { @@ -95,3 +144,37 @@ DeparseGrantOnDatabaseStmt(Node *node) return str.data; } + + +char * +DeparseAlterDatabaseStmt(Node *node) +{ + AlterDatabaseStmt *stmt = castNode(AlterDatabaseStmt, node); + + StringInfoData str = { 0 }; + initStringInfo(&str); + + AppendAlterDatabaseStmt(&str, stmt); + + return str.data; +} + + +#if PG_VERSION_NUM >= PG_VERSION_15 +char * +DeparseAlterDatabaseRefreshCollStmt(Node *node) +{ + AlterDatabaseRefreshCollStmt *stmt = (AlterDatabaseRefreshCollStmt *) node; + + StringInfoData str; + initStringInfo(&str); + + appendStringInfo(&str, "ALTER DATABASE %s REFRESH COLLATION VERSION;", + quote_identifier( + stmt->dbname)); + + return str.data; +} + + +#endif diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index c120f9429..309149293 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -223,6 +223,14 @@ extern List * DatabaseOwnerDDLCommands(const ObjectAddress *address); extern List * PreprocessGrantOnDatabaseStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); +extern List * PreprocessAlterDatabaseStmt(Node *node, const char *queryString, + ProcessUtilityContext processUtilityContext); + +extern List * PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *queryString, + ProcessUtilityContext + processUtilityContext); + + /* domain.c - forward declarations */ extern List * CreateDomainStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess); diff --git a/src/include/distributed/deparser.h b/src/include/distributed/deparser.h index 85e6b9de0..aeefc811d 100644 --- a/src/include/distributed/deparser.h +++ b/src/include/distributed/deparser.h @@ -223,6 +223,8 @@ extern char * DeparseAlterExtensionStmt(Node *stmt); /* forward declarations for deparse_database_stmts.c */ extern char * DeparseAlterDatabaseOwnerStmt(Node *node); extern char * DeparseGrantOnDatabaseStmt(Node *node); +extern char * DeparseAlterDatabaseStmt(Node *node); +extern char * DeparseAlterDatabaseRefreshCollStmt(Node *node); /* forward declaration for deparse_publication_stmts.c */ extern char * DeparseCreatePublicationStmt(Node *stmt); diff --git a/src/test/regress/expected/alter_database_propagation.out b/src/test/regress/expected/alter_database_propagation.out new file mode 100644 index 000000000..b7d04c50f --- /dev/null +++ b/src/test/regress/expected/alter_database_propagation.out @@ -0,0 +1,36 @@ +set citus.log_remote_commands = true; +set citus.grep_remote_commands = '%ALTER DATABASE%'; +-- since ALLOW_CONNECTIONS alter option should be executed in a different database +-- and since we don't have a multiple database support for now, +-- this statement will get error +alter database regression ALLOW_CONNECTIONS false; +ERROR: ALLOW_CONNECTIONS is not supported +alter database regression with CONNECTION LIMIT 100; +NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +alter database regression with IS_TEMPLATE true CONNECTION LIMIT 50; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE 'true' CONNECTION LIMIT 50; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE 'true' CONNECTION LIMIT 50; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +alter database regression with CONNECTION LIMIT -1; +NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +alter database regression with IS_TEMPLATE true; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE 'true'; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE 'true'; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +alter database regression with IS_TEMPLATE false; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE 'false'; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE 'false'; +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx +-- this statement will get error since we don't have a multiple database support for now +alter database regression rename to regression2; +ERROR: current database cannot be renamed +set citus.log_remote_commands = false; diff --git a/src/test/regress/expected/pg15.out b/src/test/regress/expected/pg15.out index 740a87812..fcbb0cd12 100644 --- a/src/test/regress/expected/pg15.out +++ b/src/test/regress/expected/pg15.out @@ -1523,6 +1523,13 @@ ORDER BY is_coordinator DESC, result; f | [{"indexdefs": ["CREATE UNIQUE INDEX referencing__key ON pg15.referencing USING btree (test_2)"], "indexnames": ["referencing__key"]}, {"indexdefs": ["CREATE UNIQUE INDEX referencing__key1 ON pg15.referencing USING btree (test_3) NULLS NOT DISTINCT"], "indexnames": ["referencing__key1"]}] (3 rows) +set citus.log_remote_commands = true; +set citus.grep_remote_commands = '%ALTER DATABASE%'; +alter database regression REFRESH COLLATION VERSION; +NOTICE: version has not changed +NOTICE: issuing ALTER DATABASE regression REFRESH COLLATION VERSION; +NOTICE: issuing ALTER DATABASE regression REFRESH COLLATION VERSION; +set citus.log_remote_commands = false; -- Clean up \set VERBOSITY terse SET client_min_messages TO ERROR; diff --git a/src/test/regress/multi_1_schedule b/src/test/regress/multi_1_schedule index 145a83df2..4dead5be3 100644 --- a/src/test/regress/multi_1_schedule +++ b/src/test/regress/multi_1_schedule @@ -51,6 +51,7 @@ test: multi_metadata_attributes test: multi_read_from_secondaries test: grant_on_database_propagation +test: alter_database_propagation # ---------- # multi_citus_tools tests utility functions written for citus tools diff --git a/src/test/regress/sql/alter_database_propagation.sql b/src/test/regress/sql/alter_database_propagation.sql new file mode 100644 index 000000000..748a66ddd --- /dev/null +++ b/src/test/regress/sql/alter_database_propagation.sql @@ -0,0 +1,18 @@ +set citus.log_remote_commands = true; +set citus.grep_remote_commands = '%ALTER DATABASE%'; + +-- since ALLOW_CONNECTIONS alter option should be executed in a different database +-- and since we don't have a multiple database support for now, +-- this statement will get error +alter database regression ALLOW_CONNECTIONS false; + + +alter database regression with CONNECTION LIMIT 100; +alter database regression with IS_TEMPLATE true CONNECTION LIMIT 50; +alter database regression with CONNECTION LIMIT -1; +alter database regression with IS_TEMPLATE true; +alter database regression with IS_TEMPLATE false; +-- this statement will get error since we don't have a multiple database support for now +alter database regression rename to regression2; + +set citus.log_remote_commands = false; diff --git a/src/test/regress/sql/pg15.sql b/src/test/regress/sql/pg15.sql index e7dfbda04..fe60222dd 100644 --- a/src/test/regress/sql/pg15.sql +++ b/src/test/regress/sql/pg15.sql @@ -965,6 +965,11 @@ SELECT (groupid = 0) AS is_coordinator, result FROM run_command_on_all_nodes( JOIN pg_dist_node USING (nodeid) ORDER BY is_coordinator DESC, result; +set citus.log_remote_commands = true; +set citus.grep_remote_commands = '%ALTER DATABASE%'; +alter database regression REFRESH COLLATION VERSION; +set citus.log_remote_commands = false; + -- Clean up \set VERBOSITY terse SET client_min_messages TO ERROR; From e0683aab8450189514edb70c930ba2cb92e55f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrkan=20=C4=B0ndibay?= Date: Tue, 12 Sep 2023 14:56:29 +0300 Subject: [PATCH 3/3] Removes ubuntu:kinetic pipelines since it's EOL (#7195) ubuntu:kinetic is EOL so removing it's pipeline https://fridge.ubuntu.com/2023/06/14/ubuntu-22-10-kinetic-kudu-reaches-end-of-life-on-july-20-2023/ --- .github/workflows/packaging-test-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/packaging-test-pipelines.yml b/.github/workflows/packaging-test-pipelines.yml index c66c5b4f7..356a590a4 100644 --- a/.github/workflows/packaging-test-pipelines.yml +++ b/.github/workflows/packaging-test-pipelines.yml @@ -125,7 +125,6 @@ jobs: - debian-bullseye-all - ubuntu-focal-all - ubuntu-jammy-all - - ubuntu-kinetic-all POSTGRES_VERSION: ${{ fromJson(needs.get_postgres_versions_from_file.outputs.pg_versions) }}