mirror of https://github.com/citusdata/citus.git
Merge e089f906b1 into a4040ba5da
commit
6b165a2886
|
|
@ -249,7 +249,7 @@ FilterDistributedDatabases(List *databases)
|
|||
* IsSetTablespaceStatement returns true if the statement is a SET TABLESPACE statement,
|
||||
* false otherwise.
|
||||
*/
|
||||
static bool
|
||||
bool
|
||||
IsSetTablespaceStatement(AlterDatabaseStmt *stmt)
|
||||
{
|
||||
DefElem *def = NULL;
|
||||
|
|
@ -288,7 +288,9 @@ PreprocessAlterDatabaseStmt(Node *node, const char *queryString,
|
|||
return NIL;
|
||||
}
|
||||
|
||||
EnsureCoordinator();
|
||||
|
||||
EnsurePropagationToCoordinator();
|
||||
EnsureAllObjectDependenciesExistOnAllNodes(list_make1(dbAddress));
|
||||
SerializeDistributedDDLsOnObjectClassObject(OCLASS_DATABASE, stmt->dbname);
|
||||
|
||||
char *sql = DeparseTreeNode((Node *) stmt);
|
||||
|
|
@ -305,12 +307,12 @@ PreprocessAlterDatabaseStmt(Node *node, const char *queryString,
|
|||
* the transaction block.
|
||||
*/
|
||||
bool warnForPartialFailure = true;
|
||||
return NontransactionalNodeDDLTaskList(NON_COORDINATOR_NODES, commands,
|
||||
return NontransactionalNodeDDLTaskList(REMOTE_NODES, commands,
|
||||
warnForPartialFailure);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
|
||||
return NodeDDLTaskList(REMOTE_NODES, commands);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -339,7 +341,9 @@ PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *queryString,
|
|||
return NIL;
|
||||
}
|
||||
|
||||
EnsureCoordinator();
|
||||
EnsurePropagationToCoordinator();
|
||||
EnsureAllObjectDependenciesExistOnAllNodes(list_make1(dbAddress));
|
||||
|
||||
SerializeDistributedDDLsOnObjectClassObject(OCLASS_DATABASE, stmt->dbname);
|
||||
|
||||
char *sql = DeparseTreeNode((Node *) stmt);
|
||||
|
|
@ -348,7 +352,7 @@ PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *queryString,
|
|||
(void *) sql,
|
||||
ENABLE_DDL_PROPAGATION);
|
||||
|
||||
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
|
||||
return NodeDDLTaskList(REMOTE_NODES, commands);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -378,7 +382,8 @@ PreprocessAlterDatabaseRenameStmt(Node *node, const char *queryString,
|
|||
return NIL;
|
||||
}
|
||||
|
||||
EnsureCoordinator();
|
||||
EnsurePropagationToCoordinator();
|
||||
EnsureAllObjectDependenciesExistOnAllNodes(list_make1(dbAddress));
|
||||
|
||||
/*
|
||||
* Different than other ALTER DATABASE commands, we first acquire a lock
|
||||
|
|
@ -412,7 +417,8 @@ PostprocessAlterDatabaseRenameStmt(Node *node, const char *queryString)
|
|||
return NIL;
|
||||
}
|
||||
|
||||
EnsureCoordinator();
|
||||
EnsurePropagationToCoordinator();
|
||||
EnsureAllObjectDependenciesExistOnAllNodes(list_make1(dbAddress));
|
||||
|
||||
char *sql = DeparseTreeNode((Node *) stmt);
|
||||
|
||||
|
|
@ -420,7 +426,7 @@ PostprocessAlterDatabaseRenameStmt(Node *node, const char *queryString)
|
|||
(void *) sql,
|
||||
ENABLE_DDL_PROPAGATION);
|
||||
|
||||
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
|
||||
return NodeDDLTaskList(REMOTE_NODES, commands);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -448,7 +454,8 @@ PreprocessAlterDatabaseSetStmt(Node *node, const char *queryString,
|
|||
return NIL;
|
||||
}
|
||||
|
||||
EnsureCoordinator();
|
||||
EnsurePropagationToCoordinator();
|
||||
EnsureAllObjectDependenciesExistOnAllNodes(list_make1(dbAddress));
|
||||
SerializeDistributedDDLsOnObjectClassObject(OCLASS_DATABASE, stmt->dbname);
|
||||
|
||||
char *sql = DeparseTreeNode((Node *) stmt);
|
||||
|
|
@ -457,7 +464,7 @@ PreprocessAlterDatabaseSetStmt(Node *node, const char *queryString,
|
|||
(void *) sql,
|
||||
ENABLE_DDL_PROPAGATION);
|
||||
|
||||
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
|
||||
return NodeDDLTaskList(REMOTE_NODES, commands);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -678,6 +685,44 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
|
|||
}
|
||||
|
||||
|
||||
List *
|
||||
PreprocessAlterDatabaseOwnerStmt(Node *node, const char *queryString,
|
||||
ProcessUtilityContext processUtilityContext)
|
||||
{
|
||||
if (!EnableAlterDatabaseOwner)
|
||||
{
|
||||
return NIL;
|
||||
}
|
||||
|
||||
List *addresses = GetObjectAddressListFromParseTree(node, false, false);
|
||||
|
||||
/* the code-path only supports a single object */
|
||||
Assert(list_length(addresses) == 1);
|
||||
|
||||
if (!ShouldPropagateAnyObject(addresses))
|
||||
{
|
||||
return NIL;
|
||||
}
|
||||
|
||||
EnsurePropagationToCoordinator();
|
||||
|
||||
AlterOwnerStmt *stmt = (AlterOwnerStmt *) node;
|
||||
char *databaseName = strVal((String *) stmt->object);
|
||||
SerializeDistributedDDLsOnObjectClassObject(OCLASS_DATABASE, databaseName);
|
||||
|
||||
EnsureSequentialMode(stmt->objectType);
|
||||
QualifyTreeNode(node);
|
||||
|
||||
const char *sql = DeparseTreeNode((Node *) node);
|
||||
|
||||
List *commands = list_make3(DISABLE_DDL_PROPAGATION,
|
||||
(void *) sql,
|
||||
ENABLE_DDL_PROPAGATION);
|
||||
|
||||
return NodeDDLTaskList(REMOTE_NODES, commands);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DropDatabaseStmtObjectAddress gets the ObjectAddress of the database that is the
|
||||
* object of the DropdbStmt.
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ static DistributeObjectOps Collation_Rename = {
|
|||
static DistributeObjectOps Database_AlterOwner = {
|
||||
.deparse = DeparseAlterDatabaseOwnerStmt,
|
||||
.qualify = NULL,
|
||||
.preprocess = PreprocessAlterDistributedObjectStmt,
|
||||
.preprocess = PreprocessAlterDatabaseOwnerStmt,
|
||||
.postprocess = PostprocessAlterDistributedObjectStmt,
|
||||
.objectType = OBJECT_DATABASE,
|
||||
.operationType = DIST_OPS_ALTER,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "utils/builtins.h"
|
||||
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
|
|
@ -61,7 +62,7 @@
|
|||
*/
|
||||
typedef struct NonMainDbDistributeObjectOps
|
||||
{
|
||||
bool cannotBeExecutedInTransaction;
|
||||
bool (*cannotBeExecutedInTransaction)(Node *parsetree);
|
||||
bool (*checkSupportedObjectType)(Node *parsetree);
|
||||
} NonMainDbDistributeObjectOps;
|
||||
|
||||
|
|
@ -73,41 +74,72 @@ static bool CreateDbStmtCheckSupportedObjectType(Node *node);
|
|||
static bool DropDbStmtCheckSupportedObjectType(Node *node);
|
||||
static bool GrantStmtCheckSupportedObjectType(Node *node);
|
||||
static bool SecLabelStmtCheckSupportedObjectType(Node *node);
|
||||
static bool AlterDbRenameCheckSupportedObjectType(Node *node);
|
||||
static bool AlterDbOwnerCheckSupportedObjectType(Node *node);
|
||||
|
||||
/*
|
||||
* cannotBeExecutedInTransaction callbacks for OperationArray.
|
||||
*/
|
||||
static bool CannotBeExecutedInTransaction_True(Node *node);
|
||||
static bool CannotBeExecutedInTransaction_False(Node *node);
|
||||
static bool AlterDbCannotBeExecutedInTransaction(Node *node);
|
||||
|
||||
/*
|
||||
* OperationArray that holds NonMainDbDistributeObjectOps for different command types.
|
||||
*/
|
||||
static const NonMainDbDistributeObjectOps *const OperationArray[] = {
|
||||
[T_CreateRoleStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = false,
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = NULL
|
||||
},
|
||||
[T_DropRoleStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = false,
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = NULL
|
||||
},
|
||||
[T_AlterRoleStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = false,
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = NULL
|
||||
},
|
||||
[T_GrantRoleStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = false,
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = NULL
|
||||
},
|
||||
[T_CreatedbStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = true,
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_True,
|
||||
.checkSupportedObjectType = CreateDbStmtCheckSupportedObjectType
|
||||
},
|
||||
[T_DropdbStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = true,
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_True,
|
||||
.checkSupportedObjectType = DropDbStmtCheckSupportedObjectType
|
||||
},
|
||||
[T_AlterDatabaseSetStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = NULL
|
||||
},
|
||||
[T_AlterDatabaseStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = AlterDbCannotBeExecutedInTransaction,
|
||||
.checkSupportedObjectType = NULL
|
||||
},
|
||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||
[T_AlterDatabaseRefreshCollStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = NULL
|
||||
},
|
||||
#endif
|
||||
[T_RenameStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = AlterDbRenameCheckSupportedObjectType
|
||||
},
|
||||
[T_AlterOwnerStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = AlterDbOwnerCheckSupportedObjectType
|
||||
},
|
||||
[T_GrantStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = false,
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = GrantStmtCheckSupportedObjectType
|
||||
},
|
||||
[T_SecLabelStmt] = &(NonMainDbDistributeObjectOps) {
|
||||
.cannotBeExecutedInTransaction = false,
|
||||
.cannotBeExecutedInTransaction = CannotBeExecutedInTransaction_False,
|
||||
.checkSupportedObjectType = SecLabelStmtCheckSupportedObjectType
|
||||
},
|
||||
};
|
||||
|
|
@ -132,7 +164,7 @@ static void UnmarkObjectDistributedOnLocalMainDb(uint16 catalogRelId, Oid object
|
|||
bool
|
||||
RunPreprocessNonMainDBCommand(Node *parsetree)
|
||||
{
|
||||
if (IsMainDB)
|
||||
if (IsMainDB || !EnableDDLPropagation)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -150,7 +182,7 @@ RunPreprocessNonMainDBCommand(Node *parsetree)
|
|||
* transactional visibility issues. We directly route them to main database
|
||||
* so that we only have to consider one code-path for such commands.
|
||||
*/
|
||||
if (ops->cannotBeExecutedInTransaction)
|
||||
if (ops->cannotBeExecutedInTransaction(parsetree))
|
||||
{
|
||||
IsMainDBCommandInXact = false;
|
||||
RunCitusMainDBQuery((char *) queryString);
|
||||
|
|
@ -188,7 +220,7 @@ RunPreprocessNonMainDBCommand(Node *parsetree)
|
|||
void
|
||||
RunPostprocessNonMainDBCommand(Node *parsetree)
|
||||
{
|
||||
if (IsMainDB || !GetNonMainDbDistributeObjectOps(parsetree))
|
||||
if (IsMainDB || !EnableDDLPropagation || !GetNonMainDbDistributeObjectOps(parsetree))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -335,6 +367,22 @@ DropDbStmtCheckSupportedObjectType(Node *node)
|
|||
}
|
||||
|
||||
|
||||
static bool
|
||||
AlterDbRenameCheckSupportedObjectType(Node *node)
|
||||
{
|
||||
RenameStmt *stmt = castNode(RenameStmt, node);
|
||||
return stmt->renameType == OBJECT_DATABASE;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
AlterDbOwnerCheckSupportedObjectType(Node *node)
|
||||
{
|
||||
AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node);
|
||||
return stmt->objectType == OBJECT_DATABASE;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
GrantStmtCheckSupportedObjectType(Node *node)
|
||||
{
|
||||
|
|
@ -349,3 +397,28 @@ SecLabelStmtCheckSupportedObjectType(Node *node)
|
|||
SecLabelStmt *stmt = castNode(SecLabelStmt, node);
|
||||
return stmt->objtype == OBJECT_ROLE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* cannotBeExecutedInTransaction callbacks for OperationArray lie below.
|
||||
*/
|
||||
static bool
|
||||
CannotBeExecutedInTransaction_True(Node *node)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
CannotBeExecutedInTransaction_False(Node *node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
AlterDbCannotBeExecutedInTransaction(Node *node)
|
||||
{
|
||||
AlterDatabaseStmt *stmt = castNode(AlterDatabaseStmt, node);
|
||||
return IsSetTablespaceStatement(stmt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,6 +234,8 @@ extern List * PreprocessAlterDatabaseStmt(Node *node, const char *queryString,
|
|||
extern List * PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *queryString,
|
||||
ProcessUtilityContext
|
||||
processUtilityContext);
|
||||
extern List * PreprocessAlterDatabaseOwnerStmt(Node *node, const char *queryString,
|
||||
ProcessUtilityContext processUtilityContext);
|
||||
extern List * GetDatabaseMetadataSyncCommands(Oid dbOid);
|
||||
|
||||
|
||||
|
|
@ -256,6 +258,7 @@ extern List * PreprocessAlterDatabaseRenameStmt(Node *node, const char *queryStr
|
|||
extern List * PostprocessAlterDatabaseRenameStmt(Node *node, const char *queryString);
|
||||
extern void EnsureSupportedCreateDatabaseCommand(CreatedbStmt *stmt);
|
||||
extern char * CreateDatabaseDDLCommand(Oid dbId);
|
||||
extern bool IsSetTablespaceStatement(AlterDatabaseStmt *stmt);
|
||||
|
||||
|
||||
/* domain.c - forward declarations */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# ----------
|
||||
# isolation setup steps
|
||||
# ----------
|
||||
test: isolation_enable_ddl_propagation
|
||||
test: isolation_setup
|
||||
test: isolation_cluster_management
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# ----------
|
||||
# Only run few basic tests to set up a testing environment
|
||||
# ----------
|
||||
test: enable_ddl_propagation
|
||||
test: multi_test_helpers multi_test_helpers_superuser multi_create_fdw columnar_test_helpers failure_test_helpers
|
||||
test: multi_cluster_management
|
||||
test: multi_test_catalog_views
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@ DEPS = {
|
|||
],
|
||||
repeatable=False,
|
||||
),
|
||||
"multi_follower_sanity_check": TestDeps("multi_follower_schedule"),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -324,6 +325,8 @@ def run_schedule_with_multiregress(test_name, schedule, dependencies, args):
|
|||
"failure"
|
||||
):
|
||||
make_recipe = "check-failure-custom-schedule"
|
||||
elif dependencies.schedule == "multi_follower_schedule":
|
||||
make_recipe = "check-follower-cluster"
|
||||
else:
|
||||
make_recipe = "check-custom-schedule"
|
||||
|
||||
|
|
@ -360,6 +363,9 @@ def default_base_schedule(test_schedule, args):
|
|||
if "operations" in test_schedule:
|
||||
return "minimal_schedule"
|
||||
|
||||
if "follower" in test_schedule:
|
||||
return "multi_follower_schedule"
|
||||
|
||||
if "pg_upgrade" in test_schedule:
|
||||
return "minimal_pg_upgrade_schedule"
|
||||
|
||||
|
|
@ -416,7 +422,26 @@ def find_test_schedule_and_line(test_name, args):
|
|||
|
||||
def test_dependencies(test_name, test_schedule, schedule_line, args):
|
||||
if test_name in DEPS:
|
||||
return DEPS[test_name]
|
||||
# Since enable_ddl_propagation is a must to execute tests,
|
||||
# below block adds enable_ddl_propagation as a dependency
|
||||
# as the first element of extra tests if schedule is not
|
||||
# configured. We don't do so if the schedule is confugured
|
||||
# because all base schedules include enable_ddl_propagation
|
||||
# anyway.
|
||||
test_deps = DEPS[test_name]
|
||||
ddl_propagation_test = (
|
||||
"isolation_enable_ddl_propagation"
|
||||
if test_name.startswith("isolation")
|
||||
else "enable_ddl_propagation"
|
||||
)
|
||||
|
||||
if test_deps is not None and test_deps.schedule is None:
|
||||
test_deps.direct_extra_tests = [
|
||||
ddl_propagation_test
|
||||
] + test_deps.direct_extra_tests
|
||||
return test_deps
|
||||
else:
|
||||
return DEPS[test_name]
|
||||
|
||||
if "citus_upgrade" in test_schedule:
|
||||
return TestDeps(None, citus_upgrade_infra=True)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: enable_ddl_propagation
|
||||
test: multi_test_helpers multi_test_helpers_superuser columnar_test_helpers
|
||||
test: multi_cluster_management
|
||||
test: multi_test_catalog_views
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: isolation_enable_ddl_propagation
|
||||
test: isolation_setup
|
||||
|
||||
# tests that change node metadata should precede
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: isolation_enable_ddl_propagation
|
||||
test: isolation_setup
|
||||
|
||||
# tests that change node metadata should precede
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: isolation_enable_ddl_propagation
|
||||
test: isolation_setup
|
||||
|
||||
# tests that change node metadata should precede
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: isolation_enable_ddl_propagation
|
||||
test: isolation_setup
|
||||
|
||||
# tests that change node metadata should precede
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: enable_ddl_propagation
|
||||
test: single_node_enterprise
|
||||
test: multi_test_helpers multi_test_helpers_superuser
|
||||
test: multi_cluster_management
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# should come before multi_cluster_management
|
||||
# as it touches node metadata
|
||||
test: enable_ddl_propagation
|
||||
test: single_node_enterprise
|
||||
|
||||
test: multi_test_helpers multi_test_helpers_superuser
|
||||
|
|
|
|||
|
|
@ -0,0 +1,607 @@
|
|||
SET citus.superuser TO 'postgres';
|
||||
set citus.enable_create_database_propagation=on;
|
||||
create database test_alter_db_from_nonmain_db;
|
||||
create database "altered_database!'2";
|
||||
reset citus.enable_create_database_propagation;
|
||||
\c regression;
|
||||
set citus.enable_create_database_propagation=on;
|
||||
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts3'
|
||||
CREATE TABLESPACE "ts-needs\!escape2" LOCATION :'alter_db_tablespace';
|
||||
\c - - - :worker_1_port
|
||||
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts4'
|
||||
CREATE TABLESPACE "ts-needs\!escape2" LOCATION :'alter_db_tablespace';
|
||||
\c - - - :worker_2_port
|
||||
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts5'
|
||||
CREATE TABLESPACE "ts-needs\!escape2" LOCATION :'alter_db_tablespace';
|
||||
-- Below tests test the ALTER DATABASE command from main and non-main databases
|
||||
-- The tests are run on the master and worker nodes to ensure that the command is
|
||||
-- executed on all nodes.
|
||||
\c test_alter_db_from_nonmain_db
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "pg_default", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "pg_default", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "pg_default", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
-- In the below tests, we test the ALTER DATABASE ..set tablespace command
|
||||
-- repeatedly to ensure that the command does not stuck when executed multiple times
|
||||
\c regression - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression - - :master_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "pg_default", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "pg_default", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "pg_default", "daticurules": null, "datallowconn": true, "datconnlimit": -1, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE pg_default
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET TABLESPACE "ts-needs\!escape2"
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c test_alter_db_from_nonmain_db - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" rename to altered_database_renamed;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" RENAME TO altered_database_renamed', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database altered_database_renamed rename to "altered_database!'2";
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE altered_database_renamed RENAME TO "altered_database!''2"', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" with
|
||||
ALLOW_CONNECTIONS true
|
||||
CONNECTION LIMIT 0
|
||||
IS_TEMPLATE false;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" WITH ALLOW_CONNECTIONS true CONNECTION LIMIT 0 IS_TEMPLATE false;', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
\c regression - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" with
|
||||
ALLOW_CONNECTIONS false
|
||||
CONNECTION LIMIT 1
|
||||
IS_TEMPLATE true;
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" WITH ALLOW_CONNECTIONS false CONNECTION LIMIT 1 IS_TEMPLATE true;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" WITH ALLOW_CONNECTIONS false CONNECTION LIMIT 1 IS_TEMPLATE true;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": false, "datconnlimit": 1, "daticulocale": null, "datistemplate": true, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": false, "datconnlimit": 1, "daticulocale": null, "datistemplate": true, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": false, "datconnlimit": 1, "daticulocale": null, "datistemplate": true, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
\c regression - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" with
|
||||
ALLOW_CONNECTIONS true
|
||||
CONNECTION LIMIT 0
|
||||
IS_TEMPLATE false;
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" WITH ALLOW_CONNECTIONS true CONNECTION LIMIT 0 IS_TEMPLATE false;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" WITH ALLOW_CONNECTIONS true CONNECTION LIMIT 0 IS_TEMPLATE false;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression
|
||||
create role test_owner_non_main_db;
|
||||
\c test_alter_db_from_nonmain_db
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
set citus.enable_create_database_propagation=on;
|
||||
alter database "altered_database!'2" owner to test_owner_non_main_db;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" OWNER TO test_owner_non_main_db;', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "test_owner_non_main_db", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "test_owner_non_main_db", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "test_owner_non_main_db", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" owner to CURRENT_USER;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" OWNER TO postgres;', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
set default_transaction_read_only = false;
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
\c regression - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" owner to test_owner_non_main_db;
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" OWNER TO test_owner_non_main_db;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" OWNER TO test_owner_non_main_db;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
set default_transaction_read_only = false;
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "test_owner_non_main_db", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "test_owner_non_main_db", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "test_owner_non_main_db", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
\c regression - - :master_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" owner to CURRENT_USER;
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" OWNER TO postgres;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" OWNER TO postgres;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
set default_transaction_read_only = false;
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
set citus.enable_alter_database_owner to off;
|
||||
alter database "altered_database!'2" owner to test_owner_non_main_db;
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "test_owner_non_main_db", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
alter database "altered_database!'2" owner to CURRENT_USER;
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
node_type | result
|
||||
---------------------------------------------------------------------
|
||||
coordinator (local) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
worker node (remote) | {"database_properties": {"datacl": null, "datname": "altered_database!'2", "datctype": "C", "encoding": "UTF8", "datcollate": "C", "tablespace": "ts-needs\\!escape2", "daticurules": null, "datallowconn": true, "datconnlimit": 0, "daticulocale": null, "datistemplate": false, "database_owner": "postgres", "datcollversion": null, "datlocprovider": "c"}, "pg_dist_object_record_for_db_exists": true, "stale_pg_dist_object_record_for_a_db_exists": false}
|
||||
(3 rows)
|
||||
|
||||
reset citus.enable_alter_database_owner;
|
||||
\c test_alter_db_from_nonmain_db
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set default_transaction_read_only to true;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" SET default_transaction_read_only = ''true''', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
default_transaction_read_only | on
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
default_transaction_read_only | on
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
default_transaction_read_only | on
|
||||
(1 row)
|
||||
|
||||
\c test_alter_db_from_nonmain_db
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" reset default_transaction_read_only;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" RESET default_transaction_read_only', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
default_transaction_read_only | off
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
default_transaction_read_only | off
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
default_transaction_read_only | off
|
||||
(1 row)
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set log_duration from current;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" SET log_duration FROM CURRENT', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set log_duration to DEFAULT;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" SET log_duration TO DEFAULT', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" set log_duration = true;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" SET log_duration = ''true''', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
log_duration | on
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
log_duration | on
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
log_duration | on
|
||||
(1 row)
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" RESET log_duration;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" RESET log_duration', 'postgres')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
log_duration | off
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
log_duration | off
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
log_duration | off
|
||||
(1 row)
|
||||
|
||||
\c regression - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set statement_timeout = 1000;
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET statement_timeout = 1000
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET statement_timeout = 1000
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
statement_timeout | 1000
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
statement_timeout | 1000
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
statement_timeout | 1000
|
||||
(1 row)
|
||||
|
||||
\c regression - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set statement_timeout to DEFAULT;
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET statement_timeout TO DEFAULT
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" SET statement_timeout TO DEFAULT
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
alter database "altered_database!'2" RESET statement_timeout;
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" RESET statement_timeout
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing ALTER DATABASE "altered_database!'2" RESET statement_timeout
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
statement_timeout | 0
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
statement_timeout | 0
|
||||
(1 row)
|
||||
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
name | setting
|
||||
---------------------------------------------------------------------
|
||||
statement_timeout | 0
|
||||
(1 row)
|
||||
|
||||
\c regression
|
||||
set citus.enable_create_database_propagation=on;
|
||||
drop database "altered_database!'2";
|
||||
drop database test_alter_db_from_nonmain_db;
|
||||
reset citus.enable_create_database_propagation;
|
||||
drop role test_owner_non_main_db;
|
||||
SELECT result FROM run_command_on_all_nodes(
|
||||
$$
|
||||
drop tablespace "ts-needs\!escape2"
|
||||
$$
|
||||
);
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
DROP TABLESPACE
|
||||
DROP TABLESPACE
|
||||
DROP TABLESPACE
|
||||
(3 rows)
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
(3 rows)
|
||||
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
t
|
||||
t
|
||||
(3 rows)
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
ALTER SYSTEM
|
||||
(1 row)
|
||||
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
|
|
@ -17,3 +17,19 @@ SELECT master_add_node('localhost', :worker_2_proxy_port); -- an mitmproxy whic
|
|||
2
|
||||
(1 row)
|
||||
|
||||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
(3 rows)
|
||||
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
t
|
||||
t
|
||||
(3 rows)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
ALTER SYSTEM SET citus.distributed_deadlock_detection_factor TO -1;
|
||||
ALTER SYSTEM SET citus.recover_2pc_interval TO -1;
|
||||
ALTER SYSTEM set citus.enable_statistics_collection TO false;
|
||||
ALTER SYSTEM SET citus.enable_ddl_propagation = 'true';
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
---------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ starting permutation: s1a
|
|||
step s1a:
|
||||
SELECT 1 FROM master_add_node('localhost', 57637);
|
||||
SELECT 1 FROM master_add_node('localhost', 57638);
|
||||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
|
||||
?column?
|
||||
---------------------------------------------------------------------
|
||||
|
|
@ -15,3 +17,17 @@ step s1a:
|
|||
1
|
||||
(1 row)
|
||||
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
(3 rows)
|
||||
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
t
|
||||
t
|
||||
(3 rows)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
Parsed test spec with 1 sessions
|
||||
|
||||
starting permutation: s1a
|
||||
all_ok
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
step s1a:
|
||||
SELECT 1;
|
||||
|
||||
?column?
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Parsed test spec with 1 sessions
|
||||
|
||||
starting permutation: s1-begin s1-commit
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
|
|
@ -69,3 +69,20 @@ DROP TABLE test_dist;
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_node_nodeid_seq RESTART 30;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_groupid_seq RESTART 18;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_placement_placementid_seq RESTART 83;
|
||||
-- enable ddl propagation in all nodes
|
||||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
(3 rows)
|
||||
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
t
|
||||
t
|
||||
(3 rows)
|
||||
|
||||
|
|
|
|||
|
|
@ -1288,3 +1288,20 @@ SELECT bool_and(hasmetadata) AND bool_and(metadatasynced) FROM pg_dist_node WHER
|
|||
-- keep permissions compatible accross versions, in regression
|
||||
-- tests.
|
||||
GRANT ALL ON SCHEMA public TO PUBLIC;
|
||||
-- enable ddl propagation in all nodes
|
||||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
ALTER SYSTEM
|
||||
(3 rows)
|
||||
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
result
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
t
|
||||
t
|
||||
(3 rows)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,28 @@
|
|||
-- check that the nodes are all in read-only mode and rejecting write queries
|
||||
\c - - - :follower_master_port
|
||||
ALTER SYSTEM SET citus.enable_ddl_propagation = 'true';
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
\c - - - :follower_worker_1_port
|
||||
ALTER SYSTEM SET citus.enable_ddl_propagation = 'true';
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
\c - - - :follower_worker_2_port
|
||||
ALTER SYSTEM SET citus.enable_ddl_propagation = 'true';
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
\c - - - :follower_master_port
|
||||
CREATE TABLE tab (a int);
|
||||
ERROR: cannot execute CREATE TABLE in a read-only transaction
|
||||
|
|
|
|||
|
|
@ -1550,3 +1550,19 @@ SET client_min_messages TO ERROR;
|
|||
DROP SCHEMA pg15 CASCADE;
|
||||
DROP ROLE rls_tenant_1;
|
||||
DROP ROLE rls_tenant_2;
|
||||
-- test refresh collation version on non-main databases
|
||||
SET citus.enable_create_database_propagation TO on;
|
||||
create database alter_db_from_nonmain_db_pg15;
|
||||
\c alter_db_from_nonmain_db_pg15
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = '%ALTER DATABASE%';
|
||||
ALTER DATABASE alter_db_from_nonmain_db_pg15 REFRESH COLLATION VERSION;
|
||||
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE alter_db_from_nonmain_db_pg15 REFRESH COLLATION VERSION;', 'postgres')
|
||||
NOTICE: version has not changed
|
||||
reset citus.log_remote_commands;
|
||||
reset citus.grep_remote_commands;
|
||||
\c regression
|
||||
SET citus.enable_create_database_propagation TO on;
|
||||
drop database alter_db_from_nonmain_db_pg15;
|
||||
reset citus.enable_create_database_propagation;
|
||||
SET citus.enable_create_database_propagation TO OFF;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# import this file (from psql you can use \i) to use mitmproxy manually
|
||||
test: enable_ddl_propagation
|
||||
test: failure_test_helpers
|
||||
|
||||
# this should only be run by pg_regress_multi, you don't need it
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# import this file (from psql you can use \i) to use mitmproxy manually
|
||||
test: enable_ddl_propagation
|
||||
test: failure_test_helpers
|
||||
|
||||
# this should only be run by pg_regress_multi, you don't need it
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: isolation_enable_ddl_propagation
|
||||
test: isolation_setup
|
||||
test: isolation_add_remove_node
|
||||
test: isolation_update_node
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
test: enable_ddl_propagation
|
||||
test: minimal_cluster_management
|
||||
test: multi_test_helpers multi_test_helpers_superuser multi_create_fdw columnar_test_helpers multi_test_catalog_views tablespace
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# ---
|
||||
# Tests around schema changes, these are run first, so there's no preexisting objects.
|
||||
# ---
|
||||
test: enable_ddl_propagation
|
||||
test: multi_extension
|
||||
test: multi_test_helpers multi_test_helpers_superuser multi_create_fdw
|
||||
test: single_node
|
||||
|
|
@ -69,6 +70,7 @@ test: alter_database_propagation
|
|||
|
||||
test: citus_shards
|
||||
test: reassign_owned
|
||||
test: alter_database_from_nonmain_db
|
||||
|
||||
# ----------
|
||||
# multi_citus_tools tests utility functions written for citus tools
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: enable_ddl_propagation
|
||||
test: multi_follower_sanity_check
|
||||
test: follower_single_node
|
||||
test: multi_follower_select_statements
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
# ---
|
||||
# Tests around schema changes, these are run first, so there's no preexisting objects.
|
||||
# ---
|
||||
test: enable_ddl_propagation
|
||||
test: multi_extension
|
||||
test: multi_test_helpers multi_test_helpers_superuser
|
||||
test: multi_mx_node_metadata
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: enable_ddl_propagation
|
||||
test: multi_test_helpers multi_test_helpers_superuser
|
||||
test: multi_cluster_management
|
||||
test: create_role_propagation
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# ----------
|
||||
# Only run few basic tests to set up a testing environment
|
||||
# ----------
|
||||
test: enable_ddl_propagation
|
||||
test: multi_test_helpers multi_test_helpers_superuser
|
||||
test: multi_cluster_management
|
||||
test: multi_mx_function_table_reference
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
test: enable_ddl_propagation
|
||||
test: multi_test_helpers multi_test_helpers_superuser
|
||||
test: multi_cluster_management
|
||||
test: multi_test_catalog_views
|
||||
|
|
|
|||
|
|
@ -494,6 +494,7 @@ push(@pgOptions, "citus.stat_tenants_limit = 2");
|
|||
push(@pgOptions, "citus.stat_tenants_track = 'ALL'");
|
||||
push(@pgOptions, "citus.enable_stat_counters=on");
|
||||
push(@pgOptions, "citus.superuser = 'postgres'");
|
||||
push(@pgOptions, "citus.enable_ddl_propagation=false");
|
||||
|
||||
# Some tests look at shards in pg_class, make sure we can usually see them:
|
||||
push(@pgOptions, "citus.show_shards_for_app_name_prefixes='pg_regress'");
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ step "s1a"
|
|||
{
|
||||
SELECT 1 FROM master_add_node('localhost', 57637);
|
||||
SELECT 1 FROM master_add_node('localhost', 57638);
|
||||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
}
|
||||
|
||||
permutation "s1a"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
// The code we care about is in the setup stage, because it needs to be executed outside of a transaction.
|
||||
// For the setup stage to be executed we need at least one permutation though.
|
||||
// Therefore, we added s1a as a non-functional step, just make the setup step to work.
|
||||
setup
|
||||
{
|
||||
SELECT bool_and(result='ALTER SYSTEM') AS all_ok FROM run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
SELECT bool_and(result='t') AS all_ok FROM run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
}
|
||||
|
||||
session "s1"
|
||||
step "s1a"
|
||||
{
|
||||
SELECT 1;
|
||||
}
|
||||
|
||||
permutation "s1a"
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
# Split Shard tests.
|
||||
# Include tests from 'minimal_schedule' for setup.
|
||||
test: enable_ddl_propagation
|
||||
test: multi_test_helpers multi_test_helpers_superuser columnar_test_helpers
|
||||
test: multi_cluster_management
|
||||
test: remove_coordinator_from_metadata
|
||||
|
|
|
|||
|
|
@ -0,0 +1,288 @@
|
|||
SET citus.superuser TO 'postgres';
|
||||
set citus.enable_create_database_propagation=on;
|
||||
create database test_alter_db_from_nonmain_db;
|
||||
create database "altered_database!'2";
|
||||
reset citus.enable_create_database_propagation;
|
||||
\c regression;
|
||||
set citus.enable_create_database_propagation=on;
|
||||
|
||||
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts3'
|
||||
CREATE TABLESPACE "ts-needs\!escape2" LOCATION :'alter_db_tablespace';
|
||||
|
||||
\c - - - :worker_1_port
|
||||
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts4'
|
||||
CREATE TABLESPACE "ts-needs\!escape2" LOCATION :'alter_db_tablespace';
|
||||
|
||||
\c - - - :worker_2_port
|
||||
\set alter_db_tablespace :abs_srcdir '/tmp_check/ts5'
|
||||
CREATE TABLESPACE "ts-needs\!escape2" LOCATION :'alter_db_tablespace';
|
||||
|
||||
-- Below tests test the ALTER DATABASE command from main and non-main databases
|
||||
-- The tests are run on the master and worker nodes to ensure that the command is
|
||||
-- executed on all nodes.
|
||||
|
||||
\c test_alter_db_from_nonmain_db
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
\c test_alter_db_from_nonmain_db - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
|
||||
-- In the below tests, we test the ALTER DATABASE ..set tablespace command
|
||||
-- repeatedly to ensure that the command does not stuck when executed multiple times
|
||||
|
||||
\c regression - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
|
||||
\c regression - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
|
||||
\c regression - - :master_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
alter database "altered_database!'2" set tablespace "pg_default";
|
||||
alter database "altered_database!'2" set tablespace "ts-needs\!escape2";
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" rename to altered_database_renamed;
|
||||
alter database altered_database_renamed rename to "altered_database!'2";
|
||||
|
||||
alter database "altered_database!'2" with
|
||||
ALLOW_CONNECTIONS true
|
||||
CONNECTION LIMIT 0
|
||||
IS_TEMPLATE false;
|
||||
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
|
||||
\c regression - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
|
||||
alter database "altered_database!'2" with
|
||||
ALLOW_CONNECTIONS false
|
||||
CONNECTION LIMIT 1
|
||||
IS_TEMPLATE true;
|
||||
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
|
||||
\c regression - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" with
|
||||
ALLOW_CONNECTIONS true
|
||||
CONNECTION LIMIT 0
|
||||
IS_TEMPLATE false;
|
||||
|
||||
\c regression
|
||||
create role test_owner_non_main_db;
|
||||
|
||||
\c test_alter_db_from_nonmain_db
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
set citus.enable_create_database_propagation=on;
|
||||
alter database "altered_database!'2" owner to test_owner_non_main_db;
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" owner to CURRENT_USER;
|
||||
set default_transaction_read_only = false;
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
|
||||
\c regression - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" owner to test_owner_non_main_db;
|
||||
set default_transaction_read_only = false;
|
||||
\c regression - - :master_port
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
|
||||
\c regression - - :master_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" owner to CURRENT_USER;
|
||||
set default_transaction_read_only = false;
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
|
||||
set citus.enable_alter_database_owner to off;
|
||||
alter database "altered_database!'2" owner to test_owner_non_main_db;
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
alter database "altered_database!'2" owner to CURRENT_USER;
|
||||
SELECT * FROM public.check_database_on_all_nodes($$altered_database!''2$$) ORDER BY node_type;
|
||||
reset citus.enable_alter_database_owner;
|
||||
|
||||
\c test_alter_db_from_nonmain_db
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
|
||||
alter database "altered_database!'2" set default_transaction_read_only to true;
|
||||
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
|
||||
\c test_alter_db_from_nonmain_db
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" reset default_transaction_read_only;
|
||||
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='default_transaction_read_only';
|
||||
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set log_duration from current;
|
||||
alter database "altered_database!'2" set log_duration to DEFAULT;
|
||||
alter database "altered_database!'2" set log_duration = true;
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
|
||||
\c test_alter_db_from_nonmain_db - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" RESET log_duration;
|
||||
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='log_duration';
|
||||
|
||||
\c regression - - :worker_2_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set statement_timeout = 1000;
|
||||
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
|
||||
\c regression - - :worker_1_port
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = "%ALTER DATABASE%";
|
||||
alter database "altered_database!'2" set statement_timeout to DEFAULT;
|
||||
alter database "altered_database!'2" RESET statement_timeout;
|
||||
|
||||
\c "altered_database!'2" - - :master_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
\c "altered_database!'2" - - :worker_1_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
\c "altered_database!'2" - - :worker_2_port
|
||||
select name,setting from pg_settings
|
||||
where name ='statement_timeout';
|
||||
|
||||
\c regression
|
||||
set citus.enable_create_database_propagation=on;
|
||||
drop database "altered_database!'2";
|
||||
drop database test_alter_db_from_nonmain_db;
|
||||
reset citus.enable_create_database_propagation;
|
||||
|
||||
drop role test_owner_non_main_db;
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes(
|
||||
$$
|
||||
drop tablespace "ts-needs\!escape2"
|
||||
$$
|
||||
);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
|
|
@ -3,3 +3,6 @@ SELECT citus.mitmproxy('conn.allow()');
|
|||
-- add the workers
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
SELECT master_add_node('localhost', :worker_2_proxy_port); -- an mitmproxy which forwards to the second worker
|
||||
|
||||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
ALTER SYSTEM SET citus.distributed_deadlock_detection_factor TO -1;
|
||||
ALTER SYSTEM SET citus.recover_2pc_interval TO -1;
|
||||
ALTER SYSTEM set citus.enable_statistics_collection TO false;
|
||||
ALTER SYSTEM SET citus.enable_ddl_propagation = 'true';
|
||||
SELECT pg_reload_conf();
|
||||
|
||||
-- Add some helper functions for sending commands to mitmproxy
|
||||
|
|
|
|||
|
|
@ -41,3 +41,6 @@ DROP TABLE test_dist;
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_node_nodeid_seq RESTART 30;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_groupid_seq RESTART 18;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_placement_placementid_seq RESTART 83;
|
||||
-- enable ddl propagation in all nodes
|
||||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
|
|
|
|||
|
|
@ -546,3 +546,6 @@ SELECT bool_and(hasmetadata) AND bool_and(metadatasynced) FROM pg_dist_node WHER
|
|||
-- keep permissions compatible accross versions, in regression
|
||||
-- tests.
|
||||
GRANT ALL ON SCHEMA public TO PUBLIC;
|
||||
-- enable ddl propagation in all nodes
|
||||
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON');
|
||||
SELECT result from run_command_on_all_nodes('SELECT pg_reload_conf()');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,16 @@
|
|||
-- check that the nodes are all in read-only mode and rejecting write queries
|
||||
\c - - - :follower_master_port
|
||||
ALTER SYSTEM SET citus.enable_ddl_propagation = 'true';
|
||||
SELECT pg_reload_conf();
|
||||
|
||||
\c - - - :follower_worker_1_port
|
||||
ALTER SYSTEM SET citus.enable_ddl_propagation = 'true';
|
||||
SELECT pg_reload_conf();
|
||||
|
||||
\c - - - :follower_worker_2_port
|
||||
ALTER SYSTEM SET citus.enable_ddl_propagation = 'true';
|
||||
SELECT pg_reload_conf();
|
||||
|
||||
|
||||
\c - - - :follower_master_port
|
||||
CREATE TABLE tab (a int);
|
||||
|
|
|
|||
|
|
@ -997,3 +997,21 @@ SET client_min_messages TO ERROR;
|
|||
DROP SCHEMA pg15 CASCADE;
|
||||
DROP ROLE rls_tenant_1;
|
||||
DROP ROLE rls_tenant_2;
|
||||
|
||||
-- test refresh collation version on non-main databases
|
||||
SET citus.enable_create_database_propagation TO on;
|
||||
create database alter_db_from_nonmain_db_pg15;
|
||||
|
||||
\c alter_db_from_nonmain_db_pg15
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = '%ALTER DATABASE%';
|
||||
ALTER DATABASE alter_db_from_nonmain_db_pg15 REFRESH COLLATION VERSION;
|
||||
|
||||
reset citus.log_remote_commands;
|
||||
reset citus.grep_remote_commands;
|
||||
|
||||
\c regression
|
||||
SET citus.enable_create_database_propagation TO on;
|
||||
drop database alter_db_from_nonmain_db_pg15;
|
||||
reset citus.enable_create_database_propagation;
|
||||
SET citus.enable_create_database_propagation TO OFF;
|
||||
|
|
|
|||
Loading…
Reference in New Issue