citus/src/backend/distributed/commands
Sait Talha Nisanci a76aec21f4 Add shard relation to pState in localCopy
CopyFrom expects an AccessShareLock on the table. Instead of adding an
explicit lock, we do it how postgres is doing, which is to use
addRangeTableEntryForRelation.

Commit:
c532d15dddff14b01fe9ef1d465013cb8ef186df
2021-08-25 16:18:32 +03:00
..
README.md Fix some more master->coordinator comments 2020-07-07 10:37:53 +02:00
alter_table.c Use get_am_name to find indexAM name 2021-08-18 00:44:37 +03:00
call.c Improve the robustness of function call delegation 2020-09-21 14:53:30 +02:00
cascade_table_operation_for_connected_relations.c Drop postgres 11 support 2021-03-25 09:20:28 +03:00
citus_add_local_table_to_metadata.c Use RelationGetStatExtList instead of GetExplicitStatisticsIdList 2021-08-18 17:50:57 +03:00
cluster.c Pass ProcessUtilityContext to .preprocess 2021-01-14 17:12:00 +03:00
collation.c Drop postgres 11 support 2021-03-25 09:20:28 +03:00
create_distributed_table.c Dropped columns do not diverge distribution column for partitioned tables 2021-08-06 13:36:12 +02:00
database.c Feature: alter database owner (#4986) 2021-05-20 13:27:44 +02:00
dependencies.c Introduces getObjectTypeDescription_compat and getObjectIdentity_compat macros 2021-08-25 16:18:31 +03:00
distribute_object_ops.c Adds AlterTableStmtObjType macro 2021-08-25 16:18:31 +03:00
drop_distributed_table.c Move CheckCitusVersion to the top of each function 2021-06-01 17:43:46 +02:00
extension.c Pass ProcessUtilityContext to .preprocess 2021-01-14 17:12:00 +03:00
foreign_constraint.c Fix check to always allow foreign keys to reference tables (#5073) 2021-06-24 12:15:52 +02:00
function.c Introduces macros for functions that now have include_out_arguments argument 2021-08-25 16:18:31 +03:00
grant.c Pass ProcessUtilityContext to .preprocess 2021-01-14 17:12:00 +03:00
index.c Introduces IsReindexWithParam_compat macro 2021-08-25 16:18:31 +03:00
index_pg_source.c Fix Semmle errors (#4636) 2021-02-08 18:37:44 +03:00
local_multi_copy.c Add shard relation to pState in localCopy 2021-08-25 16:18:32 +03:00
multi_copy.c Removes support for old protocols in Copy functions from PG14 2021-08-25 16:18:32 +03:00
policy.c Pass ProcessUtilityContext to .preprocess 2021-01-14 17:12:00 +03:00
rename.c Adds propagation of ALTER SEQUENCE and other improvements (#5061) 2021-06-24 21:23:25 +03:00
role.c Drop postgres 11 support 2021-03-25 09:20:28 +03:00
schema.c Pass ProcessUtilityContext to .preprocess 2021-01-14 17:12:00 +03:00
sequence.c Adds AlterTableStmtObjType macro 2021-08-25 16:18:31 +03:00
statistics.c Extends statistics on expressions in ruleutils_14.c 2021-08-25 16:18:32 +03:00
subscription.c Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
table.c Adds AlterTableStmtObjType macro 2021-08-25 16:18:31 +03:00
transmit.c Fix unlimited copy size variable's value 2021-08-25 16:18:32 +03:00
trigger.c Drop postgres 11 support 2021-03-25 09:20:28 +03:00
truncate.c Do not rely on fk cache when truncating local data (#5018) 2021-06-07 11:56:48 +03:00
type.c Introduces getObjectTypeDescription_compat and getObjectIdentity_compat macros 2021-08-25 16:18:31 +03:00
utility_hook.c Introduces ProcessUtility macros for readOnlyTree parameter 2021-08-25 16:18:32 +03:00
vacuum.c Introduces macros for vacuum options 2021-08-25 16:18:31 +03:00
variableset.c Fix Subtransaction memory leak 2020-07-09 12:33:39 -07:00

README.md

Commands

The commands module is modeled after backend/commands from the postgres repository and contains the logic for Citus on how to run these commands on distributed objects. Even though the structure of the directory has some resemblence to its postgres relative, files here are somewhat more fine-grained. This is due to the nature of citus commands that are heavily focused on distributed tables. Instead of having all commands in tablecmds.c they are often moved to files that are named after the command.

File Description
create_distributed_table.c Implementation of UDF's for creating distributed tables
drop_distributed_table.c Implementation for dropping metadata for partitions of distributed tables
extension.c Implementation of CREATE EXTENSION commands for citus specific checks
foreign_constraint.c Implementation of helper functions for foreign key constraints
grant.c Placeholder for code granting users access to relations, implemented as enterprise feature
index.c Implementation of commands specific to indices on distributed tables
multi_copy.c Implementation of COPY command. There are multiple different copy modes which are described in detail below
policy.c Implementation of CREATE\ALTER POLICY commands.
rename.c Implementation of ALTER ... RENAME ... commands. It implements the renaming of applicable objects, otherwise provides the user with a warning
schema.c
sequence.c Implementation of CREATE/ALTER SEQUENCE commands. Primarily checks correctness of sequence statements as they are not propagated to the worker nodes
table.c
transmit.c Implementation of COPY commands with format transmit set in the options. This format is used to transfer files from one node to another node
truncate.c Implementation of TRUNCATE commands on distributed tables
utility_hook.c This is the entry point from postgres into the commands module of citus. It contains the implementation that gets registered in postgres' ProcessUtility_hook callback to extends the functionality of the original ProcessUtility. This code is used to route the incomming commands to their respective implementation in Citus
vacuum.c Implementation of VACUUM commands on distributed tables

COPY

The copy command is overloaded for a couple of use-cases specific to citus. The syntax of the command stays the same, however the implementation might slightly differ from the stock implementation. The overloading is mostly done via extra options that Citus uses to indicate how to operate the copy. The options used are described below.

FORMAT transmit

Implemented in transmit.c

TODO: to be written by someone with enough knowledge to write how, when and why it is used.

FORMAT result

Implemented in multi_copy.c

TODO: to be written by someone with enough knowledge to write how, when and why it is used.