From 428b8195160fea886abd4a81859daa603c847de2 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Thu, 22 Jul 2021 11:33:05 +0200 Subject: [PATCH] Rename argument to localOnly --- .../commands/create_distributed_table.c | 4 ++-- .../distributed/commands/dependencies.c | 4 ++-- src/backend/distributed/commands/extension.c | 4 ++-- src/backend/distributed/commands/function.c | 20 +++++++++---------- .../distributed/commands/utility_hook.c | 4 ++-- src/backend/distributed/metadata/distobject.c | 4 ++-- .../distributed/metadata/metadata_sync.c | 10 +++++----- src/include/distributed/commands.h | 2 +- src/include/distributed/metadata/distobject.h | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/backend/distributed/commands/create_distributed_table.c b/src/backend/distributed/commands/create_distributed_table.c index c95e3568c..b320bafa7 100644 --- a/src/backend/distributed/commands/create_distributed_table.c +++ b/src/backend/distributed/commands/create_distributed_table.c @@ -700,8 +700,8 @@ MarkSequenceListDistributed(List *sequenceList) ObjectAddress address; ObjectAddressSet(address, RelationRelationId, sequenceOid); - bool shouldSyncMetadata = true; - MarkObjectDistributed(&address, shouldSyncMetadata); + bool localOnly = false; + MarkObjectDistributed(&address, localOnly); } } diff --git a/src/backend/distributed/commands/dependencies.c b/src/backend/distributed/commands/dependencies.c index 8453bfa4d..f9dbba8ad 100644 --- a/src/backend/distributed/commands/dependencies.c +++ b/src/backend/distributed/commands/dependencies.c @@ -121,8 +121,8 @@ EnsureDependenciesExistOnAllNodes(const ObjectAddress *target) ObjectAddress *dependency = NULL; foreach_ptr(dependency, dependenciesWithCommands) { - bool shouldSyncMetadata = true; - MarkObjectDistributed(dependency, shouldSyncMetadata); + bool localOnly = false; + MarkObjectDistributed(dependency, localOnly); } } diff --git a/src/backend/distributed/commands/extension.c b/src/backend/distributed/commands/extension.c index 1e7b2a91a..b5976a206 100644 --- a/src/backend/distributed/commands/extension.c +++ b/src/backend/distributed/commands/extension.c @@ -591,8 +591,8 @@ MarkExistingObjectDependenciesDistributedIfSupported() ObjectAddress *objectAddress = NULL; foreach_ptr(objectAddress, uniqueObjectAddresses) { - bool shouldSyncMetadata = true; - MarkObjectDistributed(objectAddress, shouldSyncMetadata); + bool localOnly = false; + MarkObjectDistributed(objectAddress, localOnly); } } diff --git a/src/backend/distributed/commands/function.c b/src/backend/distributed/commands/function.c index de4760282..46b45b7da 100644 --- a/src/backend/distributed/commands/function.c +++ b/src/backend/distributed/commands/function.c @@ -191,8 +191,8 @@ create_distributed_function(PG_FUNCTION_ARGS) ENABLE_DDL_PROPAGATION); SendCommandToWorkersAsUser(NON_COORDINATOR_NODES, CurrentUserName(), ddlCommand.data); - bool shouldSyncMetadata = true; - MarkObjectDistributed(&functionAddress, shouldSyncMetadata); + bool localOnly = false; + MarkObjectDistributed(&functionAddress, localOnly); if (distributionArgumentName != NULL) { @@ -238,9 +238,9 @@ DistributeFunctionWithDistributionArgument(RegProcedure funcOid, distributionArgumentOid); /* record the distribution argument and colocationId */ - bool shouldSyncMetadata = true; + bool localOnly = false; UpdateFunctionDistributionInfo(functionAddress, &distributionArgumentIndex, - &colocationId, shouldSyncMetadata); + &colocationId, localOnly); /* * Once we have at least one distributed function/procedure with distribution @@ -277,10 +277,10 @@ DistributeFunctionColocatedWithDistributedTable(RegProcedure funcOid, " parameter should also be provided"))); } - bool shouldSyncMetadata = true; + bool localOnly = false; /* set distribution argument and colocationId to NULL */ - UpdateFunctionDistributionInfo(functionAddress, NULL, NULL, shouldSyncMetadata); + UpdateFunctionDistributionInfo(functionAddress, NULL, NULL, localOnly); } @@ -296,9 +296,9 @@ DistributeFunctionColocatedWithReferenceTable(const ObjectAddress *functionAddre /* set distribution argument to NULL and colocationId to the reference table colocation id */ int *distributionArgumentIndex = NULL; - bool shouldSyncMetadata = true; + bool localOnly = false; UpdateFunctionDistributionInfo(functionAddress, distributionArgumentIndex, - &colocationId, shouldSyncMetadata); + &colocationId, localOnly); /* * Once we have at least one distributed function/procedure that reads @@ -573,7 +573,7 @@ EnsureFunctionCanBeColocatedWithTable(Oid functionOid, Oid distributionColumnTyp void UpdateFunctionDistributionInfo(const ObjectAddress *distAddress, int *distribution_argument_index, - int *colocationId, bool shouldSyncMetadata) + int *colocationId, bool localOnly) { const bool indexOK = true; @@ -644,7 +644,7 @@ UpdateFunctionDistributionInfo(const ObjectAddress *distAddress, table_close(pgDistObjectRel, NoLock); - if (shouldSyncMetadata) + if (!localOnly) { char *workerMetadataUpdateCommand = DistributedObjectCreateCommand( distAddress, distribution_argument_index, colocationId); diff --git a/src/backend/distributed/commands/utility_hook.c b/src/backend/distributed/commands/utility_hook.c index 024719b7a..536c676c5 100644 --- a/src/backend/distributed/commands/utility_hook.c +++ b/src/backend/distributed/commands/utility_hook.c @@ -654,8 +654,8 @@ ProcessUtilityInternal(PlannedStmt *pstmt, if (ops && ops->markDistributed) { ObjectAddress address = GetObjectAddressFromParseTree(parsetree, false); - bool shouldSyncMetadata = true; - MarkObjectDistributed(&address, shouldSyncMetadata); + bool localOnly = false; + MarkObjectDistributed(&address, localOnly); } } diff --git a/src/backend/distributed/metadata/distobject.c b/src/backend/distributed/metadata/distobject.c index 25474025a..8ec87cba8 100644 --- a/src/backend/distributed/metadata/distobject.c +++ b/src/backend/distributed/metadata/distobject.c @@ -141,7 +141,7 @@ ObjectExists(const ObjectAddress *address) * by adding appropriate entries to citus.pg_dist_object. */ void -MarkObjectDistributed(const ObjectAddress *distAddress, bool shouldSyncMetadata) +MarkObjectDistributed(const ObjectAddress *distAddress, bool localOnly) { int paramCount = 3; Oid paramTypes[3] = { @@ -165,7 +165,7 @@ MarkObjectDistributed(const ObjectAddress *distAddress, bool shouldSyncMetadata) ereport(ERROR, (errmsg("failed to insert object into citus.pg_dist_object"))); } - if (shouldSyncMetadata) + if (!localOnly) { char *workerMetadataUpdateCommand = DistributedObjectCreateCommand( distAddress, NULL, NULL); diff --git a/src/backend/distributed/metadata/metadata_sync.c b/src/backend/distributed/metadata/metadata_sync.c index b9e8dc81e..e34684f98 100644 --- a/src/backend/distributed/metadata/metadata_sync.c +++ b/src/backend/distributed/metadata/metadata_sync.c @@ -399,8 +399,8 @@ SyncMetadataSnapshotToNode(WorkerNode *workerNode, bool raiseOnError) ObjectAddress *address; foreach_ptr(address, newDistributedObjects) { - bool shouldSyncMetadata = true; - MarkObjectDistributed(address, shouldSyncMetadata); + bool localOnly = false; + MarkObjectDistributed(address, localOnly); } return true; } @@ -2661,10 +2661,10 @@ citus_internal_add_object_metadata(PG_FUNCTION_ARGS) ObjectAddress address = { 0 }; ObjectAddressSubSet(address, classid, objid, objsubid); - bool shouldSyncMetadata = false; - MarkObjectDistributed(&address, shouldSyncMetadata); + bool localOnly = true; + MarkObjectDistributed(&address, localOnly); UpdateFunctionDistributionInfo(&address, distributionArgumentIndex, colocationId, - shouldSyncMetadata); + localOnly); PG_RETURN_VOID(); } diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index 89a587e47..bb9dbd47f 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -474,7 +474,7 @@ extern ObjectWithArgs * ObjectWithArgsFromOid(Oid funcOid); extern void UpdateFunctionDistributionInfo(const ObjectAddress *distAddress, int *distribution_argument_index, int *colocationId, - bool shouldSyncMetadata); + bool localOnly); /* vacuum.c - forward declarations */ extern void PostprocessVacuumStmt(VacuumStmt *vacuumStmt, const char *vacuumCommand); diff --git a/src/include/distributed/metadata/distobject.h b/src/include/distributed/metadata/distobject.h index e3b1a82d1..e21926719 100644 --- a/src/include/distributed/metadata/distobject.h +++ b/src/include/distributed/metadata/distobject.h @@ -21,7 +21,7 @@ extern bool CitusExtensionObject(const ObjectAddress *objectAddress); extern bool IsObjectDistributed(const ObjectAddress *address); extern bool ClusterHasDistributedFunctionWithDistArgument(void); extern void MarkObjectDistributed(const ObjectAddress *distAddress, - bool shouldSyncMetadata); + bool localOnly); extern void UnmarkObjectDistributed(const ObjectAddress *address); extern bool IsTableOwnedByExtension(Oid relationId); extern bool IsObjectAddressOwnedByExtension(const ObjectAddress *target,