Fixes indentation

pull/7240/head
gindibay 2023-11-15 16:34:02 +03:00
parent eb46d9399b
commit 6f838e6e88
4 changed files with 29 additions and 19 deletions

View File

@ -63,14 +63,16 @@ typedef struct DatabaseCollationInfo
} DatabaseCollationInfo; } DatabaseCollationInfo;
static void EnsureSupportedCreateDatabaseCommand(CreatedbStmt *stmt); static void EnsureSupportedCreateDatabaseCommand(CreatedbStmt *stmt);
static char * GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm); static char * GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database
databaseForm);
static DatabaseCollationInfo GetDatabaseCollation(Oid dbOid); static DatabaseCollationInfo GetDatabaseCollation(Oid dbOid);
static AlterOwnerStmt * RecreateAlterDatabaseOwnerStmt(Oid databaseOid); static AlterOwnerStmt * RecreateAlterDatabaseOwnerStmt(Oid databaseOid);
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
static char * GetLocaleProviderString(char datlocprovider); static char * GetLocaleProviderString(char datlocprovider);
#endif #endif
static char * GetTablespaceName(Oid tablespaceOid); static char * GetTablespaceName(Oid tablespaceOid);
static ObjectAddress * GetDatabaseAddressFromDatabaseName(char *databaseName,bool missingOk); static ObjectAddress * GetDatabaseAddressFromDatabaseName(char *databaseName, bool
missingOk);
static Oid get_database_owner(Oid db_oid); static Oid get_database_owner(Oid db_oid);
@ -660,12 +662,14 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
return str.data; return str.data;
} }
/* /*
* GrantOnDatabaseDDLCommands returns a list of sql statements to idempotently apply a * GrantOnDatabaseDDLCommands returns a list of sql statements to idempotently apply a
* GRANT on distributed databases. * GRANT on distributed databases.
*/ */
List *
List * GenerateGrantDatabaseCommandList(void){ GenerateGrantDatabaseCommandList(void)
{
List *grantCommands = NIL; List *grantCommands = NIL;
Relation pgDatabaseRel = table_open(DatabaseRelationId, AccessShareLock); Relation pgDatabaseRel = table_open(DatabaseRelationId, AccessShareLock);
@ -712,7 +716,8 @@ List * GenerateGrantDatabaseCommandList(void){
* Commands in the list are wrapped by citus_internal_database_command() UDF * Commands in the list are wrapped by citus_internal_database_command() UDF
* to avoid from transaction block restrictions that apply to database commands * to avoid from transaction block restrictions that apply to database commands
*/ */
List * GenerateCreateDatabaseCommandList(void) List *
GenerateCreateDatabaseCommandList(void)
{ {
List *commands = NIL; List *commands = NIL;

View File

@ -465,13 +465,13 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
List *ownerDDLCommands = DatabaseOwnerDDLCommands(dependency); List *ownerDDLCommands = DatabaseOwnerDDLCommands(dependency);
databaseDDLCommands = list_concat(databaseDDLCommands, ownerDDLCommands); databaseDDLCommands = list_concat(databaseDDLCommands, ownerDDLCommands);
} }
//TODO: To reviewer: Having a code block for dependency makes sense /*TODO: To reviewer: Having a code block for dependency makes sense */
// However dependency tree is based on pg metadata; which does not reflect /* However dependency tree is based on pg metadata; which does not reflect */
// actual database dependencies. I added this block just to point out the issue. /* actual database dependencies. I added this block just to point out the issue. */
// if(EnableCreateDatabasePropagation){ /* if(EnableCreateDatabasePropagation){ */
// List *dbGrants = GrantOnDatabaseDDLCommands(dependency->objectId); /* List *dbGrants = GrantOnDatabaseDDLCommands(dependency->objectId); */
// databaseDDLCommands = list_concat(databaseDDLCommands, dbGrants); /* databaseDDLCommands = list_concat(databaseDDLCommands, dbGrants); */
// } /* } */
return databaseDDLCommands; return databaseDDLCommands;
} }

View File

@ -513,7 +513,7 @@ GenerateRoleOptionsList(HeapTuple tuple)
List * List *
GenerateCreateOrAlterRoleCommand(Oid roleOid) GenerateCreateOrAlterRoleCommand(Oid roleOid)
{ {
elog(LOG,"GenerateCreateOrAlterRoleCommand execution"); elog(LOG, "GenerateCreateOrAlterRoleCommand execution");
HeapTuple roleTuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleOid)); HeapTuple roleTuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleOid));
Form_pg_authid role = ((Form_pg_authid) GETSTRUCT(roleTuple)); Form_pg_authid role = ((Form_pg_authid) GETSTRUCT(roleTuple));

View File

@ -2048,6 +2048,7 @@ GenerateGrantOnSchemaQueriesFromAclItem(Oid schemaOid, AclItem *aclItem)
return queries; return queries;
} }
List * List *
GrantOnDatabaseDDLCommands(Oid databaseOid) GrantOnDatabaseDDLCommands(Oid databaseOid)
{ {
@ -2071,7 +2072,7 @@ GrantOnDatabaseDDLCommands(Oid databaseOid)
{ {
commands = list_concat(commands, commands = list_concat(commands,
GenerateGrantOnDatabaseFromAclItem( GenerateGrantOnDatabaseFromAclItem(
databaseOid,&aclDat[i])); databaseOid, &aclDat[i]));
} }
return commands; return commands;
@ -2098,21 +2099,24 @@ GenerateGrantOnDatabaseFromAclItem(Oid databaseOid, AclItem *aclItem)
if (permissions & ACL_CONNECT) if (permissions & ACL_CONNECT)
{ {
char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights( char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights(
OBJECT_DATABASE ,granteeOid, databaseOid, "CONNECT", OBJECT_DATABASE, granteeOid, databaseOid,
"CONNECT",
grants & ACL_CONNECT)); grants & ACL_CONNECT));
queries = lappend(queries, query); queries = lappend(queries, query);
} }
if (permissions & ACL_CREATE) if (permissions & ACL_CREATE)
{ {
char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights( char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights(
OBJECT_DATABASE, granteeOid, databaseOid, "CREATE", OBJECT_DATABASE, granteeOid, databaseOid,
"CREATE",
grants & ACL_CREATE)); grants & ACL_CREATE));
queries = lappend(queries, query); queries = lappend(queries, query);
} }
if (permissions & ACL_CREATE_TEMP) if (permissions & ACL_CREATE_TEMP)
{ {
char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights( char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights(
OBJECT_DATABASE, granteeOid, databaseOid, "TEMPORARY", OBJECT_DATABASE, granteeOid, databaseOid,
"TEMPORARY",
grants & ACL_CREATE_TEMP)); grants & ACL_CREATE_TEMP));
queries = lappend(queries, query); queries = lappend(queries, query);
} }
@ -4762,6 +4766,7 @@ SendNodeWideObjectsSyncCommands(MetadataSyncContext *context)
SendOrCollectCommandListToActivatedNodes(context, commandList); SendOrCollectCommandListToActivatedNodes(context, commandList);
} }
/* /*
* SendDatabaseGrantSyncCommands sends database grants to roles to workers with * SendDatabaseGrantSyncCommands sends database grants to roles to workers with
* transactional or nontransactional mode according to transactionMode inside * transactional or nontransactional mode according to transactionMode inside