From 6437e4ce25af4c9a65982d8e5d27ef44232f72bf Mon Sep 17 00:00:00 2001 From: Burak Velioglu Date: Wed, 9 Mar 2022 11:03:23 +0300 Subject: [PATCH] Address reviews --- src/backend/distributed/commands/dependencies.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/commands/dependencies.c b/src/backend/distributed/commands/dependencies.c index c8f70a010..bdfaeb39a 100644 --- a/src/backend/distributed/commands/dependencies.c +++ b/src/backend/distributed/commands/dependencies.c @@ -32,6 +32,7 @@ typedef bool (*AddressPredicate)(const ObjectAddress *); static void EnsureDependenciesCanBeDistributed(const ObjectAddress *relationAddress); +static void ErrorIfHasUnsupportedDependency(const ObjectAddress *objectAddress); static void ErrorIfCircularDependencyExists(const ObjectAddress *objectAddress); static int ObjectAddressComparator(const void *a, const void *b); static List * GetDependencyCreateDDLCommands(const ObjectAddress *dependency); @@ -150,12 +151,24 @@ EnsureDependenciesExistOnAllNodes(const ObjectAddress *target) static void EnsureDependenciesCanBeDistributed(const ObjectAddress *objectAddress) { - /* If an object circularcly depends to itself, Citus can not handle it */ + /* If the object circularcly depends to itself, Citus can not handle it */ ErrorIfCircularDependencyExists(objectAddress); - /* If any of the dependency of the object can not be distributed, error out */ + /* If the object has any unsupported dependency, error out */ + ErrorIfHasUnsupportedDependency(objectAddress); +} + + +/* + * ErrorIfHasUnsupportedDependency ensures object doesn't have any dependency unsupported + * by Citus. + */ +static void +ErrorIfHasUnsupportedDependency(const ObjectAddress *objectAddress) +{ ObjectAddress *undistributableDependency = GetUndistributableDependency( objectAddress); + if (undistributableDependency != NULL) { if (SupportedDependencyByCitus(undistributableDependency))