Fixes indentation

pull/7240/head
gindibay 2023-10-24 14:18:10 +03:00
parent 87f694ec0f
commit e9e64a69c1
6 changed files with 34 additions and 22 deletions

View File

@ -341,4 +341,3 @@ DropTextSearchConfigObjectAddress(Node *node, bool missing_ok, bool isPostproces
return objectAddresses; return objectAddresses;
} }

View File

@ -347,6 +347,7 @@ citus_internal_database_command(PG_FUNCTION_ARGS)
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
List * List *
PreprocessDropDatabaseStmt(Node *node, const char *queryString, PreprocessDropDatabaseStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext) ProcessUtilityContext processUtilityContext)
@ -361,7 +362,8 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
DropdbStmt *stmt = (DropdbStmt *) node; DropdbStmt *stmt = (DropdbStmt *) node;
List *addresses = GetObjectAddressListFromParseTree(node, stmt->missing_ok, isPostProcess); List *addresses = GetObjectAddressListFromParseTree(node, stmt->missing_ok,
isPostProcess);
if (list_length(addresses) == 0) if (list_length(addresses) == 0)
{ {
@ -369,7 +371,7 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
} }
ObjectAddress *address = (ObjectAddress *) linitial(addresses); ObjectAddress *address = (ObjectAddress *) linitial(addresses);
if (address->objectId == InvalidOid ||!IsObjectDistributed(address)) if (address->objectId == InvalidOid || !IsObjectDistributed(address))
{ {
return NIL; return NIL;
} }
@ -384,7 +386,9 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
return NontransactionalNodeDDLTask(NON_COORDINATOR_NODES, commands); return NontransactionalNodeDDLTask(NON_COORDINATOR_NODES, commands);
} }
static ObjectAddress *GetDatabaseAddressFromDatabaseName(char *databaseName)
static ObjectAddress *
GetDatabaseAddressFromDatabaseName(char *databaseName)
{ {
Oid databaseOid = get_database_oid(databaseName, false); Oid databaseOid = get_database_oid(databaseName, false);
ObjectAddress *dbAddress = palloc0(sizeof(ObjectAddress)); ObjectAddress *dbAddress = palloc0(sizeof(ObjectAddress));
@ -392,6 +396,7 @@ static ObjectAddress *GetDatabaseAddressFromDatabaseName(char *databaseName)
return dbAddress; return dbAddress;
} }
List * List *
DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess)
{ {
@ -400,6 +405,7 @@ DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess)
return list_make1(dbAddress); return list_make1(dbAddress);
} }
List * List *
CreateDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) CreateDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess)
{ {

View File

@ -581,7 +581,6 @@ ProcessUtilityInternal(PlannedStmt *pstmt,
} }
/* /*
* We only process ALTER TABLE ... ATTACH PARTITION commands in the function below * We only process ALTER TABLE ... ATTACH PARTITION commands in the function below
* and distribute the partition if necessary. * and distribute the partition if necessary.
@ -1482,31 +1481,35 @@ DDLTaskList(Oid relationId, const char *commandString)
return taskList; return taskList;
} }
/* /*
* NontransactionalNodeDDLTask builds a list of tasks to execute a DDL command on a * NontransactionalNodeDDLTask builds a list of tasks to execute a DDL command on a
* given target set of nodes with cannotBeExecutedInTransction is set to make sure * given target set of nodes with cannotBeExecutedInTransction is set to make sure
* that list is being executed without a transaction. * that list is being executed without a transaction.
*/ */
List * NontransactionalNodeDDLTask(TargetWorkerSet targets, List *commands ){ List *
NontransactionalNodeDDLTask(TargetWorkerSet targets, List *commands)
{
List *ddlJobs = NodeDDLTaskList(NON_COORDINATOR_NODES, commands); List *ddlJobs = NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
DDLJob *ddlJob = NULL; DDLJob *ddlJob = NULL;
foreach_ptr(ddlJob, ddlJobs) foreach_ptr(ddlJob, ddlJobs)
{ {
Task *task = NULL; Task *task = NULL;
foreach_ptr(task, ddlJob->taskList) foreach_ptr(task, ddlJob->taskList)
{ {
task->cannotBeExecutedInTransction = true; task->cannotBeExecutedInTransction = true;
} }
} }
return ddlJobs; return ddlJobs;
} }
/* /*
* NodeDDLTaskList builds a list of tasks to execute a DDL command on a * NodeDDLTaskList builds a list of tasks to execute a DDL command on a
* given target set of nodes. * given target set of nodes.
*/ */
List * List *
NodeDDLTaskList(TargetWorkerSet targets, List *commands ) NodeDDLTaskList(TargetWorkerSet targets, List *commands)
{ {
DDLJob *ddlJob = palloc0(sizeof(DDLJob)); DDLJob *ddlJob = palloc0(sizeof(DDLJob));
ddlJob->targetObjectAddress = InvalidObjectAddress; ddlJob->targetObjectAddress = InvalidObjectAddress;

View File

@ -357,7 +357,9 @@ ExecuteCommandAsSuperuser(char *query, int paramCount, Oid *paramTypes,
return spiStatus; return spiStatus;
} }
void UnmarkRolesAndDatabaseDistributed(Node *node)
void
UnmarkRolesAndDatabaseDistributed(Node *node)
{ {
if (IsA(node, DropRoleStmt)) if (IsA(node, DropRoleStmt))
{ {
@ -369,12 +371,11 @@ void UnmarkRolesAndDatabaseDistributed(Node *node)
{ {
UnmarkRolesDistributed(distributedDropRoles); UnmarkRolesDistributed(distributedDropRoles);
} }
} }
else if (IsA(node, DropdbStmt)) else if (IsA(node, DropdbStmt))
{ {
DropdbStmt *stmt = castNode(DropdbStmt, node); DropdbStmt *stmt = castNode(DropdbStmt, node);
char *dbName = stmt->dbname; char *dbName = stmt->dbname;
Oid dbOid = get_database_oid(dbName, stmt->missing_ok); Oid dbOid = get_database_oid(dbName, stmt->missing_ok);
ObjectAddress *dbAddress = palloc0(sizeof(ObjectAddress)); ObjectAddress *dbAddress = palloc0(sizeof(ObjectAddress));
@ -383,6 +384,7 @@ void UnmarkRolesAndDatabaseDistributed(Node *node)
} }
} }
/* /*
* UnmarkObjectDistributed removes the entry from pg_dist_object that marks this object as * UnmarkObjectDistributed removes the entry from pg_dist_object that marks this object as
* distributed. This will prevent updates to that object to be propagated to the worker. * distributed. This will prevent updates to that object to be propagated to the worker.

View File

@ -240,8 +240,10 @@ extern List * PreprocessAlterDatabaseSetStmt(Node *node, const char *queryString
extern List * PostprocessCreateDatabaseStmt(Node *node, const char *queryString); extern List * PostprocessCreateDatabaseStmt(Node *node, const char *queryString);
extern List * PreprocessDropDatabaseStmt(Node *node, const char *queryString, extern List * PreprocessDropDatabaseStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List * DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess); extern List * DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool
extern List * CreateDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess); isPostprocess);
extern List * CreateDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool
isPostprocess);
/* domain.c - forward declarations */ /* domain.c - forward declarations */

View File

@ -94,7 +94,7 @@ extern void ProcessUtilityParseTree(Node *node, const char *queryString,
extern void MarkInvalidateForeignKeyGraph(void); extern void MarkInvalidateForeignKeyGraph(void);
extern void InvalidateForeignKeyGraphForDDL(void); extern void InvalidateForeignKeyGraphForDDL(void);
extern List * DDLTaskList(Oid relationId, const char *commandString); extern List * DDLTaskList(Oid relationId, const char *commandString);
extern List * NontransactionalNodeDDLTask(TargetWorkerSet targets, List *commands ); extern List * NontransactionalNodeDDLTask(TargetWorkerSet targets, List *commands);
extern List * NodeDDLTaskList(TargetWorkerSet targets, List *commands); extern List * NodeDDLTaskList(TargetWorkerSet targets, List *commands);
extern bool AlterTableInProgress(void); extern bool AlterTableInProgress(void);
extern bool DropSchemaOrDBInProgress(void); extern bool DropSchemaOrDBInProgress(void);