Skip to content

Commit

Permalink
Support CREATE / DROP database commands from any node
Browse files Browse the repository at this point in the history
  • Loading branch information
onurctirtir committed Nov 21, 2023
1 parent 3b556cb commit d85b211
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/backend/distributed/commands/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ PreprocessCreateDatabaseStmt(Node *node, const char *queryString,
return NIL;
}

EnsureCoordinator();
EnsurePropagationToCoordinator();

CreatedbStmt *stmt = castNode(CreatedbStmt, node);
EnsureSupportedCreateDatabaseCommand(stmt);
Expand All @@ -327,7 +327,7 @@ PostprocessCreateDatabaseStmt(Node *node, const char *queryString)
return NIL;
}

EnsureCoordinator();
EnsurePropagationToCoordinator();

/*
* Given that CREATE DATABASE doesn't support "IF NOT EXISTS" and we're
Expand All @@ -345,7 +345,7 @@ PostprocessCreateDatabaseStmt(Node *node, const char *queryString)
(void *) createDatabaseCommand,
ENABLE_DDL_PROPAGATION);

return NontransactionalNodeDDLTaskList(NON_COORDINATOR_NODES, commands);
return NontransactionalNodeDDLTaskList(REMOTE_NODES, commands);
}


Expand All @@ -365,7 +365,7 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
return NIL;
}

EnsureCoordinator();
EnsurePropagationToCoordinator();

DropdbStmt *stmt = (DropdbStmt *) node;

Expand All @@ -391,7 +391,7 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
(void *) dropDatabaseCommand,
ENABLE_DDL_PROPAGATION);

return NontransactionalNodeDDLTaskList(NON_COORDINATOR_NODES, commands);
return NontransactionalNodeDDLTaskList(REMOTE_NODES, commands);
}


Expand Down
4 changes: 2 additions & 2 deletions src/backend/distributed/commands/utility_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,9 @@ citus_ProcessUtilityInternal(PlannedStmt *pstmt,
ereport(NOTICE, (errmsg("Citus partially supports CREATE DATABASE for "
"distributed databases"),
errdetail("Citus does not propagate CREATE DATABASE "
"command to workers"),
"command to other nodes"),
errhint("You can manually create a database and its "
"extensions on workers.")));
"extensions on other nodes.")));
}
}
else if (IsA(parsetree, CreateRoleStmt) && !EnableCreateRolePropagation)
Expand Down

0 comments on commit d85b211

Please sign in to comment.