citus/src/include/distributed
Teja Mupparti 54862f8c22 (1) Functions will be delegated even when present in the scope of an explicit
BEGIN/COMMIT transaction block or in a UDF calling another UDF.
(2) Prohibit/Limit the delegated function not to do a 2PC (or any work on a
remote connection).
(3) Have a safety net to ensure the (2) i.e. we should block the connections
from the delegated procedure or make sure that no 2PC happens on the node.
(4) Such delegated functions are restricted to use only the distributed argument
value.

Note: To limit the scope of the project we are considering only Functions(not
procedures) for the initial work.

DESCRIPTION: Introduce a new flag "force_delegation" in create_distributed_function(),
which will allow a function to be delegated in an explicit transaction block.

Fixes #3265

Once the function is delegated to the worker, on that node during the planning

distributed_planner()
TryToDelegateFunctionCall()
CheckDelegatedFunctionExecution()
EnableInForceDelegatedFuncExecution()
Save the distribution argument (Constant)
ExecutorStart()
CitusBeginScan()
IsShardKeyValueAllowed()
Ensure to not use non-distribution argument.

ExecutorRun()
AdaptiveExecutor()
StartDistributedExecution()
EnsureNoRemoteExecutionFromWorkers()
Ensure all the shards are local to the node in the remoteTaskList.
NonPushableInsertSelectExecScan()
InitializeCopyShardState()
EnsureNoRemoteExecutionFromWorkers()
Ensure all the shards are local to the node in the placementList.

This also fixes a minor issue: Properly handle expressions+parameters in distribution arguments
2022-01-19 16:43:33 -08:00
..
commands Disallow remote execution from queries on shards 2022-01-07 17:46:21 +01:00
metadata (1) Functions will be delegated even when present in the scope of an explicit 2022-01-19 16:43:33 -08:00
adaptive_executor.h Wait until all connections are successfully established 2021-05-19 15:59:13 +02:00
argutils.h Add the necessary changes for rebalance strategies on enterprise (#3325) 2019-12-19 15:23:08 +01:00
backend_data.h Use current user to sync metadata 2021-07-16 13:25:27 +02:00
cancel_utils.h add IsHoldOffCancellationReceived utility function (#3290) 2019-12-12 17:32:59 +03:00
citus_acquire_lock.h remove copyright years (#3286) 2019-12-11 21:14:08 +03:00
citus_clauses.h Rename master evaluation to coordinator evaluation 2020-07-07 10:37:41 +02:00
citus_custom_scan.h Do not execute subplans multiple times with cursors 2020-11-20 10:43:56 +01:00
citus_nodefuncs.h refactor table ddl events scoped for shards (#4342) 2020-11-26 13:31:59 +01:00
citus_nodes.h refactor table ddl events scoped for shards (#4342) 2020-11-26 13:31:59 +01:00
citus_ruleutils.h Propagate foreign server ops 2021-12-23 17:54:04 +03:00
citus_safe_lib.h Semmle: Ensure stack memory is not leaked through uninitialized… (#3561) 2020-03-11 20:05:36 +01:00
colocation_utils.h Introduce citus_internal_update_relation_colocation 2021-08-03 11:44:58 +02:00
combine_query_planner.h Drop postgres 11 support 2021-03-25 09:20:28 +03:00
commands.h (1) Functions will be delegated even when present in the scope of an explicit 2022-01-19 16:43:33 -08:00
connection_management.h Tell other backends it's safe to ignore the backend that concurrently built the shell table index (#5520) 2022-01-10 10:23:09 +03:00
coordinator_protocol.h Columnar: move DDL hooks to citus to remove dependency. (#5547) 2022-01-04 23:26:46 -08:00
cte_inline.h Update regression tests-2 2020-01-16 12:28:15 +01:00
deparse_shard_query.h Fix missing from entry 2021-11-04 18:54:52 +03:00
deparser.h Propagate foreign server ops 2021-12-23 17:54:04 +03:00
directed_acyclic_graph_execution.h Fill in jobIdList field of DistributedExecution 2020-02-05 17:32:22 +00:00
distributed_deadlock_detection.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
distributed_execution_locks.h Unify distributed execution logic for single replicated tables 2021-11-08 13:52:20 +01:00
distributed_planner.h Fix FROM ONLY queries on partitioned tables 2021-04-27 16:10:07 +02:00
distribution_column.h Dropped columns do not diverge distribution column for partitioned tables 2021-08-06 13:36:12 +02:00
enterprise.h remove copyright years (#3286) 2019-12-11 21:14:08 +03:00
error_codes.h Issue worker messages with the same log level 2020-04-14 21:08:25 +02:00
errormessage.h Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00:00
extended_op_node_utils.h Fix some more master->coordinator comments 2020-07-07 10:37:53 +02:00
foreign_key_relationship.h Dont auto-undistribute user-added citus local tables (#5314) 2021-10-28 12:10:26 +03:00
function_call_delegation.h (1) Functions will be delegated even when present in the scope of an explicit 2022-01-19 16:43:33 -08:00
function_utils.h Semmle: Fix obvious issues (#3502) 2020-02-21 10:16:00 +01:00
hash_helpers.h Drop postgres 11 support 2021-03-25 09:20:28 +03:00
insert_select_executor.h Move more from insert_select_executor to insert_select_planner 2020-06-26 08:08:26 -07:00
insert_select_planner.h Move more from insert_select_executor to insert_select_planner 2020-06-26 08:08:26 -07:00
intermediate_result_pruning.h Feature: localhost guc (#4836) 2021-05-12 16:59:44 +02:00
intermediate_results.h Allow local execution for intermediate results in COPY 2021-02-09 15:00:06 +01:00
listutils.h Make pg_version_compat.h and listutils.c dependency-free. (#5548) 2022-01-04 23:02:08 -08:00
local_distributed_join_planner.h Add more tests 2020-12-15 18:18:36 +03:00
local_executor.h Deparse/parse the local cached queries 2021-06-21 12:24:29 +03:00
local_multi_copy.h Allow local execution for intermediate results in COPY 2021-02-09 15:00:06 +01:00
local_plan_cache.h Deparse/parse the local cached queries 2021-06-21 12:24:29 +03:00
locally_reserved_shared_connections.h COPY uses adaptive connection management on local node 2021-02-04 09:45:07 +01:00
lock_graph.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
log_utils.h Issue worker messages with the same log level 2020-04-14 21:08:25 +02:00
maintenanced.h Reland #4419 2021-01-19 07:48:47 -08:00
memutils.h Implementation for asycn FinishConnectionListEstablishment (#2584) 2019-03-22 17:30:42 +01:00
metadata_cache.h (1) Functions will be delegated even when present in the scope of an explicit 2022-01-19 16:43:33 -08:00
metadata_sync.h (1) Functions will be delegated even when present in the scope of an explicit 2022-01-19 16:43:33 -08:00
metadata_utility.h Support foreign tables in MX (#5461) 2022-01-06 18:50:34 +03:00
multi_client_executor.h Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
multi_executor.h Disallow remote execution from queries on shards 2022-01-07 17:46:21 +01:00
multi_explain.h Sort explain analyze output by task time 2020-09-24 11:38:40 +03:00
multi_join_order.h Rename ForceXxx functions to to XxxOrError 2020-09-01 11:19:17 +02:00
multi_logical_optimizer.h Fix union pushdown issue (#5079) 2021-07-29 13:52:55 +03:00
multi_logical_planner.h (1) Functions will be delegated even when present in the scope of an explicit 2022-01-19 16:43:33 -08:00
multi_partitioning_utils.h Run fix_partition_shard_index_names after each wrong naming command 2021-11-08 10:43:34 +01:00
multi_physical_planner.h (1) Functions will be delegated even when present in the scope of an explicit 2022-01-19 16:43:33 -08:00
multi_progress.h Avoid two race conditions in the rebalance progress monitor (#5050) 2021-06-21 14:03:42 +00:00
multi_router_planner.h Only consider pseudo constants for shortcuts (#4712) 2021-02-15 18:39:37 +03:00
multi_server_executor.h Fix typos. Spurred spotting "connectios" in logs 2021-10-25 13:54:09 +00:00
namespace_utils.h Implement PushOverrideEmptySearchPath (#3874) 2020-06-05 19:23:59 +03:00
pg_dist_colocation.h Add distributioncolumncollation to to pg_dist_colocation 2019-12-09 19:51:40 +00:00
pg_dist_local_group.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
pg_dist_node.h Replace master with citus in logs and comments (#5210) 2021-08-26 11:31:17 +03:00
pg_dist_node_metadata.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
pg_dist_partition.h Dont auto-undistribute user-added citus local tables (#5314) 2021-10-28 12:10:26 +03:00
pg_dist_placement.h Fix some more master->coordinator comments 2020-07-07 10:37:53 +02:00
pg_dist_rebalance_strategy.h Implement an improvement threshold in the rebalancer (#4927) 2021-05-11 14:24:59 +02:00
pg_dist_shard.h Remove cstore_fdw-related logic 2021-11-16 13:59:03 +01:00
pg_dist_transaction.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
pg_version_constants.h Adds copy of ruleutils_13.c as ruleutils_14.c 2021-09-03 15:27:24 +03:00
placement_access.h Remove real time router executors (#3142) 2019-11-05 12:48:10 +01:00
placement_connection.h Drop support for Inactive Shard placements 2021-10-22 18:03:35 +02:00
query_colocation_checker.h Refactor WrapRteRelationIntoSubquery 2020-12-15 18:18:36 +03:00
query_pushdown_planning.h Allow constant VALUES clauses in pushdown queries 2021-04-21 14:28:08 +02:00
query_stats.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
query_utils.h Fix partition column index issue (#4591) 2021-01-29 14:40:40 +03:00
recursive_planning.h Drop postgres 11 support 2021-03-25 09:20:28 +03:00
reference_table_utils.h Move placement deletion from disable node to activate node 2022-01-07 09:56:03 +01:00
relation_access_tracking.h Record non-distributed table accesses in local executor (#4139) 2020-09-07 18:19:08 +03:00
relation_restriction_equivalence.h Fix union pushdown issue (#5079) 2021-07-29 13:52:55 +03:00
relation_utils.h Refactor PreprocessIndexStmt (#4272) 2020-11-25 12:19:37 +03:00
relay_utility.h Drop support for Inactive Shard placements 2021-10-22 18:03:35 +02:00
remote_commands.h Add citus.grep_remote_commands 2021-12-17 11:47:40 +01:00
remote_transaction.h Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
repair_shards.h Only allow moves of shards of distributed tables (#5072) 2021-06-23 16:25:46 +02:00
repartition_join_execution.h Add adaptive executor support for repartition joins (#3169) 2019-12-17 19:09:45 +03:00
resource_lock.h Enable replication factor > 1 in metadata syncing (#5392) 2021-11-15 15:10:18 +03:00
run_from_same_connection.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
shard_cleaner.h Use "orphaned shards" naming in more places 2021-06-04 11:39:19 +02:00
shard_pruning.h Enable citus-local distributed table joins 2020-12-15 18:17:10 +03:00
shard_rebalancer.h Add ExecuteCriticalCommandInDifferentTransaction function 2021-06-04 11:30:27 +02:00
shard_utils.h Switch to sequential mode on long partition names 2021-04-14 15:27:50 +03:00
shardinterval_utils.h Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
shared_connection_stats.h Local node connection management 2020-12-03 14:16:13 +03:00
shared_library_init.h refactor some of hard coded values in citus gucs (#3137) 2019-10-30 10:35:39 +03:00
statistics_collection.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
string_utils.h Degrade gracefully when no background workers available 2020-10-05 16:55:00 +03:00
subplan_execution.h Locally execute queries that don't need any data access (#3410) 2020-01-23 18:28:34 +01:00
task_execution_utils.h Remove task tracker executor (#3850) 2020-07-18 13:11:36 +03:00
tdigest_extension.h Feature: tdigest aggregate (#3897) 2020-06-12 13:50:28 +02:00
time_constants.h refactor some of hard coded values in citus gucs (#3137) 2019-10-30 10:35:39 +03:00
transaction_identifier.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
transaction_management.h (1) Functions will be delegated even when present in the scope of an explicit 2022-01-19 16:43:33 -08:00
transaction_recovery.h Delete transactions when removing node 2020-12-07 11:35:20 +03:00
transmit.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
tuple_destination.h Local execution considers intermediate result size limit 2020-10-15 17:18:55 +02:00
tuplestore.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
version_compat.h Make pg_version_compat.h and listutils.c dependency-free. (#5548) 2022-01-04 23:02:08 -08:00
worker_create_or_replace.h create_distributed_function: accept aggregates 2019-11-06 18:23:37 +00:00
worker_log_messages.h Issue worker messages with the same log level 2020-04-14 21:08:25 +02:00
worker_manager.h Synchronize hasmetadata flag on mx workers (#5086) 2021-08-12 14:16:18 +03:00
worker_protocol.h Remove cstore_fdw-related logic 2021-11-16 13:59:03 +01:00
worker_shard_visibility.h Hide shards from application_name's with a specific prefix 2022-01-18 15:20:55 +04:00
worker_transaction.h Make sure to use a dedicated metadata connection 2021-11-26 14:36:28 +01:00