mirror of https://github.com/citusdata/citus.git
make nesting info explicit
parent
be7c0d01ec
commit
47a8ef3a0b
|
@ -917,54 +917,42 @@ IsTaskExecutionAllowed(bool isRemote)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isRemote)
|
bool locallyNestedExecutionOnDistributedTable =
|
||||||
{
|
(InLocalQueryOnShard != INVALID_SHARD_ID && DistributedTableShardId(
|
||||||
if (AllowedDistributionColumnValue.isActive)
|
InLocalQueryOnShard));
|
||||||
{
|
bool remotelyNestedExecution = IsCitusInternalBackend() &&
|
||||||
/*
|
!(InTopLevelDelegatedFunctionCall ||
|
||||||
* When we are in a forced delegated function call, we explicitly check
|
InDelegatedProcedureCall);
|
||||||
* whether local tasks use the same distribution column value in
|
|
||||||
* EnsureForceDelegationDistributionKey.
|
|
||||||
*/
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InTrigger())
|
if (!(locallyNestedExecutionOnDistributedTable || remotelyNestedExecution))
|
||||||
{
|
|
||||||
/*
|
|
||||||
* In triggers on shards we only disallow remote tasks. This has a few
|
|
||||||
* reasons:
|
|
||||||
*
|
|
||||||
* - We want to enable access to co-located shards, but do not have additional
|
|
||||||
* checks yet.
|
|
||||||
* - Users need to explicitly set enable_unsafe_triggers in order to create
|
|
||||||
* triggers on distributed tables.
|
|
||||||
* - Triggers on Citus local tables should be able to access other Citus local
|
|
||||||
* tables.
|
|
||||||
*/
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InLocalQueryOnShard != INVALID_SHARD_ID &&
|
|
||||||
DistributedTableShardId(InLocalQueryOnShard))
|
|
||||||
{
|
{
|
||||||
/* executing a local query on a shard, nested execution is not allowed */
|
/* we are only interested in nested executions */
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsCitusInternalBackend())
|
|
||||||
{
|
|
||||||
/* in a regular, client-initiated backend doing a regular task */
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InTopLevelDelegatedFunctionCall || InDelegatedProcedureCall)
|
/* for nested execution, we allow triggers */
|
||||||
|
if (!isRemote && InTrigger())
|
||||||
{
|
{
|
||||||
/* in a citus-initiated backend, but als in a delegated a procedure call */
|
/*
|
||||||
|
* In triggers on shards we only disallow remote tasks. This has a few
|
||||||
|
* reasons:
|
||||||
|
*
|
||||||
|
* - We want to enable access to co-located shards, but do not have additional
|
||||||
|
* checks yet.
|
||||||
|
* - Users need to explicitly set enable_unsafe_triggers in order to create
|
||||||
|
* triggers on distributed tables.
|
||||||
|
* - Triggers on Citus local tables should be able to access other Citus local
|
||||||
|
* tables.
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isRemote && AllowedDistributionColumnValue.isActive)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue