From e9e64a69c1dce29a5bd976cac0fe8238edbc6e07 Mon Sep 17 00:00:00 2001 From: gindibay Date: Tue, 24 Oct 2023 14:18:10 +0300 Subject: [PATCH] Fixes indentation --- src/backend/distributed/commands/common.c | 1 - src/backend/distributed/commands/database.c | 12 ++++++--- .../distributed/commands/utility_hook.c | 27 ++++++++++--------- src/backend/distributed/metadata/distobject.c | 8 +++--- src/include/distributed/commands.h | 6 +++-- .../distributed/commands/utility_hook.h | 2 +- 6 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/backend/distributed/commands/common.c b/src/backend/distributed/commands/common.c index b338792d8..9a87df9f1 100644 --- a/src/backend/distributed/commands/common.c +++ b/src/backend/distributed/commands/common.c @@ -341,4 +341,3 @@ DropTextSearchConfigObjectAddress(Node *node, bool missing_ok, bool isPostproces return objectAddresses; } - diff --git a/src/backend/distributed/commands/database.c b/src/backend/distributed/commands/database.c index 34813085e..6522571fa 100644 --- a/src/backend/distributed/commands/database.c +++ b/src/backend/distributed/commands/database.c @@ -347,6 +347,7 @@ citus_internal_database_command(PG_FUNCTION_ARGS) PG_RETURN_VOID(); } + List * PreprocessDropDatabaseStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext) @@ -361,7 +362,8 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString, 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) { @@ -369,7 +371,7 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString, } ObjectAddress *address = (ObjectAddress *) linitial(addresses); - if (address->objectId == InvalidOid ||!IsObjectDistributed(address)) + if (address->objectId == InvalidOid || !IsObjectDistributed(address)) { return NIL; } @@ -384,7 +386,9 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString, return NontransactionalNodeDDLTask(NON_COORDINATOR_NODES, commands); } -static ObjectAddress *GetDatabaseAddressFromDatabaseName(char *databaseName) + +static ObjectAddress * +GetDatabaseAddressFromDatabaseName(char *databaseName) { Oid databaseOid = get_database_oid(databaseName, false); ObjectAddress *dbAddress = palloc0(sizeof(ObjectAddress)); @@ -392,6 +396,7 @@ static ObjectAddress *GetDatabaseAddressFromDatabaseName(char *databaseName) return dbAddress; } + List * DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { @@ -400,6 +405,7 @@ DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) return list_make1(dbAddress); } + List * CreateDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { diff --git a/src/backend/distributed/commands/utility_hook.c b/src/backend/distributed/commands/utility_hook.c index 3cd2ccd1f..b0fae6727 100644 --- a/src/backend/distributed/commands/utility_hook.c +++ b/src/backend/distributed/commands/utility_hook.c @@ -581,7 +581,6 @@ ProcessUtilityInternal(PlannedStmt *pstmt, } - /* * We only process ALTER TABLE ... ATTACH PARTITION commands in the function below * and distribute the partition if necessary. @@ -1482,31 +1481,35 @@ DDLTaskList(Oid relationId, const char *commandString) return taskList; } + /* * 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 * 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); - DDLJob *ddlJob = NULL; - foreach_ptr(ddlJob, ddlJobs) - { - Task *task = NULL; - foreach_ptr(task, ddlJob->taskList) - { - task->cannotBeExecutedInTransction = true; - } - } + DDLJob *ddlJob = NULL; + foreach_ptr(ddlJob, ddlJobs) + { + Task *task = NULL; + foreach_ptr(task, ddlJob->taskList) + { + task->cannotBeExecutedInTransction = true; + } + } return ddlJobs; } + /* * NodeDDLTaskList builds a list of tasks to execute a DDL command on a * given target set of nodes. */ List * -NodeDDLTaskList(TargetWorkerSet targets, List *commands ) +NodeDDLTaskList(TargetWorkerSet targets, List *commands) { DDLJob *ddlJob = palloc0(sizeof(DDLJob)); ddlJob->targetObjectAddress = InvalidObjectAddress; diff --git a/src/backend/distributed/metadata/distobject.c b/src/backend/distributed/metadata/distobject.c index 722f51bc9..af8354ee3 100644 --- a/src/backend/distributed/metadata/distobject.c +++ b/src/backend/distributed/metadata/distobject.c @@ -357,7 +357,9 @@ ExecuteCommandAsSuperuser(char *query, int paramCount, Oid *paramTypes, return spiStatus; } -void UnmarkRolesAndDatabaseDistributed(Node *node) + +void +UnmarkRolesAndDatabaseDistributed(Node *node) { if (IsA(node, DropRoleStmt)) { @@ -369,12 +371,11 @@ void UnmarkRolesAndDatabaseDistributed(Node *node) { UnmarkRolesDistributed(distributedDropRoles); } - } else if (IsA(node, DropdbStmt)) { DropdbStmt *stmt = castNode(DropdbStmt, node); - char *dbName = stmt->dbname; + char *dbName = stmt->dbname; Oid dbOid = get_database_oid(dbName, stmt->missing_ok); 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 * distributed. This will prevent updates to that object to be propagated to the worker. diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index 95d6e9a13..06dda53eb 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -240,8 +240,10 @@ extern List * PreprocessAlterDatabaseSetStmt(Node *node, const char *queryString extern List * PostprocessCreateDatabaseStmt(Node *node, const char *queryString); extern List * PreprocessDropDatabaseStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess); -extern List * CreateDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess); +extern List * DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * CreateDatabaseStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); /* domain.c - forward declarations */ diff --git a/src/include/distributed/commands/utility_hook.h b/src/include/distributed/commands/utility_hook.h index 3295d110c..93d9e8355 100644 --- a/src/include/distributed/commands/utility_hook.h +++ b/src/include/distributed/commands/utility_hook.h @@ -94,7 +94,7 @@ extern void ProcessUtilityParseTree(Node *node, const char *queryString, extern void MarkInvalidateForeignKeyGraph(void); extern void InvalidateForeignKeyGraphForDDL(void); 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 bool AlterTableInProgress(void); extern bool DropSchemaOrDBInProgress(void);