From aef3eb8c23188effbed5c3014103fa65896c48bd Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Fri, 25 Feb 2022 16:33:25 +0100 Subject: [PATCH] wip --- src/backend/distributed/commands/dependencies.c | 3 +-- src/backend/distributed/metadata/metadata_sync.c | 2 ++ src/include/distributed/metadata_utility.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/commands/dependencies.c b/src/backend/distributed/commands/dependencies.c index c1bd4c340..bcf378041 100644 --- a/src/backend/distributed/commands/dependencies.c +++ b/src/backend/distributed/commands/dependencies.c @@ -29,7 +29,6 @@ typedef bool (*AddressPredicate)(const ObjectAddress *); -static int ObjectAddressComparator(const void *a, const void *b); static List * GetDependencyCreateDDLCommands(const ObjectAddress *dependency); static List * FilterObjectAddressListByPredicate(List *objectAddressList, AddressPredicate predicate); @@ -136,7 +135,7 @@ EnsureDependenciesExistOnAllNodes(const ObjectAddress *target) /* * Copied from PG object_address_comparator function to compare ObjectAddresses. */ -static int +int ObjectAddressComparator(const void *a, const void *b) { const ObjectAddress *obja = (const ObjectAddress *) a; diff --git a/src/backend/distributed/metadata/metadata_sync.c b/src/backend/distributed/metadata/metadata_sync.c index 490eeb4ca..d89eeece9 100644 --- a/src/backend/distributed/metadata/metadata_sync.c +++ b/src/backend/distributed/metadata/metadata_sync.c @@ -823,6 +823,8 @@ MarkObjectsDistributedCreateCommand(List *addresses, List *colocationIds, List *forceDelegations) { + addresses = SortList(addresses, ObjectAddressComparator); + StringInfo insertDistributedObjectsCommand = makeStringInfo(); Assert(list_length(addresses) == list_length(distributionArgumentIndexes)); diff --git a/src/include/distributed/metadata_utility.h b/src/include/distributed/metadata_utility.h index 3e7a3b6f3..ecc81b223 100644 --- a/src/include/distributed/metadata_utility.h +++ b/src/include/distributed/metadata_utility.h @@ -250,6 +250,7 @@ extern List * GetDistributableDependenciesForObject(const ObjectAddress *target) extern bool ShouldPropagate(void); extern bool ShouldPropagateObject(const ObjectAddress *address); extern List * ReplicateAllObjectsToNodeCommandList(const char *nodeName, int nodePort); +extern int ObjectAddressComparator(const void *a, const void *b); /* Remaining metadata utility functions */ extern char * TableOwner(Oid relationId);