citus/src/backend/distributed/commands
SaitTalhaNisanci 0aebd78ea7 use localExecution in ExecuteTaskListExtended
ExecuteTaskListExtended is the common method for different codepaths,
and instead of writing separate local execution logics in different
codepaths, it makes more sense to have the logic here. We still need to
do some refactoring, this is an initial step.

After this commit, we can run create shard commands locally. There is a
special case with shard creation commands. A create shard command might
have a concatenated query string, however local execution did not know
how to execute a task with multiple query strings. This is also
implemented in this commit. We go over each query in the concatenated
query string and plan/execute them one by one.

A more clean solution to this would be to make sure that each task has a
single query. We currently cannot do that because we need to ensure the
task dependencies. However, it would make sense to do that at some point
and it would simplify the code a lot.
2020-04-01 18:23:16 +03:00
..
README.md Fix misc typos 2019-05-23 17:23:27 -07:00
call.c use localExecution in ExecuteTaskListExtended 2020-04-01 18:23:16 +03:00
cluster.c Given IsDistributedTableRTE, there's ambiguity in what DistributedTable means 2020-03-06 18:57:55 +00:00
collation.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
create_distributed_table.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
dependencies.c Replace foreach with foreach_ptr/foreach_oid (#3544) 2020-02-27 16:54:49 +01:00
distribute_object_ops.c Propagate ALTER ROLE .. SET statements 2020-03-27 13:02:48 +03:00
drop_distributed_table.c Given IsDistributedTableRTE, there's ambiguity in what DistributedTable means 2020-03-06 18:57:55 +00:00
extension.c Refactor the deparsing of a CREATE EXTENSION to prevent NULL POINTER dereferences (#3518) 2020-03-04 16:47:07 +01:00
foreign_constraint.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
function.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
grant.c Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00:00
index.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
local_multi_copy.c not use local copy if we are copying into intermediate results file 2020-03-18 09:35:20 +03:00
multi_copy.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
policy.c Given IsDistributedTableRTE, there's ambiguity in what DistributedTable means 2020-03-06 18:57:55 +00:00
rename.c Fix typos, rename isDistributedRelation to isCitusRelation 2020-03-06 19:20:34 +00:00
role.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
schema.c Given IsDistributedTableRTE, there's ambiguity in what DistributedTable means 2020-03-06 18:57:55 +00:00
sequence.c Given IsDistributedTableRTE, there's ambiguity in what DistributedTable means 2020-03-06 18:57:55 +00:00
subscription.c Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
table.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
transmit.c Replace foreach with foreach_ptr/foreach_oid (#3544) 2020-02-27 16:54:49 +01:00
truncate.c Rename LookupCitusTableCacheEntry to GetCitusTableCacheEntry, LookupLookupCitusTableCacheEntry back to LookupCitusTableCacheEntry 2020-03-08 14:08:23 +00:00
type.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
utility_hook.c Propagate ALTER ROLE .. SET statements 2020-03-27 13:02:48 +03:00
vacuum.c use macros for pg versions instead of hardcoded values (#3694) 2020-04-01 17:01:52 +03:00
variableset.c Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00: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.

MASTER_HOST host

Implemented in multi_copy.c

Triggered by the MASTER_HOST option being set on the copy command. Also accepts MASTER_PORT

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