Allow delegating function from worker nodes

We've both allowed delegating functions and procedures from worker nodes
and also prevented delegation if a function/procedure has already been
propagated from another node.
pull/5415/head
Burak Velioglu 2021-12-02 00:05:12 +03:00
parent a8b1ee87f7
commit 6d849cf394
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
2 changed files with 17 additions and 3 deletions

View File

@ -62,7 +62,12 @@ CallDistributedProcedureRemotely(CallStmt *callStmt, DestReceiver *dest)
DistObjectCacheEntry *procedure = LookupDistObjectCacheEntry(ProcedureRelationId,
functionId, 0);
if (procedure == NULL || !procedure->isDistributed)
/*
* If procedure is not distributed or already delegated from another
* node, do not call the procedure remotely.
*/
if (procedure == NULL || !procedure->isDistributed ||
IsCitusInitiatedRemoteBackend())
{
return false;
}

View File

@ -112,9 +112,18 @@ TryToDelegateFunctionCall(DistributedPlanningContext *planContext)
}
int32 localGroupId = GetLocalGroupId();
if (localGroupId != COORDINATOR_GROUP_ID || localGroupId == GROUP_ID_UPGRADING)
if (localGroupId != COORDINATOR_GROUP_ID && IsCitusInitiatedRemoteBackend())
{
/* do not delegate from workers, or while upgrading */
/*
* Do not delegate from workers if it is initiated by Citus already.
* It means that this function has already been delegated to this node.
*/
return NULL;
}
if (localGroupId == GROUP_ID_UPGRADING)
{
/* do not delegate while upgrading */
return NULL;
}