Fixes review comments

pull/7563/head
gurkanindibay 2024-03-28 12:49:08 +03:00
parent 24e7389d3e
commit 18e3924530
3 changed files with 18 additions and 41 deletions

View File

@ -73,7 +73,6 @@ static bool CreateDbStmtCheckSupportedObjectType(Node *node);
static bool DropDbStmtCheckSupportedObjectType(Node *node); static bool DropDbStmtCheckSupportedObjectType(Node *node);
static bool GrantStmtCheckSupportedObjectType(Node *node); static bool GrantStmtCheckSupportedObjectType(Node *node);
static bool SecLabelStmtCheckSupportedObjectType(Node *node); static bool SecLabelStmtCheckSupportedObjectType(Node *node);
static bool AlterDbStmtCheckSupportedObjectType(Node *node);
static bool AlterDbRenameCheckSupportedObjectType(Node *node); static bool AlterDbRenameCheckSupportedObjectType(Node *node);
static bool AlterDbOwnerCheckSupportedObjectType(Node *node); static bool AlterDbOwnerCheckSupportedObjectType(Node *node);
static bool CannotBeExecutedInTransaction_True(Node *node); static bool CannotBeExecutedInTransaction_True(Node *node);
@ -114,7 +113,7 @@ static const NonMainDbDistributeObjectOps *const OperationArray[] = {
}, },
[T_AlterDatabaseStmt] = &(NonMainDbDistributeObjectOps) { [T_AlterDatabaseStmt] = &(NonMainDbDistributeObjectOps) {
.cannotBeExecutedInTransaction = AlterDbCannotBeExecutedInTransaction, .cannotBeExecutedInTransaction = AlterDbCannotBeExecutedInTransaction,
.checkSupportedObjectType = AlterDbStmtCheckSupportedObjectType .checkSupportedObjectType = NULL
}, },
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
[T_AlterDatabaseRefreshCollStmt] = &(NonMainDbDistributeObjectOps) { [T_AlterDatabaseRefreshCollStmt] = &(NonMainDbDistributeObjectOps) {
@ -363,26 +362,6 @@ DropDbStmtCheckSupportedObjectType(Node *node)
} }
static bool
AlterDbStmtCheckSupportedObjectType(Node *node)
{
/*
* We don't try to send the query to the main database if the ALTER
* DATABASE command is for the main database itself, this is a very
* rare case but it's exercised by our test suite.
*/
AlterDatabaseStmt *stmt = castNode(AlterDatabaseStmt, node);
if (!IsSetTablespaceStatement(stmt))
{
return true;
}
else
{
return strcmp(stmt->dbname, MainDb) != 0;
}
}
static bool static bool
AlterDbRenameCheckSupportedObjectType(Node *node) AlterDbRenameCheckSupportedObjectType(Node *node)
{ {

View File

@ -1,16 +1,16 @@
Parsed test spec with 1 sessions Parsed test spec with 1 sessions
starting permutation: s1-begin s1-commit starting permutation: s1a
result all_ok
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
t (1 row)
t
(3 rows)
step s1-begin: step s1a:
BEGIN; SELECT 1;
step s1-commit: ?column?
COMMIT; ---------------------------------------------------------------------
1
(1 row)

View File

@ -1,18 +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 setup
{ {
SELECT result from run_command_on_all_nodes('ALTER SYSTEM SET citus.enable_ddl_propagation TO ON'); 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 result from run_command_on_all_nodes('SELECT pg_reload_conf()'); SELECT bool_and(result='t') AS all_ok FROM run_command_on_all_nodes('SELECT pg_reload_conf()');
} }
session "s1" session "s1"
step "s1-begin" step "s1a"
{ {
BEGIN; SELECT 1;
} }
step "s1-commit" permutation "s1a"
{
COMMIT;
}
permutation "s1-begin" "s1-commit"