citus/src/backend/distributed/commands
Naisila Puka 42d956888d
PG16 compatibility: Resolve compilation issues (#7005)
This PR provides successful compilation against PG16Beta2. It does some
necessary refactoring to prepare for full support of version 16, in
https://github.com/citusdata/citus/pull/6952 .

Change RelFileNode to RelFileNumber or RelFileLocator 
Relevant PG commit
b0a55e43299c4ea2a9a8c757f9c26352407d0ccc

new header for varatt.h 
Relevant PG commit:
d952373a987bad331c0e499463159dd142ced1ef

drop support for Abs, use fabs 
Relevant PG commit
357cfefb09115292cfb98d504199e6df8201c957

tuplesort PGcommit: d37aa3d35832afde94e100c4d2a9618b3eb76472 
Relevant PG commit:
d37aa3d35832afde94e100c4d2a9618b3eb76472

Fix vacuum in columnar 
Relevant PG commit:
4ce3afb82ecfbf64d4f6247e725004e1da30f47c
older one:
b6074846cebc33d752f1d9a66e5a9932f21ad177

Add alloc_flags to pg_clean_ascii 
Relevant PG commit:
45b1a67a0fcb3f1588df596431871de4c93cb76f

Merge GetNumConfigOptions() into get_guc_variables() 
Relevant PG commit:
3057465acfbea2f3dd7a914a1478064022c6eecd

Minor PG refactor PG_FUNCNAME_MACRO __func__ 
Relevant PG commit
320f92b744b44f961e5d56f5f21de003e8027a7f

Pass NULL context to stringToQualifiedNameList, typeStringToTypeName 
The pre-PG16 error behaviour for the following
stringToQualifiedNameList & typeStringToTypeName
was ereport(ERROR, ...)
Now with PG16 we have this context input. We preserve the same behaviour
by passing a NULL context, because of the following:
(copy paste comment from PG16)
If "context" isn't an ErrorSaveContext node, this behaves as
errstart(ERROR, domain), and the errsave() macro ends up acting
exactly like ereport(ERROR, ...).
Relevant PG commit
858e776c84f48841e7e16fba7b690b76e54f3675

Use RangeVarCallbackMaintainsTable instead of RangeVarCallbackOwnsTable 
Relevant PG commit:
60684dd834a222fefedd49b19d1f0a6189c1632e

FIX THIS: Not implemented grant-level control of role inheritance 
see PG commit
e3ce2de09d814f8770b2e3b3c152b7671bcdb83f

Make Scan node abstract 
PG commit:
8c73c11a0d39049de2c1f400d8765a0eb21f5228

Change in Var representations, get_relids_in_jointree 
PG commit
2489d76c4906f4461a364ca8ad7e0751ead8aa0d

Deadlock detection changes because SHM_QUEUE is removed 
Relevant PG Commit:
d137cb52cb7fd44a3f24f3c750fbf7924a4e9532

TU_UpdateIndexes 
Relevant PG commit
19d8e2308bc51ec4ab993ce90077342c915dd116

Use object_ownercheck and object_aclcheck functions 
Relevant PG commits:
afbfc02983f86c4d71825efa6befd547fe81a926
c727f511bd7bf3c58063737bcf7a8f331346f253

Rework Permission Info for successful compilation 
Relevant PG commits:
postgres/postgres@a61b1f7
postgres/postgres@b803b7d
---------

Co-authored-by: onderkalaci <onderkalaci@gmail.com>
2023-07-21 14:32:37 +03:00
..
README.md Make enterprise features open source (#6008) 2022-06-16 00:23:46 -07:00
alter_table.c Improve error/hint messages related to schema-based sharding (#7027) 2023-06-22 18:10:12 +03:00
begin.c Propagate BEGIN properties to worker nodes (#6483) 2022-11-10 18:08:43 +01:00
call.c Remove useless version compats 2022-07-29 10:31:55 +02:00
cascade_table_operation_for_connected_relations.c ALTER TABLE <tblname> SET SCHEMA <schemaname> for single shard tables (#7004) 2023-06-19 10:21:13 +03:00
citus_add_local_table_to_metadata.c Fix ScanKeyInit RegProcedure and Datum arguments (#7072) 2023-07-21 14:11:10 +03:00
citus_global_signal.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03:00
cluster.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03:00
collation.c Remove AssertArg and AssertState (#6970) 2023-06-05 13:25:21 +03:00
common.c address method should take parameter isPostprocess 2022-08-02 21:00:23 +03:00
create_distributed_table.c Allow using generated identity column based on int/smallint when creating a distributed table (#7008) 2023-06-16 14:34:23 +03:00
database.c address method should take parameter isPostprocess 2022-08-02 21:00:23 +03:00
dependencies.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03:00
distribute_object_ops.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03:00
domain.c PG16 compatibility: Resolve compilation issues (#7005) 2023-07-21 14:32:37 +03:00
drop_distributed_table.c Add support for schema-based-sharding via a GUC (#6866) 2023-05-26 10:49:58 +03:00
extension.c [Columnar] Check for existence of Citus before creating Citus_Columnar (#6178) 2022-08-17 15:12:42 -07:00
foreign_constraint.c Fix ScanKeyInit RegProcedure and Datum arguments (#7072) 2023-07-21 14:11:10 +03:00
foreign_data_wrapper.c refactor code where GetObjectAddressFromParseTree is called because it returns list of addresses now 2022-07-19 18:13:12 +03:00
foreign_server.c address method should take parameter isPostprocess 2022-08-02 21:00:23 +03:00
function.c Fix ScanKeyInit RegProcedure and Datum arguments (#7072) 2023-07-21 14:11:10 +03:00
grant.c refactor code where GetObjectAddressFromParseTree is called because it returns list of addresses now 2022-07-19 18:13:12 +03:00
index.c PG16 compatibility: Resolve compilation issues (#7005) 2023-07-21 14:32:37 +03:00
index_pg_source.c Fix Semmle errors (#4636) 2021-02-08 18:37:44 +03:00
local_multi_copy.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03:00
multi_copy.c PG16 compatibility: Resolve compilation issues (#7005) 2023-07-21 14:32:37 +03:00
owned.c fix the problem #5763 (#6519) 2022-12-02 13:49:32 +01:00
policy.c Enable ALTER TABLE ... ADD CHECK (#6606) 2023-01-12 23:31:06 +03:00
publication.c Propagate CREATE PUBLICATION statements 2023-03-29 00:59:12 +02:00
rename.c * alter index/table rename weird syntax supported, 2022-07-04 21:27:47 +03:00
role.c PG16 compatibility: Resolve compilation issues (#7005) 2023-07-21 14:32:37 +03:00
schema.c Fix ScanKeyInit RegProcedure and Datum arguments (#7072) 2023-07-21 14:11:10 +03:00
schema_based_sharding.c ALTER TABLE <tblname> SET SCHEMA <schemaname> for single shard tables (#7004) 2023-06-19 10:21:13 +03:00
sequence.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03:00
statistics.c address method should take parameter isPostprocess 2022-08-02 21:00:23 +03:00
subscription.c Remove useless version compats 2022-07-29 10:31:55 +02:00
table.c Deparse ALTER TABLE commands if ADD COLUMN is the only subcommand 2023-07-12 18:17:47 +03:00
text_search.c address method should take parameter isPostprocess 2022-08-02 21:00:23 +03:00
trigger.c Fix ScanKeyInit RegProcedure and Datum arguments (#7072) 2023-07-21 14:11:10 +03:00
truncate.c PG16 compatibility: Resolve compilation issues (#7005) 2023-07-21 14:32:37 +03:00
type.c PG16 compatibility: Resolve compilation issues (#7005) 2023-07-21 14:32:37 +03:00
utility_hook.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03:00
vacuum.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03:00
variableset.c Remove AssertArg and AssertState (#6970) 2023-06-05 13:25:21 +03:00
view.c Drop PG13 Support Phase 2 - Remove PG13 specific paths/tests (#7007) 2023-06-21 14:18:23 +03: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 and helper functions for foreign key constraints
grant.c Implementation of GRANT commands for roles/users on relations
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 incoming 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.