Address reviews

velioglu/cyclic_dep_2
Burak Velioglu 2022-03-09 11:03:23 +03:00
parent f52fdac198
commit 6437e4ce25
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
1 changed files with 15 additions and 2 deletions

View File

@ -32,6 +32,7 @@
typedef bool (*AddressPredicate)(const ObjectAddress *); typedef bool (*AddressPredicate)(const ObjectAddress *);
static void EnsureDependenciesCanBeDistributed(const ObjectAddress *relationAddress); static void EnsureDependenciesCanBeDistributed(const ObjectAddress *relationAddress);
static void ErrorIfHasUnsupportedDependency(const ObjectAddress *objectAddress);
static void ErrorIfCircularDependencyExists(const ObjectAddress *objectAddress); static void ErrorIfCircularDependencyExists(const ObjectAddress *objectAddress);
static int ObjectAddressComparator(const void *a, const void *b); static int ObjectAddressComparator(const void *a, const void *b);
static List * GetDependencyCreateDDLCommands(const ObjectAddress *dependency); static List * GetDependencyCreateDDLCommands(const ObjectAddress *dependency);
@ -150,12 +151,24 @@ EnsureDependenciesExistOnAllNodes(const ObjectAddress *target)
static void static void
EnsureDependenciesCanBeDistributed(const ObjectAddress *objectAddress) 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); 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 *undistributableDependency = GetUndistributableDependency(
objectAddress); objectAddress);
if (undistributableDependency != NULL) if (undistributableDependency != NULL)
{ {
if (SupportedDependencyByCitus(undistributableDependency)) if (SupportedDependencyByCitus(undistributableDependency))