diff --git a/src/backend/columnar/columnar.c b/src/backend/columnar/columnar.c index 85ec06d00f4..4914bbc3aa5 100644 --- a/src/backend/columnar/columnar.c +++ b/src/backend/columnar/columnar.c @@ -11,16 +11,18 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" - #include #include +#include "postgres.h" + #include "miscadmin.h" + #include "utils/guc.h" #include "utils/rel.h" #include "citus_version.h" + #include "columnar/columnar.h" #include "columnar/columnar_tableam.h" diff --git a/src/backend/columnar/columnar_compression.c b/src/backend/columnar/columnar_compression.c index 50cdfb01b5e..2ff35da982c 100644 --- a/src/backend/columnar/columnar_compression.c +++ b/src/backend/columnar/columnar_compression.c @@ -13,13 +13,14 @@ */ #include "postgres.h" -#include "citus_version.h" #include "common/pg_lzcompress.h" #include "lib/stringinfo.h" -#include "columnar/columnar_compression.h" +#include "citus_version.h" #include "pg_version_constants.h" +#include "columnar/columnar_compression.h" + #if HAVE_CITUS_LIBLZ4 #include #endif diff --git a/src/backend/columnar/columnar_customscan.c b/src/backend/columnar/columnar_customscan.c index 4ea96a121e4..ebf815d207c 100644 --- a/src/backend/columnar/columnar_customscan.c +++ b/src/backend/columnar/columnar_customscan.c @@ -10,18 +10,17 @@ *------------------------------------------------------------------------- */ -#include "citus_version.h" +#include #include "postgres.h" -#include +#include "miscadmin.h" #include "access/amapi.h" #include "access/skey.h" #include "catalog/pg_am.h" #include "catalog/pg_statistic.h" #include "commands/defrem.h" -#include "miscadmin.h" #include "nodes/extensible.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" @@ -33,6 +32,8 @@ #include "optimizer/paths.h" #include "optimizer/plancat.h" #include "optimizer/restrictinfo.h" + +#include "citus_version.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "parser/parse_relation.h" #include "parser/parsetree.h" @@ -48,6 +49,7 @@ #include "columnar/columnar_customscan.h" #include "columnar/columnar_metadata.h" #include "columnar/columnar_tableam.h" + #include "distributed/listutils.h" /* diff --git a/src/backend/columnar/columnar_debug.c b/src/backend/columnar/columnar_debug.c index c609195133d..bf12108a9af 100644 --- a/src/backend/columnar/columnar_debug.c +++ b/src/backend/columnar/columnar_debug.c @@ -11,12 +11,12 @@ #include "postgres.h" #include "funcapi.h" +#include "miscadmin.h" + #include "access/nbtree.h" #include "access/table.h" #include "catalog/pg_am.h" #include "catalog/pg_type.h" -#include "pg_version_constants.h" -#include "miscadmin.h" #include "storage/fd.h" #include "storage/smgr.h" #include "utils/guc.h" @@ -25,6 +25,8 @@ #include "utils/tuplestore.h" #include "pg_version_compat.h" +#include "pg_version_constants.h" + #include "columnar/columnar.h" #include "columnar/columnar_storage.h" #include "columnar/columnar_version_compat.h" diff --git a/src/backend/columnar/columnar_metadata.c b/src/backend/columnar/columnar_metadata.c index e7a6bfa9500..b756a760761 100644 --- a/src/backend/columnar/columnar_metadata.c +++ b/src/backend/columnar/columnar_metadata.c @@ -19,46 +19,50 @@ */ +#include + #include "postgres.h" +#include "miscadmin.h" #include "safe_lib.h" -#include "citus_version.h" -#include "columnar/columnar.h" -#include "columnar/columnar_storage.h" -#include "columnar/columnar_version_compat.h" -#include "distributed/listutils.h" - -#include #include "access/heapam.h" #include "access/htup_details.h" #include "access/nbtree.h" #include "access/xact.h" #include "catalog/indexing.h" -#include "catalog/pg_namespace.h" +#include "catalog/namespace.h" #include "catalog/pg_collation.h" +#include "catalog/pg_namespace.h" #include "catalog/pg_type.h" -#include "catalog/namespace.h" #include "commands/defrem.h" #include "commands/sequence.h" #include "commands/trigger.h" #include "executor/executor.h" #include "executor/spi.h" -#include "miscadmin.h" -#include "nodes/execnodes.h" #include "lib/stringinfo.h" +#include "nodes/execnodes.h" + +#include "citus_version.h" + +#include "columnar/columnar.h" +#include "columnar/columnar_storage.h" +#include "columnar/columnar_version_compat.h" + +#include "distributed/listutils.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "parser/parse_relation.h" #endif #include "port.h" + #include "storage/fd.h" #include "storage/lmgr.h" #include "storage/procarray.h" #include "storage/smgr.h" #include "utils/builtins.h" #include "utils/fmgroids.h" -#include "utils/memutils.h" #include "utils/lsyscache.h" +#include "utils/memutils.h" #include "utils/rel.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "storage/relfilelocator.h" diff --git a/src/backend/columnar/columnar_reader.c b/src/backend/columnar/columnar_reader.c index 526dd03cbf5..7ef0d15d7da 100644 --- a/src/backend/columnar/columnar_reader.c +++ b/src/backend/columnar/columnar_reader.c @@ -22,16 +22,15 @@ #include "access/xact.h" #include "catalog/pg_am.h" #include "commands/defrem.h" -#include "distributed/listutils.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" -#include "optimizer/optimizer.h" #include "optimizer/clauses.h" +#include "optimizer/optimizer.h" #include "optimizer/restrictinfo.h" #include "storage/fd.h" #include "utils/guc.h" -#include "utils/memutils.h" #include "utils/lsyscache.h" +#include "utils/memutils.h" #include "utils/rel.h" #include "columnar/columnar.h" @@ -39,6 +38,8 @@ #include "columnar/columnar_tableam.h" #include "columnar/columnar_version_compat.h" +#include "distributed/listutils.h" + #define UNEXPECTED_STRIPE_READ_ERR_MSG \ "attempted to read an unexpected stripe while reading columnar " \ "table %s, stripe with id=" UINT64_FORMAT " is not flushed" diff --git a/src/backend/columnar/columnar_storage.c b/src/backend/columnar/columnar_storage.c index 21aa7ab9c93..0ae6ccca3f0 100644 --- a/src/backend/columnar/columnar_storage.c +++ b/src/backend/columnar/columnar_storage.c @@ -36,11 +36,11 @@ #include "postgres.h" +#include "miscadmin.h" #include "safe_lib.h" #include "access/generic_xlog.h" #include "catalog/storage.h" -#include "miscadmin.h" #include "storage/bufmgr.h" #include "storage/lmgr.h" diff --git a/src/backend/columnar/columnar_tableam.c b/src/backend/columnar/columnar_tableam.c index dade931df27..40486d08fae 100644 --- a/src/backend/columnar/columnar_tableam.c +++ b/src/backend/columnar/columnar_tableam.c @@ -1,42 +1,38 @@ -#include "citus_version.h" +#include #include "postgres.h" -#include - #include "miscadmin.h" +#include "pgstat.h" +#include "safe_lib.h" +#include "access/detoast.h" #include "access/genam.h" #include "access/heapam.h" #include "access/multixact.h" #include "access/rewriteheap.h" #include "access/tableam.h" #include "access/tsmapi.h" -#include "access/detoast.h" #include "access/xact.h" #include "catalog/catalog.h" #include "catalog/index.h" #include "catalog/namespace.h" #include "catalog/objectaccess.h" #include "catalog/pg_am.h" +#include "catalog/pg_extension.h" #include "catalog/pg_publication.h" #include "catalog/pg_trigger.h" -#include "catalog/pg_extension.h" #include "catalog/storage.h" #include "catalog/storage_xlog.h" #include "commands/defrem.h" +#include "commands/extension.h" #include "commands/progress.h" #include "commands/vacuum.h" -#include "commands/extension.h" #include "executor/executor.h" #include "nodes/makefuncs.h" #include "optimizer/plancat.h" -#include "pg_version_compat.h" -#include "pgstat.h" -#include "safe_lib.h" #include "storage/bufmgr.h" #include "storage/bufpage.h" -#include "storage/bufmgr.h" #include "storage/lmgr.h" #include "storage/predicate.h" #include "storage/procarray.h" @@ -44,17 +40,22 @@ #include "tcop/utility.h" #include "utils/builtins.h" #include "utils/fmgroids.h" +#include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/pg_rusage.h" #include "utils/rel.h" #include "utils/relcache.h" -#include "utils/lsyscache.h" #include "utils/syscache.h" + +#include "citus_version.h" +#include "pg_version_compat.h" + #include "columnar/columnar.h" #include "columnar/columnar_customscan.h" #include "columnar/columnar_storage.h" #include "columnar/columnar_tableam.h" #include "columnar/columnar_version_compat.h" + #include "distributed/listutils.h" /* diff --git a/src/backend/columnar/columnar_writer.c b/src/backend/columnar/columnar_writer.c index 3b510ce7460..52d4e17aa11 100644 --- a/src/backend/columnar/columnar_writer.c +++ b/src/backend/columnar/columnar_writer.c @@ -16,18 +16,19 @@ #include "postgres.h" +#include "miscadmin.h" #include "safe_lib.h" #include "access/heapam.h" #include "access/nbtree.h" #include "catalog/pg_am.h" -#include "miscadmin.h" -#include "pg_version_compat.h" #include "storage/fd.h" #include "storage/smgr.h" #include "utils/guc.h" #include "utils/memutils.h" #include "utils/rel.h" + +#include "pg_version_compat.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "storage/relfilelocator.h" #include "utils/relfilenumbermap.h" diff --git a/src/backend/columnar/write_state_management.c b/src/backend/columnar/write_state_management.c index 27d902e61f5..7f35c5dd179 100644 --- a/src/backend/columnar/write_state_management.c +++ b/src/backend/columnar/write_state_management.c @@ -1,21 +1,17 @@ -#include "citus_version.h" +#include #include "postgres.h" -#include "columnar/columnar.h" - - -#include #include "miscadmin.h" +#include "pgstat.h" #include "access/genam.h" #include "access/heapam.h" +#include "access/heaptoast.h" #include "access/multixact.h" #include "access/rewriteheap.h" #include "access/tsmapi.h" -#include "access/heaptoast.h" -#include "common/hashfn.h" #include "access/xact.h" #include "catalog/catalog.h" #include "catalog/index.h" @@ -26,14 +22,12 @@ #include "catalog/storage_xlog.h" #include "commands/progress.h" #include "commands/vacuum.h" +#include "common/hashfn.h" #include "executor/executor.h" #include "nodes/makefuncs.h" #include "optimizer/plancat.h" -#include "pg_version_compat.h" -#include "pgstat.h" #include "storage/bufmgr.h" #include "storage/bufpage.h" -#include "storage/bufmgr.h" #include "storage/lmgr.h" #include "storage/predicate.h" #include "storage/procarray.h" @@ -44,6 +38,10 @@ #include "utils/rel.h" #include "utils/syscache.h" +#include "citus_version.h" +#include "pg_version_compat.h" + +#include "columnar/columnar.h" #include "columnar/columnar_customscan.h" #include "columnar/columnar_tableam.h" #include "columnar/columnar_version_compat.h" diff --git a/src/backend/distributed/cdc/cdc_decoder.c b/src/backend/distributed/cdc/cdc_decoder.c index 2beb2777248..cf9f4963b72 100644 --- a/src/backend/distributed/cdc/cdc_decoder.c +++ b/src/backend/distributed/cdc/cdc_decoder.c @@ -8,8 +8,9 @@ *------------------------------------------------------------------------- */ -#include "cdc_decoder_utils.h" #include "postgres.h" + +#include "cdc_decoder_utils.h" #include "fmgr.h" #include "access/genam.h" diff --git a/src/backend/distributed/cdc/cdc_decoder_utils.c b/src/backend/distributed/cdc/cdc_decoder_utils.c index f5b23aa12d2..b571d18b93c 100644 --- a/src/backend/distributed/cdc/cdc_decoder_utils.c +++ b/src/backend/distributed/cdc/cdc_decoder_utils.c @@ -8,18 +8,21 @@ *------------------------------------------------------------------------- */ #include "postgres.h" -#include "commands/extension.h" + +#include "cdc_decoder_utils.h" #include "fmgr.h" #include "miscadmin.h" + #include "access/genam.h" #include "access/heapam.h" +#include "catalog/pg_namespace.h" +#include "commands/extension.h" #include "common/hashfn.h" #include "common/string.h" #include "utils/fmgroids.h" -#include "utils/typcache.h" #include "utils/lsyscache.h" -#include "catalog/pg_namespace.h" -#include "cdc_decoder_utils.h" +#include "utils/typcache.h" + #include "distributed/pg_dist_partition.h" #include "distributed/pg_dist_shard.h" #include "distributed/relay_utility.h" diff --git a/src/backend/distributed/cdc/cdc_decoder_utils.h b/src/backend/distributed/cdc/cdc_decoder_utils.h index 46d1e4ae569..8b9cb298bde 100644 --- a/src/backend/distributed/cdc/cdc_decoder_utils.h +++ b/src/backend/distributed/cdc/cdc_decoder_utils.h @@ -12,9 +12,11 @@ #define CITUS_CDC_DECODER_H #include "postgres.h" + +#include "c.h" #include "fmgr.h" + #include "replication/logical.h" -#include "c.h" #define InvalidRepOriginId 0 #define INVALID_SHARD_ID 0 diff --git a/src/backend/distributed/clock/causal_clock.c b/src/backend/distributed/clock/causal_clock.c index 74c87bad46b..3d64757e3a3 100644 --- a/src/backend/distributed/clock/causal_clock.c +++ b/src/backend/distributed/clock/causal_clock.c @@ -11,36 +11,37 @@ #include #include "postgres.h" -#include "miscadmin.h" + #include "fmgr.h" #include "funcapi.h" #include "libpq-fe.h" +#include "miscadmin.h" -#include "utils/builtins.h" -#include "utils/datum.h" -#include "utils/numeric.h" -#include "utils/typcache.h" -#include "nodes/pg_list.h" #include "catalog/namespace.h" #include "commands/extension.h" #include "commands/sequence.h" #include "executor/spi.h" +#include "nodes/pg_list.h" #include "postmaster/postmaster.h" #include "storage/ipc.h" #include "storage/lwlock.h" +#include "storage/s_lock.h" #include "storage/shmem.h" #include "storage/spin.h" -#include "storage/s_lock.h" +#include "utils/builtins.h" +#include "utils/datum.h" +#include "utils/numeric.h" +#include "utils/typcache.h" #include "distributed/causal_clock.h" +#include "distributed/citus_safe_lib.h" +#include "distributed/coordinator_protocol.h" #include "distributed/listutils.h" -#include "distributed/lock_graph.h" #include "distributed/local_executor.h" +#include "distributed/lock_graph.h" #include "distributed/metadata_cache.h" -#include "distributed/remote_commands.h" #include "distributed/placement_connection.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/citus_safe_lib.h" +#include "distributed/remote_commands.h" #define SAVE_AND_PERSIST(c) \ do { \ diff --git a/src/backend/distributed/commands/alter_table.c b/src/backend/distributed/commands/alter_table.c index 8c2736a28db..a81f23ad6b5 100644 --- a/src/backend/distributed/commands/alter_table.c +++ b/src/backend/distributed/commands/alter_table.c @@ -34,9 +34,16 @@ #include "catalog/pg_am.h" #include "catalog/pg_depend.h" #include "catalog/pg_rewrite_d.h" +#include "commands/defrem.h" +#include "executor/spi.h" +#include "nodes/pg_list.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + #include "columnar/columnar.h" #include "columnar/columnar_tableam.h" -#include "commands/defrem.h" + #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" @@ -57,16 +64,11 @@ #include "distributed/reference_table_utils.h" #include "distributed/relation_access_tracking.h" #include "distributed/replication_origin_session_utils.h" -#include "distributed/shared_library_init.h" #include "distributed/shard_utils.h" +#include "distributed/shared_library_init.h" #include "distributed/tenant_schema_metadata.h" #include "distributed/worker_protocol.h" #include "distributed/worker_transaction.h" -#include "executor/spi.h" -#include "nodes/pg_list.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" /* Table Conversion Types */ diff --git a/src/backend/distributed/commands/begin.c b/src/backend/distributed/commands/begin.c index 3ff28ac20da..b19b044849d 100644 --- a/src/backend/distributed/commands/begin.c +++ b/src/backend/distributed/commands/begin.c @@ -9,12 +9,14 @@ */ #include "postgres.h" + #include "c.h" +#include "nodes/parsenodes.h" + #include "distributed/commands.h" #include "distributed/listutils.h" #include "distributed/transaction_management.h" -#include "nodes/parsenodes.h" /* diff --git a/src/backend/distributed/commands/call.c b/src/backend/distributed/commands/call.c index 12a1d93b84a..9e54513c694 100644 --- a/src/backend/distributed/commands/call.c +++ b/src/backend/distributed/commands/call.c @@ -11,12 +11,23 @@ */ #include "postgres.h" -#include "funcapi.h" -#include "pg_version_constants.h" +#include "funcapi.h" +#include "miscadmin.h" #include "catalog/pg_proc.h" #include "commands/defrem.h" +#include "nodes/nodeFuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/primnodes.h" +#include "optimizer/clauses.h" +#include "tcop/dest.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + +#include "distributed/adaptive_executor.h" #include "distributed/backend_data.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" @@ -26,27 +37,17 @@ #include "distributed/connection_management.h" #include "distributed/deparse_shard_query.h" #include "distributed/function_call_delegation.h" -#include "distributed/metadata_utility.h" #include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_physical_planner.h" -#include "distributed/adaptive_executor.h" #include "distributed/reference_table_utils.h" #include "distributed/remote_commands.h" -#include "distributed/reference_table_utils.h" #include "distributed/shard_pruning.h" #include "distributed/tuple_destination.h" #include "distributed/version_compat.h" -#include "distributed/worker_manager.h" #include "distributed/worker_log_messages.h" -#include "optimizer/clauses.h" -#include "nodes/nodeFuncs.h" -#include "nodes/parsenodes.h" -#include "nodes/primnodes.h" -#include "miscadmin.h" -#include "tcop/dest.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" +#include "distributed/worker_manager.h" /* global variable tracking whether we are in a delegated procedure call */ diff --git a/src/backend/distributed/commands/cascade_table_operation_for_connected_relations.c b/src/backend/distributed/commands/cascade_table_operation_for_connected_relations.c index 9b22fb161dd..c88367462bd 100644 --- a/src/backend/distributed/commands/cascade_table_operation_for_connected_relations.c +++ b/src/backend/distributed/commands/cascade_table_operation_for_connected_relations.c @@ -12,12 +12,19 @@ #include "postgres.h" -#include "pg_version_constants.h" +#include "miscadmin.h" #include "access/xact.h" #include "catalog/pg_constraint.h" -#include "distributed/commands/utility_hook.h" +#include "executor/spi.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/commands.h" +#include "distributed/commands/utility_hook.h" #include "distributed/foreign_key_relationship.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" @@ -26,11 +33,6 @@ #include "distributed/reference_table_utils.h" #include "distributed/relation_access_tracking.h" #include "distributed/worker_protocol.h" -#include "executor/spi.h" -#include "miscadmin.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" static void EnsureSequentialModeForCitusTableCascadeFunction(List *relationIdList); diff --git a/src/backend/distributed/commands/citus_add_local_table_to_metadata.c b/src/backend/distributed/commands/citus_add_local_table_to_metadata.c index c713ce099c7..d95cdd353e0 100644 --- a/src/backend/distributed/commands/citus_add_local_table_to_metadata.c +++ b/src/backend/distributed/commands/citus_add_local_table_to_metadata.c @@ -18,6 +18,7 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "access/genam.h" @@ -25,29 +26,30 @@ #include "catalog/pg_constraint.h" #include "catalog/pg_statistic_ext.h" #include "catalog/pg_trigger.h" -#include "distributed/coordinator_protocol.h" +#include "foreign/foreign.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/ruleutils.h" +#include "utils/syscache.h" + #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/commands/sequence.h" #include "distributed/commands/utility_hook.h" -#include "distributed/metadata/distobject.h" -#include "distributed/metadata/dependency.h" +#include "distributed/coordinator_protocol.h" #include "distributed/foreign_key_relationship.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" +#include "distributed/metadata/dependency.h" +#include "distributed/metadata/distobject.h" #include "distributed/metadata_sync.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/namespace_utils.h" #include "distributed/reference_table_utils.h" #include "distributed/worker_protocol.h" #include "distributed/worker_shard_visibility.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/ruleutils.h" -#include "utils/syscache.h" -#include "foreign/foreign.h" /* diff --git a/src/backend/distributed/commands/citus_global_signal.c b/src/backend/distributed/commands/citus_global_signal.c index b1f4cf187db..23df2d0c19d 100644 --- a/src/backend/distributed/commands/citus_global_signal.c +++ b/src/backend/distributed/commands/citus_global_signal.c @@ -11,14 +11,16 @@ #include "postgres.h" +#include "signal.h" + +#include "lib/stringinfo.h" + #include "pg_version_constants.h" #include "distributed/backend_data.h" #include "distributed/metadata_cache.h" #include "distributed/remote_commands.h" #include "distributed/worker_manager.h" -#include "lib/stringinfo.h" -#include "signal.h" static bool CitusSignalBackend(uint64 globalPID, uint64 timeout, int sig); diff --git a/src/backend/distributed/commands/cluster.c b/src/backend/distributed/commands/cluster.c index cdae6fc0830..7a1dac30256 100644 --- a/src/backend/distributed/commands/cluster.c +++ b/src/backend/distributed/commands/cluster.c @@ -10,11 +10,11 @@ #include "postgres.h" -#include "pg_version_constants.h" - +#include "catalog/namespace.h" #include "commands/defrem.h" -#include "catalog/namespace.h" +#include "pg_version_constants.h" + #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/listutils.h" diff --git a/src/backend/distributed/commands/collation.c b/src/backend/distributed/commands/collation.c index 521ce4b3de6..5ce3d1436cc 100644 --- a/src/backend/distributed/commands/collation.c +++ b/src/backend/distributed/commands/collation.c @@ -10,30 +10,32 @@ */ #include "postgres.h" -#include "pg_version_compat.h" +#include "miscadmin.h" #include "access/htup_details.h" #include "access/xact.h" #include "catalog/pg_collation.h" +#include "parser/parse_type.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "pg_version_compat.h" +#include "pg_version_constants.h" + #include "distributed/citus_safe_lib.h" -#include "distributed/commands/utility_hook.h" #include "distributed/commands.h" +#include "distributed/commands/utility_hook.h" #include "distributed/deparser.h" #include "distributed/listutils.h" -#include "distributed/metadata_utility.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/relation_access_tracking.h" #include "distributed/worker_create_or_replace.h" -#include "pg_version_constants.h" #include "distributed/worker_manager.h" -#include "parser/parse_type.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" -#include "miscadmin.h" static char * CreateCollationDDLInternal(Oid collationId, Oid *collowner, diff --git a/src/backend/distributed/commands/common.c b/src/backend/distributed/commands/common.c index 797981d47d3..347a99e8af4 100644 --- a/src/backend/distributed/commands/common.c +++ b/src/backend/distributed/commands/common.c @@ -23,9 +23,9 @@ #include "distributed/commands/utility_hook.h" #include "distributed/deparser.h" #include "distributed/listutils.h" -#include "distributed/metadata_sync.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata_sync.h" #include "distributed/multi_executor.h" #include "distributed/worker_transaction.h" diff --git a/src/backend/distributed/commands/create_distributed_table.c b/src/backend/distributed/commands/create_distributed_table.c index 768e20b7337..9f3975a1e2e 100644 --- a/src/backend/distributed/commands/create_distributed_table.c +++ b/src/backend/distributed/commands/create_distributed_table.c @@ -9,10 +9,8 @@ */ #include "postgres.h" -#include "miscadmin.h" -#include "pg_version_constants.h" -#include "distributed/commands/utility_hook.h" +#include "miscadmin.h" #include "access/genam.h" #include "access/hash.h" @@ -37,21 +35,46 @@ #include "commands/sequence.h" #include "commands/tablecmds.h" #include "commands/trigger.h" -#include "distributed/commands/multi_copy.h" +#include "executor/executor.h" +#include "executor/spi.h" +#include "nodes/execnodes.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/pg_list.h" +#include "parser/parse_expr.h" +#include "parser/parse_node.h" +#include "parser/parse_relation.h" +#include "parser/parser.h" +#include "postmaster/postmaster.h" +#include "storage/lmgr.h" +#include "tcop/pquery.h" +#include "tcop/tcopprot.h" +#include "utils/builtins.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" +#include "utils/rel.h" +#include "utils/snapmgr.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" +#include "distributed/commands/multi_copy.h" +#include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparser.h" #include "distributed/distributed_execution_locks.h" #include "distributed/distribution_column.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_logical_planner.h" #include "distributed/multi_partitioning_utils.h" @@ -67,33 +90,11 @@ #include "distributed/shard_split.h" #include "distributed/shard_transfer.h" #include "distributed/shared_library_init.h" -#include "distributed/shard_rebalancer.h" +#include "distributed/utils/distribution_column_map.h" +#include "distributed/version_compat.h" #include "distributed/worker_protocol.h" #include "distributed/worker_shard_visibility.h" #include "distributed/worker_transaction.h" -#include "distributed/utils/distribution_column_map.h" -#include "distributed/version_compat.h" -#include "executor/executor.h" -#include "executor/spi.h" -#include "nodes/execnodes.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/pg_list.h" -#include "parser/parse_expr.h" -#include "parser/parse_node.h" -#include "parser/parse_relation.h" -#include "parser/parser.h" -#include "postmaster/postmaster.h" -#include "storage/lmgr.h" -#include "tcop/pquery.h" -#include "tcop/tcopprot.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" -#include "utils/rel.h" -#include "utils/snapmgr.h" -#include "utils/syscache.h" -#include "utils/inval.h" /* common params that apply to all Citus table types */ diff --git a/src/backend/distributed/commands/database.c b/src/backend/distributed/commands/database.c index 944ff627d4e..c8dd06f26e5 100644 --- a/src/backend/distributed/commands/database.c +++ b/src/backend/distributed/commands/database.c @@ -11,12 +11,13 @@ #include "postgres.h" +#include "miscadmin.h" + #include "access/htup_details.h" #include "access/xact.h" #include "catalog/objectaddress.h" #include "catalog/pg_database.h" #include "commands/dbcommands.h" -#include "miscadmin.h" #include "nodes/parsenodes.h" #include "utils/syscache.h" diff --git a/src/backend/distributed/commands/dependencies.c b/src/backend/distributed/commands/dependencies.c index e309ee86c7d..d7c2b4532e0 100644 --- a/src/backend/distributed/commands/dependencies.c +++ b/src/backend/distributed/commands/dependencies.c @@ -10,9 +10,14 @@ #include "postgres.h" +#include "miscadmin.h" + #include "catalog/dependency.h" #include "catalog/objectaddress.h" #include "commands/extension.h" +#include "storage/lmgr.h" +#include "utils/lsyscache.h" + #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/connection_management.h" @@ -25,9 +30,6 @@ #include "distributed/remote_commands.h" #include "distributed/worker_manager.h" #include "distributed/worker_transaction.h" -#include "miscadmin.h" -#include "storage/lmgr.h" -#include "utils/lsyscache.h" static void EnsureDependenciesCanBeDistributed(const ObjectAddress *relationAddress); diff --git a/src/backend/distributed/commands/distribute_object_ops.c b/src/backend/distributed/commands/distribute_object_ops.c index f27e4cca6d8..c1a7ad26139 100644 --- a/src/backend/distributed/commands/distribute_object_ops.c +++ b/src/backend/distributed/commands/distribute_object_ops.c @@ -12,11 +12,12 @@ #include "postgres.h" +#include "pg_version_constants.h" + #include "distributed/commands.h" +#include "distributed/commands/utility_hook.h" #include "distributed/deparser.h" -#include "pg_version_constants.h" #include "distributed/version_compat.h" -#include "distributed/commands/utility_hook.h" static DistributeObjectOps NoDistributeOps = { .deparse = NULL, diff --git a/src/backend/distributed/commands/drop_distributed_table.c b/src/backend/distributed/commands/drop_distributed_table.c index 26579cd60ea..c3d488b09bf 100644 --- a/src/backend/distributed/commands/drop_distributed_table.c +++ b/src/backend/distributed/commands/drop_distributed_table.c @@ -9,20 +9,21 @@ */ #include "postgres.h" + #include "miscadmin.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" #include "distributed/colocation_utils.h" -#include "distributed/commands/utility_hook.h" #include "distributed/commands.h" -#include "distributed/metadata_utility.h" +#include "distributed/commands/utility_hook.h" #include "distributed/coordinator_protocol.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/tenant_schema_metadata.h" #include "distributed/worker_transaction.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" /* local function forward declarations */ diff --git a/src/backend/distributed/commands/extension.c b/src/backend/distributed/commands/extension.c index 5bddf1ede4e..36267ff6656 100644 --- a/src/backend/distributed/commands/extension.c +++ b/src/backend/distributed/commands/extension.c @@ -12,32 +12,35 @@ #include "access/genam.h" #include "access/xact.h" -#include "citus_version.h" #include "catalog/dependency.h" #include "catalog/pg_depend.h" #include "catalog/pg_extension_d.h" -#include "columnar/columnar.h" #include "catalog/pg_foreign_data_wrapper.h" #include "commands/defrem.h" #include "commands/extension.h" +#include "foreign/foreign.h" +#include "nodes/makefuncs.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "citus_version.h" + +#include "columnar/columnar.h" + #include "distributed/citus_ruleutils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparser.h" #include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/metadata_sync.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata_sync.h" #include "distributed/multi_executor.h" #include "distributed/relation_access_tracking.h" #include "distributed/transaction_management.h" -#include "foreign/foreign.h" -#include "nodes/makefuncs.h" -#include "utils/lsyscache.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/syscache.h" /* Local functions forward declarations for helper functions */ diff --git a/src/backend/distributed/commands/foreign_constraint.c b/src/backend/distributed/commands/foreign_constraint.c index 709287c5661..c1f2b83b6ca 100644 --- a/src/backend/distributed/commands/foreign_constraint.c +++ b/src/backend/distributed/commands/foreign_constraint.c @@ -12,35 +12,36 @@ #include "postgres.h" -#include "pg_version_constants.h" +#include "miscadmin.h" +#include "access/genam.h" #include "access/htup_details.h" #include "access/sysattr.h" #include "access/xact.h" #include "catalog/namespace.h" #include "catalog/pg_constraint.h" -#include "access/genam.h" #include "catalog/pg_type.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" +#include "utils/relcache.h" +#include "utils/ruleutils.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/commands/sequence.h" #include "distributed/coordinator_protocol.h" #include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/multi_join_order.h" #include "distributed/namespace_utils.h" #include "distributed/reference_table_utils.h" #include "distributed/utils/array_type.h" #include "distributed/version_compat.h" -#include "miscadmin.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/inval.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" -#include "utils/relcache.h" -#include "utils/ruleutils.h" -#include "utils/syscache.h" #define BehaviorIsRestrictOrNoAction(x) \ diff --git a/src/backend/distributed/commands/foreign_data_wrapper.c b/src/backend/distributed/commands/foreign_data_wrapper.c index c9a08c41a7e..a181e63a733 100644 --- a/src/backend/distributed/commands/foreign_data_wrapper.c +++ b/src/backend/distributed/commands/foreign_data_wrapper.c @@ -11,17 +11,18 @@ #include "postgres.h" #include "catalog/pg_foreign_data_wrapper.h" -#include "distributed/commands/utility_hook.h" -#include "distributed/commands.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" -#include "distributed/metadata_sync.h" -#include "distributed/metadata/distobject.h" #include "foreign/foreign.h" #include "nodes/makefuncs.h" #include "nodes/parsenodes.h" #include "utils/syscache.h" +#include "distributed/commands.h" +#include "distributed/commands/utility_hook.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" +#include "distributed/metadata/distobject.h" +#include "distributed/metadata_sync.h" + static bool NameListHasFDWOwnedByDistributedExtension(List *FDWNames); static ObjectAddress GetObjectAddressByFDWName(char *FDWName, bool missing_ok); diff --git a/src/backend/distributed/commands/foreign_server.c b/src/backend/distributed/commands/foreign_server.c index 7d19f9336e9..d2e5755643d 100644 --- a/src/backend/distributed/commands/foreign_server.c +++ b/src/backend/distributed/commands/foreign_server.c @@ -9,11 +9,18 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "catalog/pg_foreign_server.h" -#include "distributed/commands/utility_hook.h" +#include "foreign/foreign.h" +#include "nodes/makefuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/primnodes.h" +#include "utils/builtins.h" + #include "distributed/commands.h" +#include "distributed/commands/utility_hook.h" #include "distributed/deparser.h" #include "distributed/listutils.h" #include "distributed/log_utils.h" @@ -21,11 +28,6 @@ #include "distributed/metadata_sync.h" #include "distributed/multi_executor.h" #include "distributed/worker_transaction.h" -#include "foreign/foreign.h" -#include "nodes/makefuncs.h" -#include "nodes/parsenodes.h" -#include "nodes/primnodes.h" -#include "utils/builtins.h" static char * GetForeignServerAlterOwnerCommand(Oid serverId); static Node * RecreateForeignServerStmt(Oid serverId); diff --git a/src/backend/distributed/commands/function.c b/src/backend/distributed/commands/function.c index 7010416734e..b76a6d5bf7d 100644 --- a/src/backend/distributed/commands/function.c +++ b/src/backend/distributed/commands/function.c @@ -18,35 +18,47 @@ */ #include "postgres.h" -#include "miscadmin.h" -#include "funcapi.h" -#include "pg_version_constants.h" +#include "funcapi.h" +#include "miscadmin.h" #include "access/genam.h" #include "access/htup_details.h" #include "access/xact.h" -#include "catalog/pg_aggregate.h" #include "catalog/dependency.h" #include "catalog/namespace.h" +#include "catalog/pg_aggregate.h" #include "catalog/pg_proc.h" #include "catalog/pg_type.h" #include "commands/extension.h" +#include "nodes/makefuncs.h" +#include "parser/parse_coerce.h" +#include "parser/parse_type.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/fmgrprotos.h" +#include "utils/lsyscache.h" +#include "utils/regproc.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_depended_object.h" #include "distributed/citus_ruleutils.h" #include "distributed/citus_safe_lib.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparser.h" #include "distributed/listutils.h" #include "distributed/maintenanced.h" -#include "distributed/metadata_utility.h" #include "distributed/metadata/dependency.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata/pg_dist_object.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/namespace_utils.h" #include "distributed/pg_dist_node.h" @@ -55,16 +67,6 @@ #include "distributed/version_compat.h" #include "distributed/worker_create_or_replace.h" #include "distributed/worker_transaction.h" -#include "nodes/makefuncs.h" -#include "parser/parse_coerce.h" -#include "parser/parse_type.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/fmgrprotos.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" -#include "utils/regproc.h" #define DISABLE_LOCAL_CHECK_FUNCTION_BODIES "SET LOCAL check_function_bodies TO off;" #define RESET_CHECK_FUNCTION_BODIES "RESET check_function_bodies;" diff --git a/src/backend/distributed/commands/grant.c b/src/backend/distributed/commands/grant.c index c7861060ab2..c4278cee1bd 100644 --- a/src/backend/distributed/commands/grant.c +++ b/src/backend/distributed/commands/grant.c @@ -10,15 +10,16 @@ #include "postgres.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" +#include "utils/lsyscache.h" + #include "distributed/citus_ruleutils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata_cache.h" #include "distributed/version_compat.h" -#include "lib/stringinfo.h" -#include "nodes/parsenodes.h" -#include "utils/lsyscache.h" /* Local functions forward declarations for helper functions */ diff --git a/src/backend/distributed/commands/index.c b/src/backend/distributed/commands/index.c index 0b5cfb8120b..a7420285734 100644 --- a/src/backend/distributed/commands/index.c +++ b/src/backend/distributed/commands/index.c @@ -10,7 +10,6 @@ #include "postgres.h" -#include "pg_version_constants.h" #include "access/genam.h" #include "access/htup_details.h" #include "access/xact.h" @@ -18,40 +17,44 @@ #include "catalog/index.h" #include "catalog/namespace.h" #include "catalog/pg_class.h" + +#include "pg_version_constants.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "catalog/pg_namespace.h" #endif +#include "miscadmin.h" + #include "commands/defrem.h" #include "commands/tablecmds.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" +#include "parser/parse_utilcmd.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + #include "distributed/citus_ruleutils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparse_shard_query.h" #include "distributed/deparser.h" #include "distributed/distributed_planner.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" -#include "distributed/multi_physical_planner.h" #include "distributed/multi_partitioning_utils.h" +#include "distributed/multi_physical_planner.h" #include "distributed/namespace_utils.h" -#include "distributed/resource_lock.h" #include "distributed/relation_access_tracking.h" #include "distributed/relation_utils.h" +#include "distributed/resource_lock.h" #include "distributed/version_compat.h" #include "distributed/worker_manager.h" -#include "lib/stringinfo.h" -#include "miscadmin.h" -#include "nodes/parsenodes.h" -#include "parser/parse_utilcmd.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/inval.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" /* Local functions forward declarations for helper functions */ diff --git a/src/backend/distributed/commands/local_multi_copy.c b/src/backend/distributed/commands/local_multi_copy.c index 7dbf0ae3626..13ff8835336 100644 --- a/src/backend/distributed/commands/local_multi_copy.c +++ b/src/backend/distributed/commands/local_multi_copy.c @@ -19,24 +19,27 @@ *------------------------------------------------------------------------- */ +#include /* for htons */ + #include "postgres.h" -#include "commands/copy.h" + +#include "safe_lib.h" + #include "catalog/namespace.h" +#include "commands/copy.h" +#include "nodes/makefuncs.h" #include "parser/parse_relation.h" #include "utils/lsyscache.h" -#include "nodes/makefuncs.h" -#include "safe_lib.h" -#include /* for htons */ -#include "distributed/transmit.h" #include "distributed/commands/multi_copy.h" #include "distributed/intermediate_results.h" -#include "distributed/multi_partitioning_utils.h" #include "distributed/local_executor.h" #include "distributed/local_multi_copy.h" +#include "distributed/multi_partitioning_utils.h" +#include "distributed/replication_origin_session_utils.h" #include "distributed/shard_utils.h" +#include "distributed/transmit.h" #include "distributed/version_compat.h" -#include "distributed/replication_origin_session_utils.h" /* managed via GUC, default is 512 kB */ int LocalCopyFlushThresholdByte = 512 * 1024; diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index a5c7a47f43b..aaff24a10f5 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -43,19 +43,18 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" -#include "libpq-fe.h" -#include "miscadmin.h" -#include "pgstat.h" - #include /* for htons */ #include /* for htons */ #include -#include "pg_version_constants.h" +#include "postgres.h" + +#include "libpq-fe.h" +#include "miscadmin.h" +#include "pgstat.h" -#include "access/htup_details.h" #include "access/htup.h" +#include "access/htup_details.h" #include "access/sdir.h" #include "access/sysattr.h" #include "access/xact.h" @@ -65,41 +64,30 @@ #include "commands/copy.h" #include "commands/defrem.h" #include "commands/progress.h" + +#include "pg_version_constants.h" + #include "distributed/citus_safe_lib.h" #include "distributed/commands/multi_copy.h" #include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/intermediate_results.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" +#include "distributed/locally_reserved_shared_connections.h" #include "distributed/log_utils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/multi_physical_planner.h" #include "distributed/multi_router_planner.h" -#include "distributed/multi_executor.h" -#include "distributed/listutils.h" -#include "distributed/locally_reserved_shared_connections.h" #include "distributed/placement_connection.h" #include "distributed/relation_access_tracking.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "distributed/relation_utils.h" #endif -#include "distributed/remote_commands.h" -#include "distributed/remote_transaction.h" -#include "distributed/replication_origin_session_utils.h" -#include "distributed/resource_lock.h" -#include "distributed/shard_pruning.h" -#include "distributed/shared_connection_stats.h" -#include "distributed/version_compat.h" -#include "distributed/worker_protocol.h" -#include "distributed/local_multi_copy.h" -#include "distributed/hash_helpers.h" -#include "distributed/transmit.h" #include "executor/executor.h" #include "foreign/foreign.h" - #include "libpq/libpq.h" #include "libpq/pqformat.h" #include "nodes/makefuncs.h" @@ -110,9 +98,21 @@ #include "tsearch/ts_locale.h" #include "utils/builtins.h" #include "utils/lsyscache.h" +#include "utils/memutils.h" #include "utils/rel.h" #include "utils/syscache.h" -#include "utils/memutils.h" + +#include "distributed/hash_helpers.h" +#include "distributed/local_multi_copy.h" +#include "distributed/remote_commands.h" +#include "distributed/remote_transaction.h" +#include "distributed/replication_origin_session_utils.h" +#include "distributed/resource_lock.h" +#include "distributed/shard_pruning.h" +#include "distributed/shared_connection_stats.h" +#include "distributed/transmit.h" +#include "distributed/version_compat.h" +#include "distributed/worker_protocol.h" /* constant used in binary protocol */ diff --git a/src/backend/distributed/commands/owned.c b/src/backend/distributed/commands/owned.c index c8f6a4bbe09..3b4b043f80b 100644 --- a/src/backend/distributed/commands/owned.c +++ b/src/backend/distributed/commands/owned.c @@ -10,42 +10,43 @@ #include "postgres.h" +#include "miscadmin.h" + +#include "access/genam.h" #include "access/heapam.h" #include "access/htup_details.h" -#include "access/genam.h" #include "access/table.h" #include "access/xact.h" #include "catalog/catalog.h" +#include "catalog/objectaddress.h" #include "catalog/pg_auth_members.h" #include "catalog/pg_authid.h" #include "catalog/pg_db_role_setting.h" #include "catalog/pg_type.h" -#include "catalog/objectaddress.h" #include "commands/dbcommands.h" +#include "nodes/makefuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "parser/scansup.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/rel.h" +#include "utils/syscache.h" +#include "utils/varlena.h" + #include "distributed/citus_ruleutils.h" #include "distributed/citus_safe_lib.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparser.h" #include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata_sync.h" -#include "distributed/metadata/distobject.h" #include "distributed/multi_executor.h" #include "distributed/relation_access_tracking.h" #include "distributed/version_compat.h" #include "distributed/worker_transaction.h" -#include "miscadmin.h" -#include "nodes/makefuncs.h" -#include "nodes/parsenodes.h" -#include "nodes/pg_list.h" -#include "parser/scansup.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/rel.h" -#include "utils/varlena.h" -#include "utils/syscache.h" /* * PreprocessDropOwnedStmt finds the distributed role out of the ones diff --git a/src/backend/distributed/commands/policy.c b/src/backend/distributed/commands/policy.c index 0d66e150e86..a2a926b6677 100644 --- a/src/backend/distributed/commands/policy.c +++ b/src/backend/distributed/commands/policy.c @@ -10,15 +10,10 @@ */ #include "postgres.h" +#include "miscadmin.h" + #include "catalog/namespace.h" #include "commands/policy.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/commands.h" -#include "distributed/commands/utility_hook.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/listutils.h" -#include "distributed/metadata_cache.h" -#include "miscadmin.h" #include "nodes/makefuncs.h" #include "parser/parse_clause.h" #include "parser/parse_relation.h" @@ -27,6 +22,13 @@ #include "utils/builtins.h" #include "utils/ruleutils.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/commands.h" +#include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" + static const char * unparse_policy_command(const char aclchar); static RowSecurityPolicy * GetPolicyByName(Oid relationId, const char *policyName); diff --git a/src/backend/distributed/commands/publication.c b/src/backend/distributed/commands/publication.c index f225b0fca59..c1cfd5e7732 100644 --- a/src/backend/distributed/commands/publication.c +++ b/src/backend/distributed/commands/publication.c @@ -9,18 +9,11 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "catalog/pg_publication.h" #include "catalog/pg_publication_rel.h" -#include "distributed/commands.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" -#include "distributed/metadata_utility.h" -#include "distributed/metadata_sync.h" -#include "distributed/metadata/distobject.h" -#include "distributed/reference_table_utils.h" -#include "distributed/worker_create_or_replace.h" #include "nodes/makefuncs.h" #include "nodes/parsenodes.h" #include "utils/builtins.h" @@ -29,6 +22,15 @@ #include "pg_version_compat.h" +#include "distributed/commands.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" +#include "distributed/metadata/distobject.h" +#include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" +#include "distributed/reference_table_utils.h" +#include "distributed/worker_create_or_replace.h" + static CreatePublicationStmt * BuildCreatePublicationStmt(Oid publicationId); #if (PG_VERSION_NUM >= PG_VERSION_15) diff --git a/src/backend/distributed/commands/rename.c b/src/backend/distributed/commands/rename.c index 5e313d68c3a..362fc57bb1b 100644 --- a/src/backend/distributed/commands/rename.c +++ b/src/backend/distributed/commands/rename.c @@ -12,11 +12,12 @@ #include "catalog/index.h" #include "catalog/namespace.h" +#include "nodes/parsenodes.h" +#include "utils/lsyscache.h" + #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/metadata_cache.h" -#include "nodes/parsenodes.h" -#include "utils/lsyscache.h" /* diff --git a/src/backend/distributed/commands/role.c b/src/backend/distributed/commands/role.c index a2da3bf81b4..4e731274449 100644 --- a/src/backend/distributed/commands/role.c +++ b/src/backend/distributed/commands/role.c @@ -10,49 +10,49 @@ #include "postgres.h" -#include "pg_version_compat.h" - -#include "pg_version_constants.h" +#include "miscadmin.h" +#include "access/genam.h" #include "access/heapam.h" #include "access/htup_details.h" -#include "access/genam.h" #include "access/table.h" #include "access/xact.h" #include "catalog/catalog.h" +#include "catalog/objectaddress.h" #include "catalog/pg_auth_members.h" #include "catalog/pg_authid.h" #include "catalog/pg_db_role_setting.h" #include "catalog/pg_type.h" -#include "catalog/objectaddress.h" #include "commands/dbcommands.h" +#include "nodes/makefuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "parser/scansup.h" +#include "utils/acl.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/guc.h" +#include "utils/guc_tables.h" +#include "utils/rel.h" +#include "utils/syscache.h" +#include "utils/varlena.h" + +#include "pg_version_compat.h" +#include "pg_version_constants.h" + #include "distributed/citus_ruleutils.h" #include "distributed/citus_safe_lib.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparser.h" #include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata_sync.h" -#include "distributed/metadata/distobject.h" #include "distributed/multi_executor.h" #include "distributed/relation_access_tracking.h" #include "distributed/version_compat.h" #include "distributed/worker_transaction.h" -#include "miscadmin.h" -#include "nodes/makefuncs.h" -#include "nodes/parsenodes.h" -#include "nodes/pg_list.h" -#include "parser/scansup.h" -#include "utils/acl.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/guc_tables.h" -#include "utils/guc.h" -#include "utils/rel.h" -#include "utils/varlena.h" -#include "utils/syscache.h" static const char * ExtractEncryptedPassword(Oid roleOid); static const char * CreateAlterRoleIfExistsCommand(AlterRoleStmt *stmt); diff --git a/src/backend/distributed/commands/schema.c b/src/backend/distributed/commands/schema.c index d48a73647b8..7f79897faed 100644 --- a/src/backend/distributed/commands/schema.c +++ b/src/backend/distributed/commands/schema.c @@ -19,27 +19,27 @@ #include "catalog/namespace.h" #include "catalog/pg_class.h" #include "catalog/pg_namespace.h" +#include "nodes/parsenodes.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/relcache.h" + #include "distributed/colocation_utils.h" #include "distributed/commands.h" -#include #include "distributed/commands/utility_hook.h" +#include "distributed/connection_management.h" #include "distributed/deparser.h" #include "distributed/listutils.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata_cache.h" -#include +#include "distributed/metadata_sync.h" #include "distributed/multi_executor.h" #include "distributed/reference_table_utils.h" #include "distributed/relation_access_tracking.h" +#include "distributed/remote_commands.h" #include "distributed/resource_lock.h" -#include -#include #include "distributed/tenant_schema_metadata.h" #include "distributed/version_compat.h" -#include "nodes/parsenodes.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/relcache.h" static List * GetObjectAddressBySchemaName(char *schemaName, bool missing_ok); diff --git a/src/backend/distributed/commands/schema_based_sharding.c b/src/backend/distributed/commands/schema_based_sharding.c index 65d2b812726..7cde9698295 100644 --- a/src/backend/distributed/commands/schema_based_sharding.c +++ b/src/backend/distributed/commands/schema_based_sharding.c @@ -7,27 +7,29 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "access/genam.h" #include "catalog/catalog.h" #include "catalog/pg_namespace_d.h" #include "commands/extension.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + #include "distributed/argutils.h" #include "distributed/backend_data.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/listutils.h" -#include "distributed/metadata_sync.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata_sync.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/shard_transfer.h" #include "distributed/tenant_schema_metadata.h" #include "distributed/worker_shard_visibility.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" /* return value of CreateCitusMoveSchemaParams() */ diff --git a/src/backend/distributed/commands/sequence.c b/src/backend/distributed/commands/sequence.c index 9ff586c8c2d..4d838a882a5 100644 --- a/src/backend/distributed/commands/sequence.c +++ b/src/backend/distributed/commands/sequence.c @@ -16,6 +16,12 @@ #include "catalog/namespace.h" #include "commands/defrem.h" #include "commands/extension.h" +#include "nodes/makefuncs.h" +#include "nodes/parsenodes.h" +#include "rewrite/rewriteHandler.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" + #include "distributed/commands.h" #include "distributed/commands/sequence.h" #include "distributed/commands/utility_hook.h" @@ -24,12 +30,7 @@ #include "distributed/metadata/distobject.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" -#include "nodes/makefuncs.h" #include "distributed/worker_create_or_replace.h" -#include "nodes/parsenodes.h" -#include "rewrite/rewriteHandler.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" /* Local functions forward declarations for helper functions */ static bool OptionsSpecifyOwnedBy(List *optionList, Oid *ownedByTableId); diff --git a/src/backend/distributed/commands/statistics.c b/src/backend/distributed/commands/statistics.c index dae72ada9c8..5fac767fd70 100644 --- a/src/backend/distributed/commands/statistics.c +++ b/src/backend/distributed/commands/statistics.c @@ -19,6 +19,8 @@ #include "postgres.h" +#include "miscadmin.h" + #include "access/genam.h" #include "access/htup_details.h" #include "access/xact.h" @@ -26,8 +28,16 @@ #include "catalog/pg_namespace.h" #include "catalog/pg_statistic_ext.h" #include "catalog/pg_type.h" -#include "distributed/commands/utility_hook.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/fmgrprotos.h" +#include "utils/lsyscache.h" +#include "utils/relcache.h" +#include "utils/ruleutils.h" +#include "utils/syscache.h" + #include "distributed/commands.h" +#include "distributed/commands/utility_hook.h" #include "distributed/deparse_shard_query.h" #include "distributed/deparser.h" #include "distributed/listutils.h" @@ -37,14 +47,6 @@ #include "distributed/relation_access_tracking.h" #include "distributed/resource_lock.h" #include "distributed/worker_transaction.h" -#include "miscadmin.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/fmgrprotos.h" -#include "utils/lsyscache.h" -#include "utils/relcache.h" -#include "utils/ruleutils.h" -#include "utils/syscache.h" #define DEFAULT_STATISTICS_TARGET -1 #define ALTER_INDEX_COLUMN_SET_STATS_COMMAND \ diff --git a/src/backend/distributed/commands/subscription.c b/src/backend/distributed/commands/subscription.c index 52519b68057..f5f80d17a68 100644 --- a/src/backend/distributed/commands/subscription.c +++ b/src/backend/distributed/commands/subscription.c @@ -8,20 +8,22 @@ *------------------------------------------------------------------------- */ +#include + #include "postgres.h" +#include "libpq-fe.h" #include "safe_lib.h" -#include - #include "commands/defrem.h" +#include "nodes/parsenodes.h" +#include "utils/builtins.h" + +#include "pg_version_constants.h" + #include "distributed/commands.h" #include "distributed/connection_management.h" -#include "pg_version_constants.h" #include "distributed/version_compat.h" -#include "libpq-fe.h" -#include "nodes/parsenodes.h" -#include "utils/builtins.h" static char * GenerateConninfoWithAuth(char *conninfo); diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index e8404d38c3d..074a789ed20 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -9,7 +9,7 @@ */ #include "postgres.h" -#include "pg_version_constants.h" + #include "access/genam.h" #include "access/htup_details.h" #include "access/xact.h" @@ -20,38 +20,41 @@ #include "catalog/pg_depend.h" #include "catalog/pg_type.h" #include "commands/tablecmds.h" +#include "foreign/foreign.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" +#include "parser/parse_expr.h" +#include "parser/parse_type.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/coordinator_protocol.h" -#include "distributed/deparser.h" #include "distributed/deparse_shard_query.h" +#include "distributed/deparser.h" #include "distributed/distribution_column.h" #include "distributed/foreign_key_relationship.h" -#include "distributed/local_executor.h" #include "distributed/listutils.h" -#include "distributed/metadata_sync.h" +#include "distributed/local_executor.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata_sync.h" #include "distributed/multi_executor.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/reference_table_utils.h" #include "distributed/relation_access_tracking.h" #include "distributed/resource_lock.h" +#include "distributed/tenant_schema_metadata.h" #include "distributed/version_compat.h" #include "distributed/worker_shard_visibility.h" -#include "distributed/tenant_schema_metadata.h" -#include "foreign/foreign.h" -#include "lib/stringinfo.h" -#include "nodes/parsenodes.h" -#include "parser/parse_expr.h" -#include "parser/parse_type.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" /* controlled via GUC, should be accessed via GetEnableLocalReferenceForeignKeys() */ diff --git a/src/backend/distributed/commands/text_search.c b/src/backend/distributed/commands/text_search.c index 54dfdae8546..4a386e3210e 100644 --- a/src/backend/distributed/commands/text_search.c +++ b/src/backend/distributed/commands/text_search.c @@ -10,6 +10,8 @@ #include "postgres.h" +#include "fmgr.h" + #include "access/genam.h" #include "access/xact.h" #include "catalog/namespace.h" @@ -22,7 +24,6 @@ #include "commands/comment.h" #include "commands/defrem.h" #include "commands/extension.h" -#include "fmgr.h" #include "nodes/makefuncs.h" #include "tsearch/ts_cache.h" #include "tsearch/ts_public.h" diff --git a/src/backend/distributed/commands/trigger.c b/src/backend/distributed/commands/trigger.c index 0ec8287f5f0..74cb6259ffb 100644 --- a/src/backend/distributed/commands/trigger.c +++ b/src/backend/distributed/commands/trigger.c @@ -9,7 +9,6 @@ *------------------------------------------------------------------------- */ #include "postgres.h" -#include "pg_version_constants.h" #include "access/genam.h" #include "access/table.h" @@ -18,6 +17,14 @@ #include "catalog/pg_trigger.h" #include "commands/extension.h" #include "commands/trigger.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/fmgrprotos.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/coordinator_protocol.h" @@ -29,11 +36,6 @@ #include "distributed/namespace_utils.h" #include "distributed/shard_utils.h" #include "distributed/worker_protocol.h" -#include "utils/builtins.h" -#include "utils/fmgrprotos.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" /* appropriate lock modes for the owner relation according to postgres */ diff --git a/src/backend/distributed/commands/truncate.c b/src/backend/distributed/commands/truncate.c index 4de518a062b..0eb43f529cd 100644 --- a/src/backend/distributed/commands/truncate.c +++ b/src/backend/distributed/commands/truncate.c @@ -9,12 +9,19 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "catalog/namespace.h" #include "catalog/pg_class.h" #include "commands/tablecmds.h" #include "commands/trigger.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/regproc.h" +#include "utils/rel.h" + #include "distributed/adaptive_executor.h" #include "distributed/citus_ruleutils.h" #include "distributed/commands.h" @@ -31,13 +38,8 @@ #include "distributed/reference_table_utils.h" #include "distributed/resource_lock.h" #include "distributed/transaction_management.h" -#include "distributed/worker_transaction.h" #include "distributed/worker_shard_visibility.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/regproc.h" -#include "utils/rel.h" +#include "distributed/worker_transaction.h" /* Local functions forward declarations for unsupported command checks */ diff --git a/src/backend/distributed/commands/type.c b/src/backend/distributed/commands/type.c index ccb7bf5282c..b1e57363828 100644 --- a/src/backend/distributed/commands/type.c +++ b/src/backend/distributed/commands/type.c @@ -43,7 +43,7 @@ #include "postgres.h" -#include "pg_version_constants.h" +#include "miscadmin.h" #include "access/genam.h" #include "access/htup_details.h" @@ -52,6 +52,18 @@ #include "catalog/pg_enum.h" #include "catalog/pg_type.h" #include "commands/extension.h" +#include "nodes/makefuncs.h" +#include "parser/parse_type.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/regproc.h" +#include "utils/syscache.h" +#include "utils/typcache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_safe_lib.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" @@ -64,20 +76,10 @@ #include "distributed/relation_access_tracking.h" #include "distributed/remote_commands.h" #include "distributed/transaction_management.h" -#include "distributed/worker_create_or_replace.h" #include "distributed/version_compat.h" +#include "distributed/worker_create_or_replace.h" #include "distributed/worker_manager.h" #include "distributed/worker_transaction.h" -#include "miscadmin.h" -#include "nodes/makefuncs.h" -#include "parser/parse_type.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/regproc.h" -#include "utils/syscache.h" -#include "utils/typcache.h" #define AlterEnumIsRename(stmt) (stmt->oldVal != NULL) #define AlterEnumIsAddValue(stmt) (stmt->oldVal == NULL) diff --git a/src/backend/distributed/commands/utility_hook.c b/src/backend/distributed/commands/utility_hook.c index afc8fa9fd7b..0ed76a08f15 100644 --- a/src/backend/distributed/commands/utility_hook.c +++ b/src/backend/distributed/commands/utility_hook.c @@ -25,9 +25,8 @@ *------------------------------------------------------------------------- */ -#include "pg_version_constants.h" - #include "postgres.h" + #include "miscadmin.h" #include "access/attnum.h" @@ -35,11 +34,25 @@ #include "access/htup_details.h" #include "catalog/catalog.h" #include "catalog/dependency.h" -#include "citus_version.h" #include "commands/dbcommands.h" #include "commands/defrem.h" #include "commands/extension.h" #include "commands/tablecmds.h" +#include "foreign/foreign.h" +#include "lib/stringinfo.h" +#include "nodes/makefuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "tcop/utility.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "citus_version.h" +#include "pg_version_constants.h" + #include "distributed/adaptive_executor.h" #include "distributed/backend_data.h" #include "distributed/citus_depended_object.h" @@ -48,19 +61,19 @@ #include "distributed/commands/multi_copy.h" #include "distributed/commands/utility_hook.h" /* IWYU pragma: keep */ #include "distributed/coordinator_protocol.h" -#include "distributed/deparser.h" #include "distributed/deparse_shard_query.h" +#include "distributed/deparser.h" #include "distributed/executor_util.h" #include "distributed/foreign_key_relationship.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" #include "distributed/maintenanced.h" -#include "distributed/multi_logical_replication.h" -#include "distributed/multi_partitioning_utils.h" -#include "distributed/metadata_sync.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata_sync.h" #include "distributed/multi_executor.h" #include "distributed/multi_explain.h" +#include "distributed/multi_logical_replication.h" +#include "distributed/multi_partitioning_utils.h" #include "distributed/multi_physical_planner.h" #include "distributed/reference_table_utils.h" #include "distributed/resource_lock.h" @@ -69,17 +82,6 @@ #include "distributed/version_compat.h" #include "distributed/worker_shard_visibility.h" #include "distributed/worker_transaction.h" -#include "foreign/foreign.h" -#include "lib/stringinfo.h" -#include "nodes/parsenodes.h" -#include "nodes/pg_list.h" -#include "nodes/makefuncs.h" -#include "tcop/utility.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/inval.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" bool EnableDDLPropagation = true; /* ddl propagation is enabled */ diff --git a/src/backend/distributed/commands/vacuum.c b/src/backend/distributed/commands/vacuum.c index f1cf3cb31ac..5988a447ddf 100644 --- a/src/backend/distributed/commands/vacuum.c +++ b/src/backend/distributed/commands/vacuum.c @@ -10,10 +10,16 @@ #include "postgres.h" -#include "pg_version_constants.h" - +#include "access/xact.h" #include "commands/defrem.h" #include "commands/vacuum.h" +#include "postmaster/bgworker_internals.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" + +#include "pg_version_constants.h" + #include "distributed/adaptive_executor.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" @@ -24,11 +30,6 @@ #include "distributed/resource_lock.h" #include "distributed/transaction_management.h" #include "distributed/version_compat.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "postmaster/bgworker_internals.h" -#include "access/xact.h" #define VACUUM_PARALLEL_NOTSET -2 diff --git a/src/backend/distributed/commands/variableset.c b/src/backend/distributed/commands/variableset.c index 277f5b63f98..2a3bc2f67ca 100644 --- a/src/backend/distributed/commands/variableset.c +++ b/src/backend/distributed/commands/variableset.c @@ -9,21 +9,23 @@ */ #include "postgres.h" + #include "c.h" #include "common/string.h" +#include "lib/ilist.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/varlena.h" + #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/metadata_cache.h" +#include "distributed/remote_commands.h" #include "distributed/resource_lock.h" #include "distributed/transaction_management.h" #include "distributed/version_compat.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "lib/ilist.h" -#include "utils/varlena.h" -#include "distributed/remote_commands.h" /* * ShouldPropagateSetCommand determines whether a SET or RESET command should be diff --git a/src/backend/distributed/commands/view.c b/src/backend/distributed/commands/view.c index 7c4816144ac..0c39be4ca30 100644 --- a/src/backend/distributed/commands/view.c +++ b/src/backend/distributed/commands/view.c @@ -9,31 +9,33 @@ */ #include "postgres.h" + #include "fmgr.h" #include "access/genam.h" #include "catalog/objectaddress.h" #include "commands/extension.h" -#include "distributed/commands.h" +#include "executor/spi.h" +#include "nodes/nodes.h" +#include "nodes/pg_list.h" +#include "tcop/utility.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + #include "distributed/citus_ruleutils.h" +#include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/deparser.h" #include "distributed/errormessage.h" #include "distributed/listutils.h" -#include "distributed/metadata_sync.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata_sync.h" #include "distributed/multi_executor.h" #include "distributed/namespace_utils.h" #include "distributed/worker_transaction.h" -#include "executor/spi.h" -#include "nodes/nodes.h" -#include "nodes/pg_list.h" -#include "tcop/utility.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" /* * GUC controls some restrictions for local objects. For example, diff --git a/src/backend/distributed/connection/connection_configuration.c b/src/backend/distributed/connection/connection_configuration.c index bf61f7fac37..c6a34a9d714 100644 --- a/src/backend/distributed/connection/connection_configuration.c +++ b/src/backend/distributed/connection/connection_configuration.c @@ -12,6 +12,10 @@ #include "access/transam.h" #include "access/xact.h" +#include "mb/pg_wchar.h" +#include "postmaster/postmaster.h" +#include "utils/builtins.h" + #include "distributed/backend_data.h" #include "distributed/citus_safe_lib.h" #include "distributed/connection_management.h" @@ -19,10 +23,6 @@ #include "distributed/metadata_cache.h" #include "distributed/worker_manager.h" -#include "postmaster/postmaster.h" -#include "mb/pg_wchar.h" -#include "utils/builtins.h" - /* stores the string representation of our node connection GUC */ #ifdef USE_SSL char *NodeConninfo = "sslmode=require"; diff --git a/src/backend/distributed/connection/connection_management.c b/src/backend/distributed/connection/connection_management.c index 9439b38c5fb..64ec1904fc0 100644 --- a/src/backend/distributed/connection/connection_management.c +++ b/src/backend/distributed/connection/connection_management.c @@ -9,39 +9,39 @@ */ #include "postgres.h" -#include "pgstat.h" #include "libpq-fe.h" - #include "miscadmin.h" - +#include "pg_config.h" +#include "pgstat.h" #include "safe_lib.h" -#include "postmaster/postmaster.h" + #include "access/hash.h" #include "commands/dbcommands.h" +#include "mb/pg_wchar.h" +#include "portability/instr_time.h" +#include "postmaster/postmaster.h" +#include "storage/ipc.h" +#include "utils/hsearch.h" +#include "utils/memutils.h" + #include "distributed/backend_data.h" +#include "distributed/cancel_utils.h" #include "distributed/connection_management.h" -#include "distributed/errormessage.h" #include "distributed/error_codes.h" +#include "distributed/errormessage.h" +#include "distributed/hash_helpers.h" #include "distributed/listutils.h" #include "distributed/log_utils.h" #include "distributed/memutils.h" #include "distributed/metadata_cache.h" -#include "distributed/hash_helpers.h" #include "distributed/placement_connection.h" +#include "distributed/remote_commands.h" #include "distributed/run_from_same_connection.h" #include "distributed/shared_connection_stats.h" -#include "distributed/cancel_utils.h" -#include "distributed/remote_commands.h" #include "distributed/time_constants.h" #include "distributed/version_compat.h" #include "distributed/worker_log_messages.h" -#include "mb/pg_wchar.h" -#include "pg_config.h" -#include "portability/instr_time.h" -#include "storage/ipc.h" -#include "utils/hsearch.h" -#include "utils/memutils.h" int NodeConnectionTimeout = 30000; diff --git a/src/backend/distributed/connection/locally_reserved_shared_connections.c b/src/backend/distributed/connection/locally_reserved_shared_connections.c index 0a27ba17c69..a64930b3296 100644 --- a/src/backend/distributed/connection/locally_reserved_shared_connections.c +++ b/src/backend/distributed/connection/locally_reserved_shared_connections.c @@ -33,12 +33,15 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "miscadmin.h" #include "access/hash.h" #include "commands/dbcommands.h" +#include "common/hashfn.h" +#include "utils/builtins.h" + +#include "pg_version_constants.h" + #include "distributed/listutils.h" #include "distributed/locally_reserved_shared_connections.h" #include "distributed/metadata_cache.h" @@ -47,8 +50,6 @@ #include "distributed/shared_connection_stats.h" #include "distributed/tuplestore.h" #include "distributed/worker_manager.h" -#include "utils/builtins.h" -#include "common/hashfn.h" #define RESERVED_CONNECTION_COLUMNS 4 diff --git a/src/backend/distributed/connection/placement_connection.c b/src/backend/distributed/connection/placement_connection.c index 3924e5a0579..10c99bd8074 100644 --- a/src/backend/distributed/connection/placement_connection.c +++ b/src/backend/distributed/connection/placement_connection.c @@ -11,23 +11,24 @@ #include "postgres.h" +#include "access/hash.h" +#include "common/hashfn.h" +#include "utils/hsearch.h" +#include "utils/memutils.h" + #include "pg_version_constants.h" -#include "access/hash.h" #include "distributed/colocation_utils.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/distributed_planner.h" #include "distributed/hash_helpers.h" #include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" -#include "distributed/distributed_planner.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/placement_connection.h" #include "distributed/relation_access_tracking.h" -#include "utils/hsearch.h" -#include "common/hashfn.h" -#include "utils/memutils.h" /* diff --git a/src/backend/distributed/connection/remote_commands.c b/src/backend/distributed/connection/remote_commands.c index 15dd985ec3f..f694ff3901f 100644 --- a/src/backend/distributed/connection/remote_commands.c +++ b/src/backend/distributed/connection/remote_commands.c @@ -9,24 +9,24 @@ */ #include "postgres.h" -#include "pgstat.h" #include "libpq-fe.h" +#include "miscadmin.h" +#include "pgstat.h" -#include "distributed/connection_management.h" -#include "distributed/errormessage.h" -#include "distributed/listutils.h" -#include "distributed/log_utils.h" -#include "distributed/remote_commands.h" -#include "distributed/errormessage.h" -#include "distributed/cancel_utils.h" #include "lib/stringinfo.h" -#include "miscadmin.h" #include "storage/latch.h" #include "utils/builtins.h" #include "utils/fmgrprotos.h" #include "utils/palloc.h" +#include "distributed/cancel_utils.h" +#include "distributed/connection_management.h" +#include "distributed/errormessage.h" +#include "distributed/listutils.h" +#include "distributed/log_utils.h" +#include "distributed/remote_commands.h" + /* * Setting that controls how many bytes of COPY data libpq is allowed to buffer diff --git a/src/backend/distributed/connection/shared_connection_stats.c b/src/backend/distributed/connection/shared_connection_stats.c index 104caed079a..26598b465f2 100644 --- a/src/backend/distributed/connection/shared_connection_stats.c +++ b/src/backend/distributed/connection/shared_connection_stats.c @@ -11,18 +11,21 @@ */ #include "postgres.h" -#include "pgstat.h" - -#include "pg_version_constants.h" #include "libpq-fe.h" - #include "miscadmin.h" +#include "pgstat.h" #include "access/hash.h" #include "access/htup_details.h" #include "catalog/pg_authid.h" #include "commands/dbcommands.h" +#include "common/hashfn.h" +#include "storage/ipc.h" +#include "utils/builtins.h" + +#include "pg_version_constants.h" + #include "distributed/backend_data.h" #include "distributed/cancel_utils.h" #include "distributed/connection_management.h" @@ -32,12 +35,9 @@ #include "distributed/multi_executor.h" #include "distributed/placement_connection.h" #include "distributed/shared_connection_stats.h" -#include "distributed/worker_manager.h" #include "distributed/time_constants.h" #include "distributed/tuplestore.h" -#include "utils/builtins.h" -#include "common/hashfn.h" -#include "storage/ipc.h" +#include "distributed/worker_manager.h" #define REMOTE_CONNECTION_STATS_COLUMNS 4 diff --git a/src/backend/distributed/connection/worker_log_messages.c b/src/backend/distributed/connection/worker_log_messages.c index 9c240620e8e..9b64b81a62d 100644 --- a/src/backend/distributed/connection/worker_log_messages.c +++ b/src/backend/distributed/connection/worker_log_messages.c @@ -10,12 +10,13 @@ #include "postgres.h" +#include "utils/elog.h" + #include "distributed/connection_management.h" #include "distributed/error_codes.h" #include "distributed/errormessage.h" #include "distributed/log_utils.h" #include "distributed/worker_log_messages.h" -#include "utils/elog.h" /* diff --git a/src/backend/distributed/deparser/citus_grantutils.c b/src/backend/distributed/deparser/citus_grantutils.c index 8e0dadff2f2..c944013f6d2 100644 --- a/src/backend/distributed/deparser/citus_grantutils.c +++ b/src/backend/distributed/deparser/citus_grantutils.c @@ -1,8 +1,10 @@ #include "postgres.h" + #include "lib/stringinfo.h" #include "nodes/parsenodes.h" -#include "distributed/deparser.h" + #include "distributed/citus_ruleutils.h" +#include "distributed/deparser.h" /* * Append the 'WITH GRANT OPTION' clause to the given buffer if the given diff --git a/src/backend/distributed/deparser/citus_ruleutils.c b/src/backend/distributed/deparser/citus_ruleutils.c index 1456f2fb54c..f99462058d9 100644 --- a/src/backend/distributed/deparser/citus_ruleutils.c +++ b/src/backend/distributed/deparser/citus_ruleutils.c @@ -7,12 +7,11 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" -#include "miscadmin.h" +#include -#include "pg_version_constants.h" +#include "postgres.h" -#include +#include "miscadmin.h" #include "access/attnum.h" #include "access/genam.h" @@ -39,21 +38,11 @@ #include "catalog/pg_type.h" #include "commands/defrem.h" #include "commands/extension.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/commands.h" -#include "distributed/listutils.h" -#include "distributed/multi_partitioning_utils.h" -#include "distributed/metadata_cache.h" -#include "distributed/metadata_sync.h" -#include "distributed/metadata_utility.h" -#include "distributed/namespace_utils.h" -#include "distributed/relay_utility.h" -#include "distributed/version_compat.h" -#include "distributed/worker_protocol.h" +#include "commands/sequence.h" #include "foreign/foreign.h" #include "lib/stringinfo.h" -#include "nodes/nodes.h" #include "nodes/nodeFuncs.h" +#include "nodes/nodes.h" #include "nodes/parsenodes.h" #include "nodes/pg_list.h" #include "parser/parse_utilcmd.h" @@ -71,7 +60,20 @@ #include "utils/relcache.h" #include "utils/ruleutils.h" #include "utils/syscache.h" -#include "commands/sequence.h" + +#include "pg_version_constants.h" + +#include "distributed/citus_ruleutils.h" +#include "distributed/commands.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" +#include "distributed/multi_partitioning_utils.h" +#include "distributed/namespace_utils.h" +#include "distributed/relay_utility.h" +#include "distributed/version_compat.h" +#include "distributed/worker_protocol.h" static void deparse_index_columns(StringInfo buffer, List *indexParameterList, diff --git a/src/backend/distributed/deparser/citus_setutils.c b/src/backend/distributed/deparser/citus_setutils.c index 481a2860b33..c113a47d504 100644 --- a/src/backend/distributed/deparser/citus_setutils.c +++ b/src/backend/distributed/deparser/citus_setutils.c @@ -1,18 +1,18 @@ #include "postgres.h" -#include "pg_version_compat.h" - #include "catalog/namespace.h" +#include "commands/defrem.h" #include "lib/stringinfo.h" #include "nodes/parsenodes.h" +#include "nodes/print.h" +#include "parser/parse_type.h" #include "utils/builtins.h" -#include "distributed/deparser.h" +#include "pg_version_compat.h" + #include "distributed/citus_ruleutils.h" -#include "commands/defrem.h" +#include "distributed/deparser.h" #include "distributed/log_utils.h" -#include "parser/parse_type.h" -#include "nodes/print.h" void AppendVarSetValue(StringInfo buf, VariableSetStmt *setStmt); diff --git a/src/backend/distributed/deparser/deparse_collation_stmts.c b/src/backend/distributed/deparser/deparse_collation_stmts.c index 44f7f9098ee..3a568d2ad42 100644 --- a/src/backend/distributed/deparser/deparse_collation_stmts.c +++ b/src/backend/distributed/deparser/deparse_collation_stmts.c @@ -17,8 +17,8 @@ #include "nodes/value.h" #include "utils/builtins.h" -#include "distributed/deparser.h" #include "distributed/citus_ruleutils.h" +#include "distributed/deparser.h" static void AppendDropCollationStmt(StringInfo buf, DropStmt *stmt); static void AppendRenameCollationStmt(StringInfo buf, RenameStmt *stmt); diff --git a/src/backend/distributed/deparser/deparse_database_stmts.c b/src/backend/distributed/deparser/deparse_database_stmts.c index d3d3ce633ad..ef9925d72cf 100644 --- a/src/backend/distributed/deparser/deparse_database_stmts.c +++ b/src/backend/distributed/deparser/deparse_database_stmts.c @@ -11,19 +11,18 @@ #include "postgres.h" -#include "pg_version_compat.h" - #include "catalog/namespace.h" +#include "commands/defrem.h" #include "lib/stringinfo.h" #include "nodes/parsenodes.h" +#include "parser/parse_type.h" #include "utils/builtins.h" -#include "distributed/deparser.h" +#include "pg_version_compat.h" + #include "distributed/citus_ruleutils.h" -#include "commands/defrem.h" #include "distributed/deparser.h" #include "distributed/log_utils.h" -#include "parser/parse_type.h" static void AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt); diff --git a/src/backend/distributed/deparser/deparse_extension_stmts.c b/src/backend/distributed/deparser/deparse_extension_stmts.c index bb6b15dbd86..92d54602f06 100644 --- a/src/backend/distributed/deparser/deparse_extension_stmts.c +++ b/src/backend/distributed/deparser/deparse_extension_stmts.c @@ -14,13 +14,14 @@ #include "catalog/namespace.h" #include "commands/defrem.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" #include "lib/stringinfo.h" #include "nodes/parsenodes.h" #include "nodes/pg_list.h" #include "utils/builtins.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" + /* Local functions forward declarations for helper functions */ static void AppendCreateExtensionStmt(StringInfo buf, CreateExtensionStmt *stmt); static void AppendCreateExtensionStmtOptions(StringInfo buf, List *options); diff --git a/src/backend/distributed/deparser/deparse_foreign_data_wrapper_stmts.c b/src/backend/distributed/deparser/deparse_foreign_data_wrapper_stmts.c index 3f755c90586..fab1cc7ab05 100644 --- a/src/backend/distributed/deparser/deparse_foreign_data_wrapper_stmts.c +++ b/src/backend/distributed/deparser/deparse_foreign_data_wrapper_stmts.c @@ -10,13 +10,14 @@ #include "postgres.h" #include "commands/defrem.h" +#include "lib/stringinfo.h" +#include "nodes/nodes.h" +#include "utils/builtins.h" + #include "distributed/citus_ruleutils.h" #include "distributed/deparser.h" #include "distributed/listutils.h" #include "distributed/relay_utility.h" -#include "lib/stringinfo.h" -#include "nodes/nodes.h" -#include "utils/builtins.h" static void AppendGrantOnFDWStmt(StringInfo buf, GrantStmt *stmt); static void AppendGrantOnFDWNames(StringInfo buf, GrantStmt *stmt); diff --git a/src/backend/distributed/deparser/deparse_foreign_server_stmts.c b/src/backend/distributed/deparser/deparse_foreign_server_stmts.c index 403569b948e..9c708a771a7 100644 --- a/src/backend/distributed/deparser/deparse_foreign_server_stmts.c +++ b/src/backend/distributed/deparser/deparse_foreign_server_stmts.c @@ -10,13 +10,14 @@ #include "postgres.h" #include "commands/defrem.h" +#include "lib/stringinfo.h" +#include "nodes/nodes.h" +#include "utils/builtins.h" + #include "distributed/citus_ruleutils.h" #include "distributed/deparser.h" #include "distributed/listutils.h" #include "distributed/relay_utility.h" -#include "lib/stringinfo.h" -#include "nodes/nodes.h" -#include "utils/builtins.h" static void AppendCreateForeignServerStmt(StringInfo buf, CreateForeignServerStmt *stmt); static void AppendAlterForeignServerStmt(StringInfo buf, AlterForeignServerStmt *stmt); diff --git a/src/backend/distributed/deparser/deparse_function_stmts.c b/src/backend/distributed/deparser/deparse_function_stmts.c index a5bc52e5a5a..1e3e4a651a8 100644 --- a/src/backend/distributed/deparser/deparse_function_stmts.c +++ b/src/backend/distributed/deparser/deparse_function_stmts.c @@ -22,10 +22,6 @@ #include "catalog/pg_proc.h" #include "catalog/pg_type.h" #include "commands/defrem.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/commands.h" -#include "distributed/deparser.h" -#include "distributed/version_compat.h" #include "lib/stringinfo.h" #include "nodes/makefuncs.h" #include "nodes/nodes.h" @@ -38,8 +34,13 @@ #include "utils/guc.h" #include "utils/lsyscache.h" #include "utils/memutils.h" -#include "utils/syscache.h" #include "utils/regproc.h" +#include "utils/syscache.h" + +#include "distributed/citus_ruleutils.h" +#include "distributed/commands.h" +#include "distributed/deparser.h" +#include "distributed/version_compat.h" /* forward declaration for deparse functions */ diff --git a/src/backend/distributed/deparser/deparse_owned_stmts.c b/src/backend/distributed/deparser/deparse_owned_stmts.c index 888071165f8..af7fa0968d7 100644 --- a/src/backend/distributed/deparser/deparse_owned_stmts.c +++ b/src/backend/distributed/deparser/deparse_owned_stmts.c @@ -11,13 +11,14 @@ #include "postgres.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" +#include "utils/builtins.h" + #include "pg_version_compat.h" #include "distributed/citus_ruleutils.h" #include "distributed/deparser.h" -#include "lib/stringinfo.h" -#include "nodes/parsenodes.h" -#include "utils/builtins.h" static void AppendDropOwnedStmt(StringInfo buf, DropOwnedStmt *stmt); static void AppendRoleList(StringInfo buf, List *roleList); diff --git a/src/backend/distributed/deparser/deparse_publication_stmts.c b/src/backend/distributed/deparser/deparse_publication_stmts.c index e2233314634..8e311817199 100644 --- a/src/backend/distributed/deparser/deparse_publication_stmts.c +++ b/src/backend/distributed/deparser/deparse_publication_stmts.c @@ -13,20 +13,21 @@ #include "access/relation.h" #include "catalog/namespace.h" #include "commands/defrem.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" -#include "distributed/namespace_utils.h" #include "lib/stringinfo.h" +#include "nodes/value.h" #include "parser/parse_clause.h" #include "parser/parse_collate.h" #include "parser/parse_node.h" #include "parser/parse_relation.h" -#include "nodes/value.h" #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/ruleutils.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" +#include "distributed/namespace_utils.h" + static void AppendCreatePublicationStmt(StringInfo buf, CreatePublicationStmt *stmt, bool whereClauseNeedsTransform, diff --git a/src/backend/distributed/deparser/deparse_role_stmts.c b/src/backend/distributed/deparser/deparse_role_stmts.c index ee216809e7c..4bbb2e43865 100644 --- a/src/backend/distributed/deparser/deparse_role_stmts.c +++ b/src/backend/distributed/deparser/deparse_role_stmts.c @@ -13,15 +13,16 @@ #include "postgres.h" +#include "commands/defrem.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" +#include "utils/builtins.h" + #include "pg_version_compat.h" -#include "commands/defrem.h" #include "distributed/citus_ruleutils.h" #include "distributed/deparser.h" #include "distributed/listutils.h" -#include "lib/stringinfo.h" -#include "nodes/parsenodes.h" -#include "utils/builtins.h" static void AppendAlterRoleStmt(StringInfo buf, AlterRoleStmt *stmt); static void AppendAlterRoleSetStmt(StringInfo buf, AlterRoleSetStmt *stmt); diff --git a/src/backend/distributed/deparser/deparse_schema_stmts.c b/src/backend/distributed/deparser/deparse_schema_stmts.c index 10317b89971..0a9c49801aa 100644 --- a/src/backend/distributed/deparser/deparse_schema_stmts.c +++ b/src/backend/distributed/deparser/deparse_schema_stmts.c @@ -12,13 +12,14 @@ */ #include "postgres.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" #include "lib/stringinfo.h" #include "nodes/nodes.h" #include "utils/builtins.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" + static void AppendCreateSchemaStmt(StringInfo buf, CreateSchemaStmt *stmt); static void AppendDropSchemaStmt(StringInfo buf, DropStmt *stmt); static void AppendGrantOnSchemaStmt(StringInfo buf, GrantStmt *stmt); diff --git a/src/backend/distributed/deparser/deparse_sequence_stmts.c b/src/backend/distributed/deparser/deparse_sequence_stmts.c index 98488c16013..9e5fab2c815 100644 --- a/src/backend/distributed/deparser/deparse_sequence_stmts.c +++ b/src/backend/distributed/deparser/deparse_sequence_stmts.c @@ -14,12 +14,13 @@ #include "postgres.h" #include "catalog/namespace.h" -#include "distributed/deparser.h" -#include "distributed/version_compat.h" #include "utils/acl.h" #include "utils/builtins.h" #include "utils/lsyscache.h" +#include "distributed/deparser.h" +#include "distributed/version_compat.h" + /* forward declaration for deparse functions */ static void AppendDropSequenceStmt(StringInfo buf, DropStmt *stmt); diff --git a/src/backend/distributed/deparser/deparse_statistics_stmts.c b/src/backend/distributed/deparser/deparse_statistics_stmts.c index 599738dc5bc..99b9d1c2ddf 100644 --- a/src/backend/distributed/deparser/deparse_statistics_stmts.c +++ b/src/backend/distributed/deparser/deparse_statistics_stmts.c @@ -12,16 +12,17 @@ */ #include "postgres.h" +#include "catalog/namespace.h" +#include "lib/stringinfo.h" +#include "nodes/nodes.h" +#include "utils/builtins.h" + #include "pg_version_constants.h" -#include "catalog/namespace.h" #include "distributed/citus_ruleutils.h" #include "distributed/deparser.h" #include "distributed/listutils.h" #include "distributed/relay_utility.h" -#include "lib/stringinfo.h" -#include "nodes/nodes.h" -#include "utils/builtins.h" static void AppendCreateStatisticsStmt(StringInfo buf, CreateStatsStmt *stmt); static void AppendDropStatisticsStmt(StringInfo buf, List *nameList, bool ifExists); diff --git a/src/backend/distributed/deparser/deparse_table_stmts.c b/src/backend/distributed/deparser/deparse_table_stmts.c index ff96d7fc336..e976b0e2f17 100644 --- a/src/backend/distributed/deparser/deparse_table_stmts.c +++ b/src/backend/distributed/deparser/deparse_table_stmts.c @@ -13,20 +13,20 @@ #include "catalog/heap.h" #include "commands/defrem.h" -#include "distributed/commands.h" -#include "distributed/deparser.h" -#include "distributed/version_compat.h" +#include "commands/tablecmds.h" #include "nodes/nodes.h" #include "nodes/parsenodes.h" #include "parser/parse_expr.h" -#include "parser/parse_type.h" #include "parser/parse_relation.h" +#include "parser/parse_type.h" #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/ruleutils.h" +#include "distributed/commands.h" +#include "distributed/deparser.h" #include "distributed/namespace_utils.h" -#include "commands/tablecmds.h" +#include "distributed/version_compat.h" static void AppendAlterTableSchemaStmt(StringInfo buf, AlterObjectSchemaStmt *stmt); static void AppendAlterTableStmt(StringInfo buf, AlterTableStmt *stmt); diff --git a/src/backend/distributed/deparser/deparse_view_stmts.c b/src/backend/distributed/deparser/deparse_view_stmts.c index 39c4ccb6369..5592aec9d53 100644 --- a/src/backend/distributed/deparser/deparse_view_stmts.c +++ b/src/backend/distributed/deparser/deparse_view_stmts.c @@ -13,15 +13,16 @@ #include "catalog/namespace.h" #include "commands/defrem.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/commands.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" #include "lib/stringinfo.h" #include "nodes/parsenodes.h" #include "utils/builtins.h" #include "utils/lsyscache.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/commands.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" + static void AppendDropViewStmt(StringInfo buf, DropStmt *stmt); static void AppendViewNameList(StringInfo buf, List *objects); static void AppendAlterViewStmt(StringInfo buf, AlterTableStmt *stmt); diff --git a/src/backend/distributed/deparser/objectaddress.c b/src/backend/distributed/deparser/objectaddress.c index d835a3b1abf..6718c22cf7f 100644 --- a/src/backend/distributed/deparser/objectaddress.c +++ b/src/backend/distributed/deparser/objectaddress.c @@ -12,11 +12,12 @@ #include "postgres.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_extension_d.h" #include "commands/extension.h" + #include "distributed/commands.h" #include "distributed/deparser.h" -#include "catalog/objectaddress.h" -#include "catalog/pg_extension_d.h" /* diff --git a/src/backend/distributed/deparser/qualify_aggregate_stmts.c b/src/backend/distributed/deparser/qualify_aggregate_stmts.c index 9debc244a22..e5d7210f316 100644 --- a/src/backend/distributed/deparser/qualify_aggregate_stmts.c +++ b/src/backend/distributed/deparser/qualify_aggregate_stmts.c @@ -15,10 +15,11 @@ #include "postgres.h" #include "catalog/namespace.h" -#include "distributed/deparser.h" #include "nodes/makefuncs.h" #include "utils/lsyscache.h" +#include "distributed/deparser.h" + void QualifyDefineAggregateStmt(Node *node) { diff --git a/src/backend/distributed/deparser/qualify_function_stmt.c b/src/backend/distributed/deparser/qualify_function_stmt.c index fbd6c17a0b7..184ff92bf70 100644 --- a/src/backend/distributed/deparser/qualify_function_stmt.c +++ b/src/backend/distributed/deparser/qualify_function_stmt.c @@ -21,12 +21,13 @@ #include "access/htup_details.h" #include "catalog/namespace.h" #include "catalog/pg_proc.h" -#include "distributed/deparser.h" -#include "distributed/version_compat.h" #include "parser/parse_func.h" #include "utils/lsyscache.h" #include "utils/syscache.h" +#include "distributed/deparser.h" +#include "distributed/version_compat.h" + /* forward declaration for qualify functions */ static void QualifyFunction(ObjectWithArgs *func, ObjectType type); static void QualifyFunctionSchemaName(ObjectWithArgs *func, ObjectType type); diff --git a/src/backend/distributed/deparser/qualify_publication_stmt.c b/src/backend/distributed/deparser/qualify_publication_stmt.c index 3231fe363b2..73ffe3a3533 100644 --- a/src/backend/distributed/deparser/qualify_publication_stmt.c +++ b/src/backend/distributed/deparser/qualify_publication_stmt.c @@ -12,12 +12,13 @@ #include "postgres.h" #include "catalog/namespace.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" #include "nodes/nodes.h" #include "utils/guc.h" #include "utils/lsyscache.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" + #if (PG_VERSION_NUM >= PG_VERSION_15) static void QualifyPublicationObjects(List *publicationObjects); #else diff --git a/src/backend/distributed/deparser/qualify_role_stmt.c b/src/backend/distributed/deparser/qualify_role_stmt.c index 93a958ea9e6..cffb7ac4c1a 100644 --- a/src/backend/distributed/deparser/qualify_role_stmt.c +++ b/src/backend/distributed/deparser/qualify_role_stmt.c @@ -17,10 +17,11 @@ #include "postgres.h" -#include "distributed/deparser.h" #include "nodes/nodes.h" #include "utils/guc.h" +#include "distributed/deparser.h" + static void QualifyVarSetCurrent(VariableSetStmt *setStmt); diff --git a/src/backend/distributed/deparser/qualify_sequence_stmt.c b/src/backend/distributed/deparser/qualify_sequence_stmt.c index 384e0c95383..1a0ecc8319b 100644 --- a/src/backend/distributed/deparser/qualify_sequence_stmt.c +++ b/src/backend/distributed/deparser/qualify_sequence_stmt.c @@ -17,12 +17,13 @@ #include "postgres.h" +#include "parser/parse_func.h" +#include "utils/lsyscache.h" + #include "distributed/commands.h" #include "distributed/deparser.h" #include "distributed/listutils.h" #include "distributed/version_compat.h" -#include "parser/parse_func.h" -#include "utils/lsyscache.h" /* diff --git a/src/backend/distributed/deparser/qualify_statistics_stmt.c b/src/backend/distributed/deparser/qualify_statistics_stmt.c index ce944393002..ba8e8a76496 100644 --- a/src/backend/distributed/deparser/qualify_statistics_stmt.c +++ b/src/backend/distributed/deparser/qualify_statistics_stmt.c @@ -16,15 +16,16 @@ #include "catalog/namespace.h" #include "catalog/pg_statistic_ext.h" -#include "distributed/commands.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" #include "nodes/parsenodes.h" #include "nodes/value.h" -#include "utils/syscache.h" #include "utils/lsyscache.h" #include "utils/rel.h" #include "utils/relcache.h" +#include "utils/syscache.h" + +#include "distributed/commands.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" static Oid GetStatsNamespaceOid(Oid statsOid); diff --git a/src/backend/distributed/deparser/qualify_table_stmt.c b/src/backend/distributed/deparser/qualify_table_stmt.c index 9667c4c798d..e760ff3885a 100644 --- a/src/backend/distributed/deparser/qualify_table_stmt.c +++ b/src/backend/distributed/deparser/qualify_table_stmt.c @@ -23,6 +23,7 @@ #include "utils/lsyscache.h" #include "utils/rel.h" #include "utils/relcache.h" + #include "distributed/deparser.h" void diff --git a/src/backend/distributed/deparser/qualify_type_stmt.c b/src/backend/distributed/deparser/qualify_type_stmt.c index 487e6fc976b..91052b57659 100644 --- a/src/backend/distributed/deparser/qualify_type_stmt.c +++ b/src/backend/distributed/deparser/qualify_type_stmt.c @@ -23,13 +23,14 @@ #include "catalog/namespace.h" #include "catalog/objectaddress.h" #include "catalog/pg_type.h" -#include "distributed/commands.h" -#include "distributed/deparser.h" -#include "distributed/version_compat.h" #include "nodes/makefuncs.h" #include "parser/parse_type.h" -#include "utils/syscache.h" #include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "distributed/commands.h" +#include "distributed/deparser.h" +#include "distributed/version_compat.h" /* * GetTypeNamespaceNameByNameList resolved the schema name of a type by its namelist. diff --git a/src/backend/distributed/deparser/qualify_view_stmt.c b/src/backend/distributed/deparser/qualify_view_stmt.c index 1f450d50aee..af3fb280a8c 100644 --- a/src/backend/distributed/deparser/qualify_view_stmt.c +++ b/src/backend/distributed/deparser/qualify_view_stmt.c @@ -12,12 +12,13 @@ #include "postgres.h" #include "catalog/namespace.h" -#include "distributed/deparser.h" -#include "distributed/listutils.h" #include "nodes/nodes.h" #include "utils/guc.h" #include "utils/lsyscache.h" +#include "distributed/deparser.h" +#include "distributed/listutils.h" + static void QualifyViewRangeVar(RangeVar *view); /* diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index 61a52e7c482..b5566985a38 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -118,32 +118,43 @@ *------------------------------------------------------------------------- */ +#include +#include +#include + #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" #include "pgstat.h" -#include -#include -#include - +#include "access/htup_details.h" #include "access/transam.h" #include "access/xact.h" -#include "access/htup_details.h" #include "catalog/pg_type.h" #include "commands/dbcommands.h" #include "commands/schemacmds.h" +#include "lib/ilist.h" +#include "portability/instr_time.h" +#include "storage/fd.h" +#include "storage/latch.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" +#include "utils/syscache.h" +#include "utils/timestamp.h" + #include "distributed/adaptive_executor.h" +#include "distributed/backend_data.h" #include "distributed/cancel_utils.h" #include "distributed/citus_custom_scan.h" #include "distributed/citus_safe_lib.h" -#include "distributed/connection_management.h" #include "distributed/commands/multi_copy.h" +#include "distributed/connection_management.h" #include "distributed/deparse_shard_query.h" -#include "distributed/executor_util.h" -#include "distributed/shared_connection_stats.h" #include "distributed/distributed_execution_locks.h" +#include "distributed/executor_util.h" #include "distributed/intermediate_result_pruning.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" @@ -161,21 +172,11 @@ #include "distributed/resource_lock.h" #include "distributed/shared_connection_stats.h" #include "distributed/subplan_execution.h" -#include "distributed/transaction_management.h" #include "distributed/transaction_identifier.h" +#include "distributed/transaction_management.h" #include "distributed/tuple_destination.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" -#include "distributed/backend_data.h" -#include "lib/ilist.h" -#include "portability/instr_time.h" -#include "storage/fd.h" -#include "storage/latch.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" -#include "utils/syscache.h" -#include "utils/timestamp.h" #define SLOW_START_DISABLED 0 diff --git a/src/backend/distributed/executor/citus_custom_scan.c b/src/backend/distributed/executor/citus_custom_scan.c index 3403e27ca0e..34a2f3d90bd 100644 --- a/src/backend/distributed/executor/citus_custom_scan.c +++ b/src/backend/distributed/executor/citus_custom_scan.c @@ -9,19 +9,30 @@ */ #include "postgres.h" -#include "pg_version_constants.h" - #include "miscadmin.h" #include "commands/copy.h" +#include "executor/executor.h" +#include "nodes/makefuncs.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "utils/datum.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" +#include "utils/rel.h" + +#include "pg_version_constants.h" + #include "distributed/backend_data.h" #include "distributed/citus_clauses.h" #include "distributed/citus_custom_scan.h" #include "distributed/citus_nodefuncs.h" #include "distributed/citus_ruleutils.h" +#include "distributed/colocation_utils.h" #include "distributed/connection_management.h" #include "distributed/deparse_shard_query.h" #include "distributed/distributed_execution_locks.h" +#include "distributed/function_call_delegation.h" #include "distributed/insert_select_executor.h" #include "distributed/insert_select_planner.h" #include "distributed/listutils.h" @@ -30,23 +41,13 @@ #include "distributed/merge_executor.h" #include "distributed/merge_planner.h" #include "distributed/multi_executor.h" -#include "distributed/multi_server_executor.h" #include "distributed/multi_router_planner.h" +#include "distributed/multi_server_executor.h" #include "distributed/query_stats.h" #include "distributed/shard_utils.h" #include "distributed/subplan_execution.h" #include "distributed/worker_log_messages.h" #include "distributed/worker_protocol.h" -#include "distributed/colocation_utils.h" -#include "distributed/function_call_delegation.h" -#include "executor/executor.h" -#include "nodes/makefuncs.h" -#include "optimizer/optimizer.h" -#include "optimizer/clauses.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" -#include "utils/rel.h" -#include "utils/datum.h" extern AllowedDistributionColumn AllowedDistributionColumnValue; diff --git a/src/backend/distributed/executor/directed_acyclic_graph_execution.c b/src/backend/distributed/executor/directed_acyclic_graph_execution.c index e0d4c9b8125..15b0272ddaf 100644 --- a/src/backend/distributed/executor/directed_acyclic_graph_execution.c +++ b/src/backend/distributed/executor/directed_acyclic_graph_execution.c @@ -8,11 +8,12 @@ */ #include "postgres.h" + #include "access/hash.h" -#include "distributed/hash_helpers.h" #include "distributed/adaptive_executor.h" #include "distributed/directed_acyclic_graph_execution.h" +#include "distributed/hash_helpers.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" #include "distributed/multi_physical_planner.h" diff --git a/src/backend/distributed/executor/distributed_execution_locks.c b/src/backend/distributed/executor/distributed_execution_locks.c index f7d2fd49d6a..4424accb712 100644 --- a/src/backend/distributed/executor/distributed_execution_locks.c +++ b/src/backend/distributed/executor/distributed_execution_locks.c @@ -8,10 +8,10 @@ * Copyright (c) Citus Data, Inc. *------------------------------------------------------------------------- */ +#include "distributed/coordinator_protocol.h" #include "distributed/distributed_execution_locks.h" #include "distributed/executor_util.h" #include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" #include "distributed/multi_partitioning_utils.h" diff --git a/src/backend/distributed/executor/distributed_intermediate_results.c b/src/backend/distributed/executor/distributed_intermediate_results.c index cc351a1fc43..c5ac27fb624 100644 --- a/src/backend/distributed/executor/distributed_intermediate_results.c +++ b/src/backend/distributed/executor/distributed_intermediate_results.c @@ -8,12 +8,11 @@ *------------------------------------------------------------------------- */ -#include "pg_version_constants.h" - #include #include #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" #include "port.h" @@ -21,21 +20,24 @@ #include "access/htup_details.h" #include "access/tupdesc.h" #include "catalog/pg_type.h" +#include "tcop/pquery.h" +#include "tcop/tcopprot.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" + +#include "pg_version_constants.h" + #include "distributed/deparse_shard_query.h" #include "distributed/intermediate_results.h" #include "distributed/listutils.h" -#include "distributed/metadata_utility.h" #include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_physical_planner.h" #include "distributed/transaction_management.h" #include "distributed/tuple_destination.h" #include "distributed/tuplestore.h" #include "distributed/worker_protocol.h" -#include "tcop/pquery.h" -#include "tcop/tcopprot.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" /* diff --git a/src/backend/distributed/executor/executor_util_params.c b/src/backend/distributed/executor/executor_util_params.c index 6b5139bff2b..975654f22d7 100644 --- a/src/backend/distributed/executor/executor_util_params.c +++ b/src/backend/distributed/executor/executor_util_params.c @@ -8,12 +8,14 @@ */ #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" -#include "distributed/executor_util.h" #include "utils/lsyscache.h" +#include "distributed/executor_util.h" + /* * ExtractParametersForRemoteExecution extracts parameter types and values from diff --git a/src/backend/distributed/executor/executor_util_tasks.c b/src/backend/distributed/executor/executor_util_tasks.c index 483fd55a704..6a3eec8fc52 100644 --- a/src/backend/distributed/executor/executor_util_tasks.c +++ b/src/backend/distributed/executor/executor_util_tasks.c @@ -8,6 +8,7 @@ */ #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" diff --git a/src/backend/distributed/executor/executor_util_tuples.c b/src/backend/distributed/executor/executor_util_tuples.c index c5fde9f9097..68f6999566f 100644 --- a/src/backend/distributed/executor/executor_util_tuples.c +++ b/src/backend/distributed/executor/executor_util_tuples.c @@ -8,12 +8,14 @@ */ #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" -#include "distributed/executor_util.h" #include "utils/lsyscache.h" +#include "distributed/executor_util.h" + /* * TupleDescGetAttBinaryInMetadata - Build an AttInMetadata structure based on diff --git a/src/backend/distributed/executor/insert_select_executor.c b/src/backend/distributed/executor/insert_select_executor.c index 4a15289e6dc..f5fbb3f7802 100644 --- a/src/backend/distributed/executor/insert_select_executor.c +++ b/src/backend/distributed/executor/insert_select_executor.c @@ -9,26 +9,42 @@ */ #include "postgres.h" + #include "miscadmin.h" +#include "executor/executor.h" +#include "nodes/execnodes.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/plannodes.h" +#include "parser/parse_coerce.h" +#include "parser/parse_relation.h" +#include "parser/parsetree.h" +#include "tcop/pquery.h" +#include "tcop/tcopprot.h" +#include "utils/lsyscache.h" +#include "utils/portal.h" +#include "utils/rel.h" +#include "utils/snapmgr.h" + +#include "distributed/adaptive_executor.h" #include "distributed/citus_ruleutils.h" #include "distributed/commands/multi_copy.h" -#include "distributed/adaptive_executor.h" #include "distributed/deparse_shard_query.h" #include "distributed/distributed_execution_locks.h" +#include "distributed/distributed_planner.h" #include "distributed/insert_select_executor.h" #include "distributed/insert_select_planner.h" #include "distributed/intermediate_results.h" +#include "distributed/listutils.h" #include "distributed/local_executor.h" #include "distributed/merge_planner.h" +#include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/multi_physical_planner.h" -#include "distributed/listutils.h" -#include "distributed/metadata_cache.h" #include "distributed/multi_router_planner.h" -#include "distributed/local_executor.h" -#include "distributed/distributed_planner.h" #include "distributed/recursive_planning.h" #include "distributed/relation_access_tracking.h" #include "distributed/repartition_executor.h" @@ -37,21 +53,6 @@ #include "distributed/subplan_execution.h" #include "distributed/transaction_management.h" #include "distributed/version_compat.h" -#include "executor/executor.h" -#include "nodes/execnodes.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/parsenodes.h" -#include "nodes/plannodes.h" -#include "parser/parse_coerce.h" -#include "parser/parse_relation.h" -#include "parser/parsetree.h" -#include "tcop/pquery.h" -#include "tcop/tcopprot.h" -#include "utils/lsyscache.h" -#include "utils/portal.h" -#include "utils/rel.h" -#include "utils/snapmgr.h" /* Config variables managed via guc.c */ bool EnableRepartitionedInsertSelect = true; diff --git a/src/backend/distributed/executor/intermediate_results.c b/src/backend/distributed/executor/intermediate_results.c index d17e6521724..0e18d4416f7 100644 --- a/src/backend/distributed/executor/intermediate_results.c +++ b/src/backend/distributed/executor/intermediate_results.c @@ -11,6 +11,7 @@ #include #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" @@ -19,31 +20,32 @@ #include "catalog/pg_enum.h" #include "catalog/pg_type.h" #include "commands/copy.h" +#include "nodes/makefuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/primnodes.h" +#include "storage/fd.h" +#include "tcop/tcopprot.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" +#include "utils/syscache.h" + #include "distributed/commands/multi_copy.h" #include "distributed/connection_management.h" #include "distributed/error_codes.h" #include "distributed/intermediate_results.h" #include "distributed/listutils.h" -#include "distributed/metadata_utility.h" #include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/remote_commands.h" -#include "distributed/transmit.h" #include "distributed/transaction_identifier.h" +#include "distributed/transmit.h" #include "distributed/tuplestore.h" #include "distributed/utils/array_type.h" #include "distributed/utils/directory.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" -#include "nodes/makefuncs.h" -#include "nodes/parsenodes.h" -#include "nodes/primnodes.h" -#include "storage/fd.h" -#include "tcop/tcopprot.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" -#include "utils/syscache.h" static List *CreatedResultsDirectories = NIL; diff --git a/src/backend/distributed/executor/local_executor.c b/src/backend/distributed/executor/local_executor.c index 7168fd314ae..bedaa643e29 100644 --- a/src/backend/distributed/executor/local_executor.c +++ b/src/backend/distributed/executor/local_executor.c @@ -76,36 +76,38 @@ * via coordinator cannot happen via the local execution. */ #include "postgres.h" + #include "miscadmin.h" +#include "executor/tstoreReceiver.h" +#include "executor/tuptable.h" +#include "nodes/params.h" +#include "optimizer/optimizer.h" +#include "utils/snapmgr.h" + #include "pg_version_constants.h" #include "distributed/adaptive_executor.h" -#include "distributed/commands/utility_hook.h" #include "distributed/citus_custom_scan.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" -#include "distributed/query_utils.h" +#include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparse_shard_query.h" +#include "distributed/executor_util.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" #include "distributed/local_plan_cache.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/executor_util.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" #include "distributed/multi_server_executor.h" +#include "distributed/query_utils.h" #include "distributed/relation_access_tracking.h" #include "distributed/remote_commands.h" /* to access LogRemoteCommands */ #include "distributed/transaction_management.h" #include "distributed/utils/citus_stat_tenants.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" -#include "executor/tstoreReceiver.h" -#include "executor/tuptable.h" -#include "optimizer/optimizer.h" -#include "nodes/params.h" -#include "utils/snapmgr.h" /* controlled via a GUC */ bool EnableLocalExecution = true; diff --git a/src/backend/distributed/executor/merge_executor.c b/src/backend/distributed/executor/merge_executor.c index bcacbcd1e5d..969b03faf93 100644 --- a/src/backend/distributed/executor/merge_executor.c +++ b/src/backend/distributed/executor/merge_executor.c @@ -9,8 +9,13 @@ */ #include "postgres.h" + #include "miscadmin.h" +#include "nodes/execnodes.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" + #include "distributed/distributed_execution_locks.h" #include "distributed/insert_select_executor.h" #include "distributed/intermediate_results.h" @@ -23,10 +28,6 @@ #include "distributed/repartition_executor.h" #include "distributed/subplan_execution.h" -#include "nodes/execnodes.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" - static void ExecuteSourceAtWorkerAndRepartition(CitusScanState *scanState); static void ExecuteSourceAtCoordAndRedistribution(CitusScanState *scanState); static HTAB * ExecuteMergeSourcePlanIntoColocatedIntermediateResults(Oid targetRelationId, diff --git a/src/backend/distributed/executor/multi_executor.c b/src/backend/distributed/executor/multi_executor.c index 30669825171..45a791af474 100644 --- a/src/backend/distributed/executor/multi_executor.c +++ b/src/backend/distributed/executor/multi_executor.c @@ -10,50 +10,50 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "miscadmin.h" #include "access/xact.h" #include "catalog/dependency.h" -#include "catalog/pg_class.h" #include "catalog/namespace.h" +#include "catalog/pg_class.h" +#include "commands/copy.h" +#include "executor/execdebug.h" +#include "nodes/execnodes.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "parser/parse_oper.h" +#include "parser/parsetree.h" +#include "storage/lmgr.h" +#include "tcop/dest.h" +#include "tcop/pquery.h" +#include "tcop/utility.h" +#include "utils/fmgrprotos.h" +#include "utils/memutils.h" +#include "utils/snapmgr.h" + +#include "pg_version_constants.h" + #include "distributed/backend_data.h" #include "distributed/citus_custom_scan.h" +#include "distributed/combine_query_planner.h" #include "distributed/commands/multi_copy.h" #include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/distributed_planner.h" #include "distributed/function_call_delegation.h" #include "distributed/insert_select_executor.h" #include "distributed/insert_select_planner.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" -#include "distributed/coordinator_protocol.h" #include "distributed/multi_executor.h" -#include "distributed/combine_query_planner.h" -#include "distributed/distributed_planner.h" #include "distributed/multi_router_planner.h" #include "distributed/multi_server_executor.h" #include "distributed/relation_access_tracking.h" #include "distributed/resource_lock.h" #include "distributed/transaction_management.h" #include "distributed/version_compat.h" -#include "distributed/worker_shard_visibility.h" #include "distributed/worker_protocol.h" -#include "distributed/function_call_delegation.h" -#include "executor/execdebug.h" -#include "commands/copy.h" -#include "nodes/execnodes.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "parser/parsetree.h" -#include "parser/parse_oper.h" -#include "storage/lmgr.h" -#include "tcop/dest.h" -#include "tcop/pquery.h" -#include "tcop/utility.h" -#include "utils/fmgrprotos.h" -#include "utils/snapmgr.h" -#include "utils/memutils.h" +#include "distributed/worker_shard_visibility.h" /* diff --git a/src/backend/distributed/executor/multi_server_executor.c b/src/backend/distributed/executor/multi_server_executor.c index ac144c350e8..20901983337 100644 --- a/src/backend/distributed/executor/multi_server_executor.c +++ b/src/backend/distributed/executor/multi_server_executor.c @@ -14,22 +14,24 @@ *------------------------------------------------------------------------- */ +#include + #include "postgres.h" + #include "miscadmin.h" -#include +#include "utils/lsyscache.h" +#include "distributed/coordinator_protocol.h" #include "distributed/listutils.h" #include "distributed/log_utils.h" #include "distributed/multi_executor.h" #include "distributed/multi_physical_planner.h" -#include "distributed/multi_server_executor.h" #include "distributed/multi_router_planner.h" -#include "distributed/coordinator_protocol.h" +#include "distributed/multi_server_executor.h" #include "distributed/subplan_execution.h" #include "distributed/tuple_destination.h" #include "distributed/worker_protocol.h" -#include "utils/lsyscache.h" int RemoteTaskCheckInterval = 10; /* per cycle sleep interval in millisecs */ int TaskExecutorType = MULTI_EXECUTOR_ADAPTIVE; /* distributed executor type */ diff --git a/src/backend/distributed/executor/partitioned_intermediate_results.c b/src/backend/distributed/executor/partitioned_intermediate_results.c index 75255234360..3ec73a4567b 100644 --- a/src/backend/distributed/executor/partitioned_intermediate_results.c +++ b/src/backend/distributed/executor/partitioned_intermediate_results.c @@ -11,6 +11,7 @@ #include #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" @@ -20,9 +21,15 @@ #include "access/nbtree.h" #include "catalog/pg_am.h" #include "catalog/pg_type.h" +#include "nodes/makefuncs.h" +#include "nodes/primnodes.h" +#include "tcop/pquery.h" +#include "tcop/tcopprot.h" +#include "utils/typcache.h" + #include "distributed/intermediate_results.h" -#include "distributed/metadata_utility.h" #include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/pg_dist_shard.h" #include "distributed/remote_commands.h" @@ -31,11 +38,6 @@ #include "distributed/utils/function.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" -#include "nodes/makefuncs.h" -#include "nodes/primnodes.h" -#include "tcop/pquery.h" -#include "tcop/tcopprot.h" -#include "utils/typcache.h" /* diff --git a/src/backend/distributed/executor/placement_access.c b/src/backend/distributed/executor/placement_access.c index df5143a5423..a8573de7c08 100644 --- a/src/backend/distributed/executor/placement_access.c +++ b/src/backend/distributed/executor/placement_access.c @@ -8,9 +8,9 @@ * Copyright (c) Citus Data, Inc. *------------------------------------------------------------------------- */ -#include "distributed/placement_access.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" +#include "distributed/placement_access.h" static List * BuildPlacementSelectList(int32 groupId, List *relationShardList); static List * BuildPlacementDDLList(int32 groupId, List *relationShardList); diff --git a/src/backend/distributed/executor/query_stats.c b/src/backend/distributed/executor/query_stats.c index b59777d4501..f37a99bbf72 100644 --- a/src/backend/distributed/executor/query_stats.c +++ b/src/backend/distributed/executor/query_stats.c @@ -9,32 +9,32 @@ *------------------------------------------------------------------------- */ +#include + #include "postgres.h" +#include "funcapi.h" +#include "miscadmin.h" #include "safe_lib.h" -#include "miscadmin.h" +#include "access/hash.h" +#include "catalog/pg_authid.h" +#include "storage/fd.h" +#include "storage/ipc.h" +#include "storage/spin.h" +#include "tcop/utility.h" +#include "utils/builtins.h" #include "pg_version_constants.h" -#include "access/hash.h" -#include "catalog/pg_authid.h" #include "distributed/citus_safe_lib.h" #include "distributed/function_utils.h" #include "distributed/hash_helpers.h" #include "distributed/multi_executor.h" #include "distributed/multi_server_executor.h" -#include "distributed/version_compat.h" #include "distributed/query_stats.h" #include "distributed/tuplestore.h" -#include "funcapi.h" -#include "storage/ipc.h" -#include "storage/fd.h" -#include "storage/spin.h" -#include "tcop/utility.h" -#include "utils/builtins.h" - -#include +#include "distributed/version_compat.h" #define CITUS_STATS_DUMP_FILE "pg_stat/citus_query_stats.stat" #define CITUS_STAT_STATEMENTS_COLS 6 diff --git a/src/backend/distributed/executor/repartition_executor.c b/src/backend/distributed/executor/repartition_executor.c index af4f0ac7e70..6e4dd3df441 100644 --- a/src/backend/distributed/executor/repartition_executor.c +++ b/src/backend/distributed/executor/repartition_executor.c @@ -10,6 +10,7 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "nodes/makefuncs.h" diff --git a/src/backend/distributed/executor/repartition_join_execution.c b/src/backend/distributed/executor/repartition_join_execution.c index 29d994e59d1..8dce1239034 100644 --- a/src/backend/distributed/executor/repartition_join_execution.c +++ b/src/backend/distributed/executor/repartition_join_execution.c @@ -24,20 +24,22 @@ */ #include "postgres.h" -#include "access/hash.h" + #include "miscadmin.h" + +#include "access/hash.h" #include "utils/builtins.h" -#include "distributed/hash_helpers.h" #include "distributed/adaptive_executor.h" #include "distributed/directed_acyclic_graph_execution.h" +#include "distributed/hash_helpers.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" #include "distributed/metadata_cache.h" #include "distributed/multi_physical_planner.h" #include "distributed/multi_server_executor.h" -#include "distributed/task_execution_utils.h" #include "distributed/repartition_join_execution.h" +#include "distributed/task_execution_utils.h" #include "distributed/transaction_management.h" #include "distributed/transmit.h" #include "distributed/worker_manager.h" diff --git a/src/backend/distributed/executor/subplan_execution.c b/src/backend/distributed/executor/subplan_execution.c index 3651d7f5284..4e81bb48680 100644 --- a/src/backend/distributed/executor/subplan_execution.c +++ b/src/backend/distributed/executor/subplan_execution.c @@ -10,6 +10,9 @@ #include "postgres.h" +#include "executor/executor.h" +#include "utils/datetime.h" + #include "distributed/intermediate_result_pruning.h" #include "distributed/intermediate_results.h" #include "distributed/listutils.h" @@ -19,8 +22,6 @@ #include "distributed/subplan_execution.h" #include "distributed/transaction_management.h" #include "distributed/worker_manager.h" -#include "executor/executor.h" -#include "utils/datetime.h" #define SECOND_TO_MILLI_SECOND 1000 #define MICRO_TO_MILLI_SECOND 0.001 diff --git a/src/backend/distributed/executor/transmit.c b/src/backend/distributed/executor/transmit.c index 24cbbb55049..a10ae4fbf0b 100644 --- a/src/backend/distributed/executor/transmit.c +++ b/src/backend/distributed/executor/transmit.c @@ -7,24 +7,26 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" -#include "miscadmin.h" -#include "pgstat.h" - #include #include #include +#include "postgres.h" + +#include "miscadmin.h" +#include "pgstat.h" + #include "commands/defrem.h" +#include "libpq/libpq.h" +#include "libpq/pqformat.h" +#include "storage/fd.h" + #include "distributed/listutils.h" #include "distributed/relay_utility.h" #include "distributed/transmit.h" #include "distributed/utils/directory.h" -#include "distributed/worker_protocol.h" #include "distributed/version_compat.h" -#include "libpq/libpq.h" -#include "libpq/pqformat.h" -#include "storage/fd.h" +#include "distributed/worker_protocol.h" /* Local functions forward declarations */ diff --git a/src/backend/distributed/executor/tuple_destination.c b/src/backend/distributed/executor/tuple_destination.c index 42dbf001ecc..3c44d21c0f4 100644 --- a/src/backend/distributed/executor/tuple_destination.c +++ b/src/backend/distributed/executor/tuple_destination.c @@ -1,13 +1,15 @@ +#include +#include + #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" #include "pgstat.h" -#include -#include - #include "access/htup_details.h" + #include "distributed/multi_server_executor.h" #include "distributed/subplan_execution.h" #include "distributed/tuple_destination.h" diff --git a/src/backend/distributed/metadata/dependency.c b/src/backend/distributed/metadata/dependency.c index 989e957af36..6932c453c8f 100644 --- a/src/backend/distributed/metadata/dependency.c +++ b/src/backend/distributed/metadata/dependency.c @@ -10,8 +10,7 @@ #include "postgres.h" -#include "distributed/commands.h" -#include "pg_version_constants.h" +#include "miscadmin.h" #include "access/genam.h" #include "access/heapam.h" @@ -36,6 +35,13 @@ #include "catalog/pg_type.h" #include "commands/extension.h" #include "common/hashfn.h" +#include "utils/fmgroids.h" +#include "utils/hsearch.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_depended_object.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" @@ -46,11 +52,6 @@ #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" #include "distributed/version_compat.h" -#include "miscadmin.h" -#include "utils/fmgroids.h" -#include "utils/hsearch.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" /* * ObjectAddressCollector keeps track of collected ObjectAddresses. This can be used diff --git a/src/backend/distributed/metadata/distobject.c b/src/backend/distributed/metadata/distobject.c index fa9da8b7531..6db071161c7 100644 --- a/src/backend/distributed/metadata/distobject.c +++ b/src/backend/distributed/metadata/distobject.c @@ -10,8 +10,6 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "miscadmin.h" #include "access/genam.h" @@ -26,12 +24,24 @@ #include "catalog/pg_namespace.h" #include "catalog/pg_proc.h" #include "catalog/pg_type.h" -#include "citus_version.h" #include "commands/extension.h" -#include "distributed/listutils.h" +#include "executor/spi.h" +#include "nodes/makefuncs.h" +#include "nodes/pg_list.h" +#include "parser/parse_type.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/regproc.h" +#include "utils/rel.h" + +#include "citus_version.h" +#include "pg_version_constants.h" + #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" +#include "distributed/listutils.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata/pg_dist_object.h" @@ -39,15 +49,6 @@ #include "distributed/metadata_sync.h" #include "distributed/version_compat.h" #include "distributed/worker_transaction.h" -#include "executor/spi.h" -#include "nodes/makefuncs.h" -#include "nodes/pg_list.h" -#include "parser/parse_type.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/regproc.h" -#include "utils/rel.h" static char * CreatePgDistObjectEntryCommand(const ObjectAddress *objectAddress); diff --git a/src/backend/distributed/metadata/metadata_cache.c b/src/backend/distributed/metadata/metadata_cache.c index 44179cffbdf..464ae7b53ab 100644 --- a/src/backend/distributed/metadata/metadata_cache.c +++ b/src/backend/distributed/metadata/metadata_cache.c @@ -8,20 +8,17 @@ */ #include "postgres.h" -#include "pg_version_constants.h" -#include "pg_version_compat.h" -#include "stdint.h" -#include "postgres.h" #include "libpq-fe.h" #include "miscadmin.h" +#include "stdint.h" #include "access/genam.h" #include "access/heapam.h" #include "access/htup_details.h" #include "access/nbtree.h" -#include "access/xact.h" #include "access/sysattr.h" +#include "access/xact.h" #include "catalog/index.h" #include "catalog/indexing.h" #include "catalog/pg_am.h" @@ -30,59 +27,61 @@ #include "catalog/pg_extension.h" #include "catalog/pg_namespace.h" #include "catalog/pg_type.h" -#include "citus_version.h" #include "commands/dbcommands.h" #include "commands/extension.h" #include "commands/trigger.h" +#include "common/hashfn.h" +#include "executor/executor.h" +#include "nodes/makefuncs.h" +#include "nodes/memnodes.h" +#include "nodes/pg_list.h" +#include "parser/parse_func.h" +#include "parser/parse_type.h" +#include "storage/lmgr.h" +#include "utils/array.h" +#include "utils/builtins.h" +#include "utils/catcache.h" +#include "utils/datum.h" +#include "utils/elog.h" +#include "utils/fmgroids.h" +#include "utils/hsearch.h" +#include "utils/inval.h" +#include "utils/jsonb.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" +#include "utils/palloc.h" +#include "utils/rel.h" + +#include "citus_version.h" +#include "pg_version_compat.h" +#include "pg_version_constants.h" + #include "distributed/backend_data.h" #include "distributed/citus_depended_object.h" +#include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/connection_management.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/multi_executor.h" -#include "distributed/function_utils.h" -#include "distributed/listutils.h" #include "distributed/foreign_key_relationship.h" +#include "distributed/function_utils.h" #include "distributed/listutils.h" -#include "distributed/metadata_utility.h" #include "distributed/metadata/pg_dist_object.h" #include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_physical_planner.h" #include "distributed/pg_dist_local_group.h" -#include "distributed/pg_dist_node_metadata.h" #include "distributed/pg_dist_node.h" +#include "distributed/pg_dist_node_metadata.h" #include "distributed/pg_dist_partition.h" -#include "distributed/pg_dist_shard.h" #include "distributed/pg_dist_placement.h" -#include "distributed/shared_library_init.h" +#include "distributed/pg_dist_shard.h" #include "distributed/shardinterval_utils.h" +#include "distributed/shared_library_init.h" #include "distributed/utils/array_type.h" #include "distributed/utils/function.h" #include "distributed/version_compat.h" #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" -#include "executor/executor.h" -#include "nodes/makefuncs.h" -#include "nodes/memnodes.h" -#include "nodes/pg_list.h" -#include "parser/parse_func.h" -#include "parser/parse_type.h" -#include "storage/lmgr.h" -#include "utils/array.h" -#include "utils/builtins.h" -#include "utils/catcache.h" -#include "utils/datum.h" -#include "utils/elog.h" -#include "utils/hsearch.h" -#include "utils/jsonb.h" -#include "common/hashfn.h" -#include "utils/inval.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" -#include "utils/palloc.h" -#include "utils/rel.h" #if PG_VERSION_NUM < PG_VERSION_16 #include "utils/relfilenodemap.h" #endif diff --git a/src/backend/distributed/metadata/metadata_sync.c b/src/backend/distributed/metadata/metadata_sync.c index 53dc7e74763..3ec1930a825 100644 --- a/src/backend/distributed/metadata/metadata_sync.c +++ b/src/backend/distributed/metadata/metadata_sync.c @@ -11,13 +11,15 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" -#include "miscadmin.h" - #include #include #include +#include "postgres.h" + +#include "miscadmin.h" +#include "pgstat.h" + #include "access/genam.h" #include "access/heapam.h" #include "access/htup_details.h" @@ -36,58 +38,56 @@ #include "catalog/pg_proc.h" #include "catalog/pg_type.h" #include "commands/async.h" +#include "executor/spi.h" +#include "foreign/foreign.h" +#include "nodes/makefuncs.h" +#include "nodes/pg_list.h" +#include "parser/parse_type.h" +#include "postmaster/bgworker.h" +#include "postmaster/postmaster.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" +#include "utils/snapmgr.h" +#include "utils/syscache.h" + #include "distributed/argutils.h" #include "distributed/backend_data.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" -#include "distributed/tenant_schema_metadata.h" #include "distributed/commands.h" +#include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparser.h" #include "distributed/distribution_column.h" #include "distributed/listutils.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" #include "distributed/maintenanced.h" -#include "distributed/metadata_cache.h" -#include "distributed/metadata_sync.h" -#include "distributed/metadata_utility.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata/pg_dist_object.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_join_order.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/multi_physical_planner.h" #include "distributed/pg_dist_colocation.h" #include "distributed/pg_dist_node.h" -#include "distributed/pg_dist_shard.h" #include "distributed/pg_dist_schema.h" +#include "distributed/pg_dist_shard.h" #include "distributed/relation_access_tracking.h" #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" +#include "distributed/tenant_schema_metadata.h" #include "distributed/utils/array_type.h" #include "distributed/utils/function.h" +#include "distributed/version_compat.h" #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" #include "distributed/worker_transaction.h" -#include "distributed/version_compat.h" -#include "distributed/commands/utility_hook.h" -#include "executor/spi.h" -#include "foreign/foreign.h" -#include "miscadmin.h" -#include "nodes/makefuncs.h" -#include "nodes/pg_list.h" -#include "pgstat.h" -#include "postmaster/bgworker.h" -#include "postmaster/postmaster.h" -#include "parser/parse_type.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" -#include "utils/snapmgr.h" -#include "utils/syscache.h" /* managed via a GUC */ diff --git a/src/backend/distributed/metadata/metadata_utility.c b/src/backend/distributed/metadata/metadata_utility.c index 0d9963c12a6..b2d3f63900f 100644 --- a/src/backend/distributed/metadata/metadata_utility.c +++ b/src/backend/distributed/metadata/metadata_utility.c @@ -13,12 +13,11 @@ #include #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" -#include "pg_version_constants.h" - #include "access/genam.h" #include "access/htup_details.h" #include "access/sysattr.h" @@ -30,23 +29,39 @@ #include "catalog/pg_constraint.h" #include "catalog/pg_extension.h" #include "catalog/pg_namespace.h" + +#include "pg_version_constants.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "catalog/pg_proc_d.h" #endif #include "catalog/pg_type.h" #include "commands/extension.h" #include "commands/sequence.h" +#include "nodes/makefuncs.h" +#include "parser/scansup.h" +#include "storage/lmgr.h" +#include "storage/procarray.h" +#include "utils/acl.h" +#include "utils/builtins.h" +#include "utils/datum.h" +#include "utils/fmgroids.h" +#include "utils/fmgrprotos.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" +#include "utils/syscache.h" + #include "distributed/background_jobs.h" -#include "distributed/colocation_utils.h" -#include "distributed/connection_management.h" #include "distributed/citus_nodes.h" #include "distributed/citus_safe_lib.h" +#include "distributed/colocation_utils.h" +#include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" #include "distributed/listutils.h" #include "distributed/lock_graph.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_join_order.h" #include "distributed/multi_logical_optimizer.h" #include "distributed/multi_partitioning_utils.h" @@ -56,31 +71,18 @@ #include "distributed/pg_dist_backrgound_task_depend.h" #include "distributed/pg_dist_colocation.h" #include "distributed/pg_dist_partition.h" -#include "distributed/pg_dist_shard.h" #include "distributed/pg_dist_placement.h" +#include "distributed/pg_dist_shard.h" #include "distributed/reference_table_utils.h" #include "distributed/relay_utility.h" -#include "distributed/resource_lock.h" #include "distributed/remote_commands.h" +#include "distributed/resource_lock.h" #include "distributed/shard_rebalancer.h" #include "distributed/tuplestore.h" #include "distributed/utils/array_type.h" +#include "distributed/version_compat.h" #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" -#include "distributed/version_compat.h" -#include "nodes/makefuncs.h" -#include "parser/scansup.h" -#include "storage/lmgr.h" -#include "storage/procarray.h" -#include "utils/acl.h" -#include "utils/builtins.h" -#include "utils/datum.h" -#include "utils/fmgroids.h" -#include "utils/fmgrprotos.h" -#include "utils/inval.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" -#include "utils/syscache.h" #define DISK_SPACE_FIELDS 2 diff --git a/src/backend/distributed/metadata/node_metadata.c b/src/backend/distributed/metadata/node_metadata.c index 041c6dcc42b..2bd2b8a0965 100644 --- a/src/backend/distributed/metadata/node_metadata.c +++ b/src/backend/distributed/metadata/node_metadata.c @@ -5,34 +5,49 @@ * Copyright (c) Citus Data, Inc. */ #include "postgres.h" -#include "miscadmin.h" + #include "funcapi.h" -#include "utils/plancache.h" +#include "miscadmin.h" #include "access/genam.h" #include "access/heapam.h" #include "access/htup.h" #include "access/htup_details.h" #include "access/skey.h" -#include "access/skey.h" #include "access/tupmacs.h" #include "access/xact.h" #include "catalog/indexing.h" #include "catalog/namespace.h" #include "commands/sequence.h" +#include "executor/spi.h" +#include "lib/stringinfo.h" +#include "postmaster/postmaster.h" +#include "storage/bufmgr.h" +#include "storage/fd.h" +#include "storage/lmgr.h" +#include "storage/lock.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/plancache.h" +#include "utils/rel.h" +#include "utils/relcache.h" + #include "distributed/citus_acquire_lock.h" #include "distributed/citus_safe_lib.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" #include "distributed/connection_management.h" -#include "distributed/maintenanced.h" #include "distributed/coordinator_protocol.h" -#include "distributed/metadata_utility.h" +#include "distributed/maintenanced.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata/pg_dist_object.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_join_order.h" +#include "distributed/multi_partitioning_utils.h" #include "distributed/multi_router_planner.h" #include "distributed/pg_dist_node.h" #include "distributed/pg_dist_node_metadata.h" @@ -40,26 +55,12 @@ #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" #include "distributed/shardinterval_utils.h" -#include "distributed/multi_partitioning_utils.h" #include "distributed/shared_connection_stats.h" #include "distributed/string_utils.h" -#include "distributed/metadata/pg_dist_object.h" #include "distributed/transaction_recovery.h" #include "distributed/version_compat.h" #include "distributed/worker_manager.h" #include "distributed/worker_transaction.h" -#include "executor/spi.h" -#include "lib/stringinfo.h" -#include "postmaster/postmaster.h" -#include "storage/bufmgr.h" -#include "storage/lmgr.h" -#include "storage/lock.h" -#include "storage/fd.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" -#include "utils/relcache.h" #define INVALID_GROUP_ID -1 diff --git a/src/backend/distributed/metadata/pg_get_object_address_13_14_15.c b/src/backend/distributed/metadata/pg_get_object_address_13_14_15.c index a7f40e2ade4..abe378cdbf0 100644 --- a/src/backend/distributed/metadata/pg_get_object_address_13_14_15.c +++ b/src/backend/distributed/metadata/pg_get_object_address_13_14_15.c @@ -16,23 +16,26 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "catalog/objectaddress.h" #include "catalog/pg_type.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/citus_safe_lib.h" -#include "distributed/metadata/dependency.h" -#include "distributed/metadata/distobject.h" -#include "pg_version_constants.h" -#include "distributed/version_compat.h" +#include "mb/pg_wchar.h" #include "nodes/value.h" +#include "parser/parse_type.h" #include "utils/array.h" #include "utils/builtins.h" #include "utils/fmgroids.h" #include "utils/varlena.h" -#include "mb/pg_wchar.h" -#include "parser/parse_type.h" + +#include "pg_version_constants.h" + +#include "distributed/citus_ruleutils.h" +#include "distributed/citus_safe_lib.h" +#include "distributed/metadata/dependency.h" +#include "distributed/metadata/distobject.h" +#include "distributed/version_compat.h" static void ErrorIfCurrentUserCanNotDistributeObject(char *textType, ObjectType type, diff --git a/src/backend/distributed/operations/citus_create_restore_point.c b/src/backend/distributed/operations/citus_create_restore_point.c index 42fc5311f98..8a5e738e44b 100644 --- a/src/backend/distributed/operations/citus_create_restore_point.c +++ b/src/backend/distributed/operations/citus_create_restore_point.c @@ -10,22 +10,24 @@ */ #include "postgres.h" + #include "libpq-fe.h" #include "access/xlog.h" #include "access/xlog_internal.h" #include "catalog/pg_type.h" -#include "distributed/connection_management.h" -#include "distributed/listutils.h" -#include "distributed/metadata_utility.h" -#include "distributed/metadata_cache.h" -#include "distributed/remote_commands.h" #include "nodes/pg_list.h" #include "storage/lmgr.h" #include "storage/lock.h" #include "utils/builtins.h" #include "utils/pg_lsn.h" +#include "distributed/connection_management.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" +#include "distributed/remote_commands.h" + #define CREATE_RESTORE_POINT_COMMAND "SELECT pg_catalog.pg_create_restore_point($1::text)" diff --git a/src/backend/distributed/operations/citus_split_shard_by_split_points.c b/src/backend/distributed/operations/citus_split_shard_by_split_points.c index 5bdbaf576f9..076e58d4c02 100644 --- a/src/backend/distributed/operations/citus_split_shard_by_split_points.c +++ b/src/backend/distributed/operations/citus_split_shard_by_split_points.c @@ -10,19 +10,21 @@ */ #include "postgres.h" + #include "catalog/pg_type.h" -#include "nodes/pg_list.h" #include "lib/stringinfo.h" +#include "nodes/pg_list.h" #include "utils/builtins.h" #include "utils/lsyscache.h" -#include "distributed/utils/array_type.h" + #include "distributed/colocation_utils.h" -#include "distributed/metadata_cache.h" -#include "distributed/shardinterval_utils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/metadata_cache.h" #include "distributed/remote_commands.h" #include "distributed/shard_split.h" +#include "distributed/shardinterval_utils.h" +#include "distributed/utils/array_type.h" #include "distributed/utils/distribution_column_map.h" /* declarations for dynamic loading */ diff --git a/src/backend/distributed/operations/citus_tools.c b/src/backend/distributed/operations/citus_tools.c index 8f6f80c2b37..bc4aa55604c 100644 --- a/src/backend/distributed/operations/citus_tools.c +++ b/src/backend/distributed/operations/citus_tools.c @@ -12,8 +12,15 @@ #include "postgres.h" +#include "funcapi.h" +#include "libpq-fe.h" +#include "miscadmin.h" + #include "access/htup_details.h" #include "catalog/pg_type.h" +#include "lib/stringinfo.h" +#include "utils/builtins.h" + #include "distributed/backend_data.h" #include "distributed/connection_management.h" #include "distributed/metadata_cache.h" @@ -23,11 +30,6 @@ #include "distributed/utils/function.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" -#include "funcapi.h" -#include "lib/stringinfo.h" -#include "libpq-fe.h" -#include "miscadmin.h" -#include "utils/builtins.h" PG_FUNCTION_INFO_V1(master_run_on_worker); diff --git a/src/backend/distributed/operations/create_shards.c b/src/backend/distributed/operations/create_shards.c index 8bc3b249fbc..96254705122 100644 --- a/src/backend/distributed/operations/create_shards.c +++ b/src/backend/distributed/operations/create_shards.c @@ -10,35 +10,22 @@ *------------------------------------------------------------------------- */ +#include +#include +#include +#include +#include + #include "postgres.h" + #include "c.h" #include "fmgr.h" #include "libpq-fe.h" #include "miscadmin.h" #include "port.h" -#include -#include -#include -#include -#include - #include "catalog/namespace.h" #include "catalog/pg_class.h" -#include "distributed/listutils.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_join_order.h" -#include "distributed/multi_executor.h" -#include "distributed/multi_partitioning_utils.h" -#include "distributed/pg_dist_partition.h" -#include "distributed/pg_dist_shard.h" -#include "distributed/reference_table_utils.h" -#include "distributed/resource_lock.h" -#include "distributed/shardinterval_utils.h" -#include "distributed/transaction_management.h" -#include "distributed/worker_manager.h" #include "lib/stringinfo.h" #include "nodes/pg_list.h" #include "nodes/primnodes.h" @@ -52,6 +39,21 @@ #include "utils/lsyscache.h" #include "utils/palloc.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" +#include "distributed/multi_executor.h" +#include "distributed/multi_join_order.h" +#include "distributed/multi_partitioning_utils.h" +#include "distributed/pg_dist_partition.h" +#include "distributed/pg_dist_shard.h" +#include "distributed/reference_table_utils.h" +#include "distributed/resource_lock.h" +#include "distributed/shardinterval_utils.h" +#include "distributed/transaction_management.h" +#include "distributed/worker_manager.h" + /* declarations for dynamic loading */ PG_FUNCTION_INFO_V1(master_create_worker_shards); diff --git a/src/backend/distributed/operations/delete_protocol.c b/src/backend/distributed/operations/delete_protocol.c index 54cb568be4e..c36121b00ba 100644 --- a/src/backend/distributed/operations/delete_protocol.c +++ b/src/backend/distributed/operations/delete_protocol.c @@ -13,9 +13,9 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" +#include -#include "pg_version_constants.h" +#include "postgres.h" #include "c.h" #include "fmgr.h" @@ -23,17 +23,37 @@ #include "miscadmin.h" #include "port.h" -#include - #include "access/xact.h" #include "catalog/namespace.h" #include "commands/dbcommands.h" +#include "lib/stringinfo.h" +#include "nodes/nodeFuncs.h" +#include "nodes/nodes.h" +#include "nodes/parsenodes.h" +#include "nodes/pathnodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "optimizer/restrictinfo.h" +#include "storage/lmgr.h" +#include "storage/lock.h" +#include "tcop/tcopprot.h" +#include "utils/array.h" +#include "utils/builtins.h" +#include "utils/elog.h" +#include "utils/errcodes.h" +#include "utils/lsyscache.h" +#include "utils/varlena.h" + +#include "pg_version_constants.h" + #include "distributed/commands/utility_hook.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparse_shard_query.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_sync.h" #include "distributed/multi_join_order.h" #include "distributed/multi_logical_planner.h" @@ -47,25 +67,6 @@ #include "distributed/shard_cleaner.h" #include "distributed/worker_protocol.h" #include "distributed/worker_transaction.h" -#include "lib/stringinfo.h" -#include "nodes/nodeFuncs.h" -#include "nodes/nodes.h" -#include "nodes/parsenodes.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" -#include "optimizer/clauses.h" -#include "nodes/pathnodes.h" -#include "optimizer/optimizer.h" -#include "optimizer/restrictinfo.h" -#include "storage/lock.h" -#include "storage/lmgr.h" -#include "tcop/tcopprot.h" -#include "utils/array.h" -#include "utils/builtins.h" -#include "utils/elog.h" -#include "utils/errcodes.h" -#include "utils/lsyscache.h" -#include "utils/varlena.h" /* Local functions forward declarations */ diff --git a/src/backend/distributed/operations/health_check.c b/src/backend/distributed/operations/health_check.c index b3246f88883..c908606c156 100644 --- a/src/backend/distributed/operations/health_check.c +++ b/src/backend/distributed/operations/health_check.c @@ -13,6 +13,8 @@ #include "postgres.h" +#include "utils/builtins.h" + #include "distributed/argutils.h" #include "distributed/listutils.h" #include "distributed/lock_graph.h" @@ -20,7 +22,6 @@ #include "distributed/remote_commands.h" #include "distributed/tuplestore.h" #include "distributed/worker_manager.h" -#include "utils/builtins.h" /* simple query to run on workers to check connectivity */ #define CONNECTIVITY_CHECK_QUERY "SELECT 1" diff --git a/src/backend/distributed/operations/isolate_shards.c b/src/backend/distributed/operations/isolate_shards.c index ec89ae40293..502b00f5bb9 100644 --- a/src/backend/distributed/operations/isolate_shards.c +++ b/src/backend/distributed/operations/isolate_shards.c @@ -11,11 +11,20 @@ */ #include "postgres.h" + #include "c.h" #include "fmgr.h" #include "libpq-fe.h" #include "catalog/pg_class.h" +#include "nodes/pg_list.h" +#include "storage/lock.h" +#include "utils/builtins.h" +#include "utils/elog.h" +#include "utils/errcodes.h" +#include "utils/lsyscache.h" +#include "utils/typcache.h" + #include "distributed/colocation_utils.h" #include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" @@ -25,22 +34,15 @@ #include "distributed/multi_router_planner.h" #include "distributed/pg_dist_partition.h" #include "distributed/pg_dist_shard.h" -#include "distributed/remote_commands.h" #include "distributed/reference_table_utils.h" +#include "distributed/remote_commands.h" #include "distributed/resource_lock.h" +#include "distributed/shard_split.h" +#include "distributed/utils/distribution_column_map.h" +#include "distributed/version_compat.h" #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" #include "distributed/worker_transaction.h" -#include "distributed/version_compat.h" -#include "distributed/shard_split.h" -#include "distributed/utils/distribution_column_map.h" -#include "nodes/pg_list.h" -#include "storage/lock.h" -#include "utils/builtins.h" -#include "utils/elog.h" -#include "utils/errcodes.h" -#include "utils/lsyscache.h" -#include "utils/typcache.h" /* declarations for dynamic loading */ PG_FUNCTION_INFO_V1(isolate_tenant_to_new_shard); diff --git a/src/backend/distributed/operations/modify_multiple_shards.c b/src/backend/distributed/operations/modify_multiple_shards.c index 8d596a10bf9..9e287972850 100644 --- a/src/backend/distributed/operations/modify_multiple_shards.c +++ b/src/backend/distributed/operations/modify_multiple_shards.c @@ -14,46 +14,46 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" - #include "catalog/pg_class.h" #include "commands/dbcommands.h" #include "commands/event_trigger.h" +#include "nodes/makefuncs.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "optimizer/restrictinfo.h" +#include "tcop/tcopprot.h" +#include "utils/builtins.h" +#include "utils/datum.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" + +#include "pg_version_constants.h" + #include "distributed/citus_clauses.h" #include "distributed/citus_ruleutils.h" #include "distributed/commands.h" -#include "distributed/listutils.h" -#include "distributed/metadata_utility.h" #include "distributed/coordinator_protocol.h" +#include "distributed/distributed_planner.h" +#include "distributed/listutils.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_physical_planner.h" #include "distributed/multi_server_executor.h" -#include "distributed/distributed_planner.h" -#include "distributed/pg_dist_shard.h" #include "distributed/pg_dist_partition.h" +#include "distributed/pg_dist_shard.h" #include "distributed/resource_lock.h" -#include "distributed/shardinterval_utils.h" #include "distributed/shard_pruning.h" +#include "distributed/shardinterval_utils.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" #include "distributed/worker_transaction.h" -#include "optimizer/clauses.h" -#include "optimizer/optimizer.h" -#include "optimizer/restrictinfo.h" -#include "nodes/makefuncs.h" -#include "tcop/tcopprot.h" -#include "utils/builtins.h" -#include "utils/datum.h" -#include "utils/inval.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" PG_FUNCTION_INFO_V1(master_modify_multiple_shards); diff --git a/src/backend/distributed/operations/node_protocol.c b/src/backend/distributed/operations/node_protocol.c index eeaf34321a4..52e44bea01c 100644 --- a/src/backend/distributed/operations/node_protocol.c +++ b/src/backend/distributed/operations/node_protocol.c @@ -11,17 +11,15 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" +#include -#include "pg_version_constants.h" +#include "postgres.h" #include "c.h" #include "fmgr.h" #include "funcapi.h" #include "miscadmin.h" -#include - #include "access/attnum.h" #include "access/genam.h" #include "access/heapam.h" @@ -37,20 +35,9 @@ #include "catalog/pg_class.h" #include "catalog/pg_constraint.h" #include "catalog/pg_index.h" -#include "catalog/pg_type.h" #include "catalog/pg_namespace.h" +#include "catalog/pg_type.h" #include "commands/sequence.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/commands.h" -#include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/metadata_cache.h" -#include "distributed/metadata_sync.h" -#include "distributed/namespace_utils.h" -#include "distributed/pg_dist_shard.h" -#include "distributed/shared_library_init.h" -#include "distributed/version_compat.h" -#include "distributed/worker_manager.h" #include "foreign/foreign.h" #include "lib/stringinfo.h" #include "nodes/pg_list.h" @@ -65,6 +52,20 @@ #include "utils/ruleutils.h" #include "utils/varlena.h" +#include "pg_version_constants.h" + +#include "distributed/citus_ruleutils.h" +#include "distributed/commands.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_sync.h" +#include "distributed/namespace_utils.h" +#include "distributed/pg_dist_shard.h" +#include "distributed/shared_library_init.h" +#include "distributed/version_compat.h" +#include "distributed/worker_manager.h" + /* Shard related configuration */ int ShardCount = 32; int ShardReplicationFactor = 1; /* desired replication factor for shards */ diff --git a/src/backend/distributed/operations/partitioning.c b/src/backend/distributed/operations/partitioning.c index 9e205792759..afcaa8ac15c 100644 --- a/src/backend/distributed/operations/partitioning.c +++ b/src/backend/distributed/operations/partitioning.c @@ -9,13 +9,12 @@ */ #include "postgres.h" + #include "fmgr.h" #include "funcapi.h" #include "access/htup.h" #include "access/htup_details.h" -#include "distributed/metadata_cache.h" -#include "distributed/metadata_utility.h" #include "nodes/parsenodes.h" #include "nodes/pg_list.h" #include "utils/builtins.h" @@ -23,6 +22,9 @@ #include "utils/lsyscache.h" #include "utils/syscache.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" + /* exports for SQL callable functions */ PG_FUNCTION_INFO_V1(time_partition_range); diff --git a/src/backend/distributed/operations/replicate_none_dist_table_shard.c b/src/backend/distributed/operations/replicate_none_dist_table_shard.c index c28490367db..33a98ee4226 100644 --- a/src/backend/distributed/operations/replicate_none_dist_table_shard.c +++ b/src/backend/distributed/operations/replicate_none_dist_table_shard.c @@ -10,7 +10,9 @@ */ #include "postgres.h" + #include "miscadmin.h" + #include "nodes/pg_list.h" #include "distributed/adaptive_executor.h" diff --git a/src/backend/distributed/operations/shard_cleaner.c b/src/backend/distributed/operations/shard_cleaner.c index 42877bf1023..79041453022 100644 --- a/src/backend/distributed/operations/shard_cleaner.c +++ b/src/backend/distributed/operations/shard_cleaner.c @@ -10,27 +10,29 @@ */ #include "postgres.h" + #include "miscadmin.h" + #include "access/genam.h" #include "access/xact.h" #include "catalog/namespace.h" #include "commands/dbcommands.h" #include "commands/sequence.h" -#include "postmaster/postmaster.h" #include "nodes/makefuncs.h" +#include "postmaster/postmaster.h" #include "utils/builtins.h" #include "utils/fmgroids.h" #include "distributed/citus_safe_lib.h" -#include "distributed/listutils.h" #include "distributed/coordinator_protocol.h" +#include "distributed/listutils.h" #include "distributed/metadata_cache.h" -#include "distributed/shard_cleaner.h" -#include "distributed/shard_rebalancer.h" +#include "distributed/pg_dist_cleanup.h" #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" +#include "distributed/shard_cleaner.h" +#include "distributed/shard_rebalancer.h" #include "distributed/worker_transaction.h" -#include "distributed/pg_dist_cleanup.h" #define REPLICATION_SLOT_CATALOG_TABLE_NAME "pg_replication_slots" #define STR_ERRCODE_OBJECT_IN_USE "55006" diff --git a/src/backend/distributed/operations/shard_rebalancer.c b/src/backend/distributed/operations/shard_rebalancer.c index d339ac56a5b..8b58f599315 100644 --- a/src/backend/distributed/operations/shard_rebalancer.c +++ b/src/backend/distributed/operations/shard_rebalancer.c @@ -12,30 +12,47 @@ */ -#include "postgres.h" -#include "libpq-fe.h" - #include -#include "pg_version_constants.h" +#include "postgres.h" + +#include "funcapi.h" +#include "libpq-fe.h" +#include "miscadmin.h" -#include "access/htup_details.h" #include "access/genam.h" -#include "catalog/pg_type.h" +#include "access/htup_details.h" #include "catalog/pg_proc.h" +#include "catalog/pg_type.h" #include "commands/dbcommands.h" #include "commands/sequence.h" +#include "common/hashfn.h" +#include "postmaster/postmaster.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/guc_tables.h" +#include "utils/json.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" +#include "utils/pg_lsn.h" +#include "utils/syscache.h" +#include "utils/varlena.h" + +#include "pg_version_constants.h" + #include "distributed/argutils.h" #include "distributed/background_jobs.h" -#include "distributed/citus_safe_lib.h" #include "distributed/citus_ruleutils.h" +#include "distributed/citus_safe_lib.h" #include "distributed/colocation_utils.h" +#include "distributed/commands/utility_hook.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" #include "distributed/enterprise.h" #include "distributed/hash_helpers.h" #include "distributed/listutils.h" #include "distributed/lock_graph.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_utility.h" #include "distributed/multi_logical_replication.h" @@ -45,27 +62,12 @@ #include "distributed/reference_table_utils.h" #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" -#include "distributed/shard_rebalancer.h" #include "distributed/shard_cleaner.h" +#include "distributed/shard_rebalancer.h" #include "distributed/shard_transfer.h" #include "distributed/tuplestore.h" #include "distributed/utils/array_type.h" #include "distributed/worker_protocol.h" -#include "funcapi.h" -#include "miscadmin.h" -#include "postmaster/postmaster.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/json.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" -#include "utils/pg_lsn.h" -#include "utils/syscache.h" -#include "common/hashfn.h" -#include "utils/varlena.h" -#include "utils/guc_tables.h" -#include "distributed/commands/utility_hook.h" /* RebalanceOptions are the options used to control the rebalance algorithm */ typedef struct RebalanceOptions diff --git a/src/backend/distributed/operations/shard_split.c b/src/backend/distributed/operations/shard_split.c index 0772b03b488..cf9f301b746 100644 --- a/src/backend/distributed/operations/shard_split.c +++ b/src/backend/distributed/operations/shard_split.c @@ -10,41 +10,43 @@ */ #include "postgres.h" + #include "miscadmin.h" + +#include "commands/dbcommands.h" #include "common/hashfn.h" +#include "lib/stringinfo.h" #include "nodes/pg_list.h" +#include "postmaster/postmaster.h" #include "utils/array.h" -#include "distributed/utils/array_type.h" -#include "lib/stringinfo.h" #include "utils/builtins.h" #include "utils/lsyscache.h" -#include "distributed/shared_library_init.h" + #include "distributed/adaptive_executor.h" #include "distributed/colocation_utils.h" +#include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/deparse_shard_query.h" #include "distributed/hash_helpers.h" #include "distributed/metadata_cache.h" -#include "distributed/shardinterval_utils.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/connection_management.h" -#include "distributed/remote_commands.h" -#include "distributed/shard_split.h" +#include "distributed/metadata_sync.h" +#include "distributed/multi_partitioning_utils.h" +#include "distributed/multi_physical_planner.h" +#include "distributed/pg_dist_shard.h" #include "distributed/reference_table_utils.h" -#include "distributed/shard_transfer.h" +#include "distributed/remote_commands.h" #include "distributed/resource_lock.h" -#include "distributed/multi_partitioning_utils.h" -#include "distributed/worker_manager.h" -#include "distributed/worker_transaction.h" #include "distributed/shard_cleaner.h" +#include "distributed/shard_rebalancer.h" +#include "distributed/shard_split.h" +#include "distributed/shard_transfer.h" +#include "distributed/shardinterval_utils.h" +#include "distributed/shardsplit_logical_replication.h" #include "distributed/shared_library_init.h" -#include "distributed/pg_dist_shard.h" -#include "distributed/metadata_sync.h" -#include "distributed/multi_physical_planner.h" +#include "distributed/utils/array_type.h" #include "distributed/utils/distribution_column_map.h" -#include "commands/dbcommands.h" -#include "distributed/shardsplit_logical_replication.h" -#include "distributed/deparse_shard_query.h" -#include "distributed/shard_rebalancer.h" -#include "postmaster/postmaster.h" +#include "distributed/worker_manager.h" +#include "distributed/worker_transaction.h" /* * Entry for map that tracks ShardInterval -> Placement Node diff --git a/src/backend/distributed/operations/shard_transfer.c b/src/backend/distributed/operations/shard_transfer.c index 79895cc3d1e..7d6747cafc7 100644 --- a/src/backend/distributed/operations/shard_transfer.c +++ b/src/backend/distributed/operations/shard_transfer.c @@ -9,27 +9,39 @@ *------------------------------------------------------------------------- */ +#include +#include + #include "postgres.h" + #include "fmgr.h" #include "miscadmin.h" -#include -#include - #include "access/htup_details.h" #include "catalog/pg_class.h" #include "catalog/pg_enum.h" +#include "lib/stringinfo.h" +#include "nodes/pg_list.h" +#include "storage/lmgr.h" +#include "storage/lock.h" +#include "utils/builtins.h" +#include "utils/elog.h" +#include "utils/errcodes.h" +#include "utils/lsyscache.h" +#include "utils/palloc.h" +#include "utils/rel.h" +#include "utils/syscache.h" + #include "distributed/adaptive_executor.h" #include "distributed/backend_data.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparse_shard_query.h" #include "distributed/distributed_planner.h" #include "distributed/listutils.h" -#include "distributed/shard_cleaner.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" #include "distributed/multi_join_order.h" @@ -39,24 +51,13 @@ #include "distributed/reference_table_utils.h" #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" +#include "distributed/shard_cleaner.h" #include "distributed/shard_rebalancer.h" #include "distributed/shard_split.h" #include "distributed/shard_transfer.h" #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" #include "distributed/worker_transaction.h" -#include "lib/stringinfo.h" -#include "nodes/pg_list.h" -#include "storage/lmgr.h" -#include "storage/lock.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/elog.h" -#include "utils/errcodes.h" -#include "utils/lsyscache.h" -#include "utils/palloc.h" -#include "utils/rel.h" -#include "utils/syscache.h" /* local type declarations */ diff --git a/src/backend/distributed/operations/stage_protocol.c b/src/backend/distributed/operations/stage_protocol.c index 421593c662c..5770d648e21 100644 --- a/src/backend/distributed/operations/stage_protocol.c +++ b/src/backend/distributed/operations/stage_protocol.c @@ -15,31 +15,40 @@ */ #include "postgres.h" + #include "funcapi.h" -#include "miscadmin.h" #include "libpq-fe.h" +#include "miscadmin.h" #include "access/htup_details.h" #include "access/xact.h" -#include "commands/tablecmds.h" #include "catalog/indexing.h" #include "catalog/namespace.h" #include "catalog/partition.h" +#include "commands/tablecmds.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" +#include "utils/syscache.h" + +#include "distributed/adaptive_executor.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" -#include "distributed/adaptive_executor.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparse_shard_query.h" #include "distributed/distributed_planner.h" #include "distributed/foreign_key_relationship.h" #include "distributed/hash_helpers.h" #include "distributed/listutils.h" #include "distributed/lock_graph.h" -#include "distributed/multi_executor.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" +#include "distributed/multi_executor.h" #include "distributed/multi_join_order.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/pg_dist_partition.h" @@ -50,16 +59,9 @@ #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" #include "distributed/transaction_management.h" +#include "distributed/version_compat.h" #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" -#include "distributed/version_compat.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/inval.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" -#include "utils/rel.h" /* Local functions forward declarations */ diff --git a/src/backend/distributed/operations/worker_copy_table_to_node_udf.c b/src/backend/distributed/operations/worker_copy_table_to_node_udf.c index f0f83744de5..c603de72af0 100644 --- a/src/backend/distributed/operations/worker_copy_table_to_node_udf.c +++ b/src/backend/distributed/operations/worker_copy_table_to_node_udf.c @@ -15,6 +15,7 @@ #include "utils/builtins.h" #include "utils/lsyscache.h" + #include "distributed/citus_ruleutils.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" diff --git a/src/backend/distributed/operations/worker_node_manager.c b/src/backend/distributed/operations/worker_node_manager.c index e616770dd6a..ba622e4d7ab 100644 --- a/src/backend/distributed/operations/worker_node_manager.c +++ b/src/backend/distributed/operations/worker_node_manager.c @@ -12,16 +12,13 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "commands/dbcommands.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/hash_helpers.h" -#include "distributed/listutils.h" -#include "distributed/metadata_cache.h" -#include "distributed/worker_manager.h" -#include "libpq/hba.h" +#include "common/hashfn.h" #include "common/ip.h" +#include "libpq/hba.h" #include "libpq/libpq-be.h" #include "postmaster/postmaster.h" #include "storage/fd.h" @@ -31,7 +28,12 @@ #include "utils/guc.h" #include "utils/hsearch.h" #include "utils/memutils.h" -#include "common/hashfn.h" + +#include "distributed/coordinator_protocol.h" +#include "distributed/hash_helpers.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/worker_manager.h" /* Config variables managed via guc.c */ diff --git a/src/backend/distributed/operations/worker_shard_copy.c b/src/backend/distributed/operations/worker_shard_copy.c index ba65635a7fb..f99c9b537f7 100644 --- a/src/backend/distributed/operations/worker_shard_copy.c +++ b/src/backend/distributed/operations/worker_shard_copy.c @@ -8,23 +8,26 @@ *------------------------------------------------------------------------- */ -#include "libpq-fe.h" #include "postgres.h" + +#include "libpq-fe.h" + #include "commands/copy.h" #include "nodes/makefuncs.h" #include "parser/parse_relation.h" -#include "utils/lsyscache.h" #include "utils/builtins.h" -#include "distributed/remote_commands.h" -#include "distributed/worker_shard_copy.h" +#include "utils/lsyscache.h" + #include "distributed/commands/multi_copy.h" -#include "distributed/local_multi_copy.h" -#include "distributed/worker_manager.h" #include "distributed/connection_management.h" -#include "distributed/relation_utils.h" -#include "distributed/version_compat.h" #include "distributed/local_executor.h" +#include "distributed/local_multi_copy.h" +#include "distributed/relation_utils.h" +#include "distributed/remote_commands.h" #include "distributed/replication_origin_session_utils.h" +#include "distributed/version_compat.h" +#include "distributed/worker_manager.h" +#include "distributed/worker_shard_copy.h" /* * LocalCopyBuffer is used in copy callback to return the copied rows. diff --git a/src/backend/distributed/operations/worker_split_copy_udf.c b/src/backend/distributed/operations/worker_split_copy_udf.c index 18fdbfc4a12..03354ea047b 100644 --- a/src/backend/distributed/operations/worker_split_copy_udf.c +++ b/src/backend/distributed/operations/worker_split_copy_udf.c @@ -8,7 +8,13 @@ */ #include "postgres.h" + +#include "utils/array.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" + #include "pg_version_compat.h" + #include "distributed/citus_ruleutils.h" #include "distributed/distribution_column.h" #include "distributed/intermediate_results.h" @@ -16,9 +22,6 @@ #include "distributed/multi_executor.h" #include "distributed/utils/array_type.h" #include "distributed/worker_shard_copy.h" -#include "utils/lsyscache.h" -#include "utils/array.h" -#include "utils/builtins.h" PG_FUNCTION_INFO_V1(worker_split_copy); diff --git a/src/backend/distributed/operations/worker_split_shard_release_dsm_udf.c b/src/backend/distributed/operations/worker_split_shard_release_dsm_udf.c index 94ce40cdb75..7f3f3ff7a3b 100644 --- a/src/backend/distributed/operations/worker_split_shard_release_dsm_udf.c +++ b/src/backend/distributed/operations/worker_split_shard_release_dsm_udf.c @@ -9,6 +9,7 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + #include "distributed/shardinterval_utils.h" #include "distributed/shardsplit_shared_memory.h" diff --git a/src/backend/distributed/operations/worker_split_shard_replication_setup_udf.c b/src/backend/distributed/operations/worker_split_shard_replication_setup_udf.c index 4d116dfa13a..d4775995c17 100644 --- a/src/backend/distributed/operations/worker_split_shard_replication_setup_udf.c +++ b/src/backend/distributed/operations/worker_split_shard_replication_setup_udf.c @@ -9,24 +9,27 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + #include "miscadmin.h" -#include "postmaster/postmaster.h" + +#include "commands/dbcommands.h" #include "common/hashfn.h" +#include "postmaster/postmaster.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" + +#include "distributed/citus_safe_lib.h" +#include "distributed/connection_management.h" #include "distributed/distribution_column.h" #include "distributed/hash_helpers.h" -#include "distributed/shardinterval_utils.h" +#include "distributed/listutils.h" +#include "distributed/remote_commands.h" #include "distributed/shard_cleaner.h" #include "distributed/shard_utils.h" +#include "distributed/shardinterval_utils.h" +#include "distributed/shardsplit_logical_replication.h" #include "distributed/shardsplit_shared_memory.h" -#include "distributed/connection_management.h" -#include "distributed/citus_safe_lib.h" -#include "distributed/listutils.h" -#include "distributed/remote_commands.h" #include "distributed/tuplestore.h" -#include "distributed/shardsplit_logical_replication.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "commands/dbcommands.h" /* declarations for dynamic loading */ diff --git a/src/backend/distributed/planner/combine_query_planner.c b/src/backend/distributed/planner/combine_query_planner.c index 6a171dac136..e3aa7b3e637 100644 --- a/src/backend/distributed/planner/combine_query_planner.c +++ b/src/backend/distributed/planner/combine_query_planner.c @@ -11,20 +11,21 @@ #include "postgres.h" +#include "catalog/pg_type.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "optimizer/clauses.h" +#include "optimizer/planner.h" +#include "rewrite/rewriteManip.h" + #include "pg_version_constants.h" -#include "catalog/pg_type.h" #include "distributed/citus_ruleutils.h" +#include "distributed/combine_query_planner.h" #include "distributed/insert_select_planner.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" -#include "distributed/combine_query_planner.h" #include "distributed/multi_physical_planner.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "optimizer/clauses.h" -#include "optimizer/planner.h" -#include "rewrite/rewriteManip.h" static List * RemoteScanTargetList(List *workerTargetList); static PlannedStmt * BuildSelectStatementViaStdPlanner(Query *combineQuery, diff --git a/src/backend/distributed/planner/cte_inline.c b/src/backend/distributed/planner/cte_inline.c index 9a1bbab961e..d6f88525cf4 100644 --- a/src/backend/distributed/planner/cte_inline.c +++ b/src/backend/distributed/planner/cte_inline.c @@ -12,14 +12,16 @@ *------------------------------------------------------------------------- */ #include "postgres.h" -#include "pg_version_compat.h" -#include "pg_version_constants.h" -#include "distributed/cte_inline.h" #include "nodes/nodeFuncs.h" #include "optimizer/optimizer.h" #include "rewrite/rewriteManip.h" +#include "pg_version_compat.h" +#include "pg_version_constants.h" + +#include "distributed/cte_inline.h" + typedef struct inline_cte_walker_context { const char *ctename; /* name and relative level of target CTE */ diff --git a/src/backend/distributed/planner/deparse_shard_query.c b/src/backend/distributed/planner/deparse_shard_query.c index ac37b139975..43b5f14933a 100644 --- a/src/backend/distributed/planner/deparse_shard_query.c +++ b/src/backend/distributed/planner/deparse_shard_query.c @@ -10,11 +10,24 @@ */ #include "postgres.h" + #include "c.h" #include "access/heapam.h" #include "access/htup_details.h" #include "catalog/pg_constraint.h" +#include "lib/stringinfo.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/nodes.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "parser/parsetree.h" +#include "storage/lock.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" +#include "utils/syscache.h" + #include "distributed/citus_nodefuncs.h" #include "distributed/citus_ruleutils.h" #include "distributed/combine_query_planner.h" @@ -28,17 +41,6 @@ #include "distributed/shard_utils.h" #include "distributed/utils/citus_stat_tenants.h" #include "distributed/version_compat.h" -#include "lib/stringinfo.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/nodes.h" -#include "nodes/parsenodes.h" -#include "nodes/pg_list.h" -#include "parser/parsetree.h" -#include "storage/lock.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" -#include "utils/syscache.h" static void UpdateTaskQueryString(Query *query, Task *task); diff --git a/src/backend/distributed/planner/distributed_planner.c b/src/backend/distributed/planner/distributed_planner.c index 7ad419f0a86..a0a89ed2eef 100644 --- a/src/backend/distributed/planner/distributed_planner.c +++ b/src/backend/distributed/planner/distributed_planner.c @@ -7,65 +7,66 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" +#include +#include -#include "pg_version_constants.h" +#include "postgres.h" #include "funcapi.h" -#include -#include - #include "access/htup_details.h" #include "access/xact.h" #include "catalog/pg_class.h" #include "catalog/pg_proc.h" #include "catalog/pg_type.h" +#include "executor/executor.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/pg_list.h" + +#include "pg_version_constants.h" + #include "distributed/citus_depended_object.h" #include "distributed/citus_nodefuncs.h" #include "distributed/citus_nodes.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" +#include "distributed/combine_query_planner.h" #include "distributed/commands.h" +#include "distributed/coordinator_protocol.h" #include "distributed/cte_inline.h" +#include "distributed/distributed_planner.h" #include "distributed/function_call_delegation.h" #include "distributed/insert_select_planner.h" #include "distributed/intermediate_result_pruning.h" #include "distributed/intermediate_results.h" #include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/merge_planner.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" -#include "distributed/distributed_planner.h" -#include "distributed/query_pushdown_planning.h" #include "distributed/multi_logical_optimizer.h" #include "distributed/multi_logical_planner.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/multi_physical_planner.h" -#include "distributed/combine_query_planner.h" #include "distributed/multi_router_planner.h" +#include "distributed/query_pushdown_planning.h" #include "distributed/query_utils.h" #include "distributed/recursive_planning.h" -#include "distributed/shardinterval_utils.h" #include "distributed/shard_utils.h" +#include "distributed/shardinterval_utils.h" #include "distributed/utils/citus_stat_tenants.h" #include "distributed/version_compat.h" #include "distributed/worker_shard_visibility.h" -#include "executor/executor.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/pg_list.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "parser/parse_relation.h" #endif -#include "parser/parsetree.h" -#include "parser/parse_type.h" #include "optimizer/optimizer.h" -#include "optimizer/plancat.h" #include "optimizer/pathnode.h" -#include "optimizer/planner.h" +#include "optimizer/plancat.h" #include "optimizer/planmain.h" +#include "optimizer/planner.h" +#include "parser/parse_type.h" +#include "parser/parsetree.h" #include "utils/builtins.h" #include "utils/datum.h" #include "utils/lsyscache.h" diff --git a/src/backend/distributed/planner/extended_op_node_utils.c b/src/backend/distributed/planner/extended_op_node_utils.c index bb87b6949aa..7912de1d96c 100644 --- a/src/backend/distributed/planner/extended_op_node_utils.c +++ b/src/backend/distributed/planner/extended_op_node_utils.c @@ -9,6 +9,12 @@ */ #include "postgres.h" + +#include "nodes/nodeFuncs.h" +#include "nodes/pg_list.h" +#include "optimizer/optimizer.h" +#include "optimizer/restrictinfo.h" + #include "pg_version_constants.h" #include "distributed/extended_op_node_utils.h" @@ -16,10 +22,6 @@ #include "distributed/metadata_cache.h" #include "distributed/multi_logical_optimizer.h" #include "distributed/pg_dist_partition.h" -#include "optimizer/optimizer.h" -#include "optimizer/restrictinfo.h" -#include "nodes/nodeFuncs.h" -#include "nodes/pg_list.h" static bool GroupedByPartitionColumn(MultiNode *node, MultiExtendedOp *opNode); diff --git a/src/backend/distributed/planner/fast_path_router_planner.c b/src/backend/distributed/planner/fast_path_router_planner.c index 1d58911eb47..531075f9e21 100644 --- a/src/backend/distributed/planner/fast_path_router_planner.c +++ b/src/backend/distributed/planner/fast_path_router_planner.c @@ -34,22 +34,23 @@ */ #include "postgres.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "optimizer/optimizer.h" +#include "tcop/pquery.h" + #include "pg_version_constants.h" #include "distributed/distributed_planner.h" #include "distributed/insert_select_planner.h" -#include "distributed/multi_physical_planner.h" /* only to use some utility functions */ #include "distributed/metadata_cache.h" +#include "distributed/multi_physical_planner.h" /* only to use some utility functions */ #include "distributed/multi_router_planner.h" #include "distributed/pg_dist_partition.h" -#include "distributed/shardinterval_utils.h" #include "distributed/shard_pruning.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/parsenodes.h" -#include "nodes/pg_list.h" -#include "optimizer/optimizer.h" -#include "tcop/pquery.h" +#include "distributed/shardinterval_utils.h" bool EnableFastPathRouterPlanner = true; diff --git a/src/backend/distributed/planner/function_call_delegation.c b/src/backend/distributed/planner/function_call_delegation.c index bacbe16aff2..f17b02347ae 100644 --- a/src/backend/distributed/planner/function_call_delegation.c +++ b/src/backend/distributed/planner/function_call_delegation.c @@ -12,44 +12,46 @@ #include "postgres.h" -#include "pg_version_constants.h" +#include "miscadmin.h" #include "catalog/pg_proc.h" #include "catalog/pg_type.h" #include "commands/defrem.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/primnodes.h" +#include "nodes/print.h" +#include "optimizer/clauses.h" +#include "parser/parse_coerce.h" +#include "parser/parsetree.h" +#include "tcop/dest.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/backend_data.h" -#include "distributed/metadata_utility.h" +#include "distributed/citus_custom_scan.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" #include "distributed/commands/multi_copy.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparse_shard_query.h" #include "distributed/function_call_delegation.h" #include "distributed/insert_select_planner.h" -#include "distributed/citus_custom_scan.h" -#include "distributed/coordinator_protocol.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_physical_planner.h" +#include "distributed/recursive_planning.h" #include "distributed/remote_commands.h" #include "distributed/shard_pruning.h" -#include "distributed/recursive_planning.h" #include "distributed/version_compat.h" #include "distributed/worker_manager.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/parsenodes.h" -#include "nodes/primnodes.h" -#include "nodes/print.h" -#include "optimizer/clauses.h" -#include "parser/parse_coerce.h" -#include "parser/parsetree.h" -#include "miscadmin.h" -#include "tcop/dest.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" struct ParamWalkerContext { diff --git a/src/backend/distributed/planner/insert_select_planner.c b/src/backend/distributed/planner/insert_select_planner.c index dd4bee90f01..60d6ce466ca 100644 --- a/src/backend/distributed/planner/insert_select_planner.c +++ b/src/backend/distributed/planner/insert_select_planner.c @@ -10,22 +10,39 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "catalog/pg_class.h" #include "catalog/pg_type.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/parsenodes.h" +#include "nodes/print.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "optimizer/planner.h" +#include "optimizer/restrictinfo.h" +#include "optimizer/tlist.h" +#include "parser/parse_coerce.h" +#include "parser/parse_relation.h" +#include "parser/parsetree.h" +#include "tcop/tcopprot.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" + +#include "pg_version_constants.h" + #include "distributed/citus_clauses.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/errormessage.h" -#include "distributed/listutils.h" -#include "distributed/log_utils.h" #include "distributed/insert_select_executor.h" #include "distributed/insert_select_planner.h" +#include "distributed/listutils.h" +#include "distributed/log_utils.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" -#include "distributed/multi_logical_planner.h" #include "distributed/multi_logical_optimizer.h" +#include "distributed/multi_logical_planner.h" #include "distributed/multi_physical_planner.h" #include "distributed/multi_router_planner.h" #include "distributed/pg_dist_partition.h" @@ -34,22 +51,6 @@ #include "distributed/repartition_executor.h" #include "distributed/resource_lock.h" #include "distributed/version_compat.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/parsenodes.h" -#include "optimizer/clauses.h" -#include "optimizer/planner.h" -#include "optimizer/restrictinfo.h" -#include "optimizer/tlist.h" -#include "optimizer/optimizer.h" -#include "parser/parsetree.h" -#include "parser/parse_coerce.h" -#include "parser/parse_relation.h" -#include "tcop/tcopprot.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" -#include static void PrepareInsertSelectForCitusPlanner(Query *insertSelectQuery); diff --git a/src/backend/distributed/planner/intermediate_result_pruning.c b/src/backend/distributed/planner/intermediate_result_pruning.c index 03d2001c0d7..5c9ee6c4331 100644 --- a/src/backend/distributed/planner/intermediate_result_pruning.c +++ b/src/backend/distributed/planner/intermediate_result_pruning.c @@ -13,6 +13,9 @@ */ #include "postgres.h" +#include "common/hashfn.h" +#include "utils/builtins.h" + #include "distributed/citus_custom_scan.h" #include "distributed/citus_ruleutils.h" #include "distributed/intermediate_result_pruning.h" @@ -21,8 +24,6 @@ #include "distributed/metadata_cache.h" #include "distributed/query_utils.h" #include "distributed/worker_manager.h" -#include "utils/builtins.h" -#include "common/hashfn.h" /* controlled via GUC, used mostly for testing */ bool LogIntermediateResults = false; diff --git a/src/backend/distributed/planner/local_distributed_join_planner.c b/src/backend/distributed/planner/local_distributed_join_planner.c index 1867a790c80..a6502bf43c4 100644 --- a/src/backend/distributed/planner/local_distributed_join_planner.c +++ b/src/backend/distributed/planner/local_distributed_join_planner.c @@ -71,54 +71,52 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "funcapi.h" -#include "catalog/pg_type.h" #include "catalog/pg_class.h" #include "catalog/pg_index.h" +#include "catalog/pg_type.h" +#include "lib/stringinfo.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/nodes.h" +#include "nodes/pathnodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "optimizer/planner.h" +#include "optimizer/prep.h" +#include "parser/parse_relation.h" +#include "parser/parsetree.h" +#include "utils/builtins.h" +#include "utils/guc.h" +#include "utils/lsyscache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_nodes.h" #include "distributed/citus_ruleutils.h" #include "distributed/commands.h" #include "distributed/commands/multi_copy.h" +#include "distributed/coordinator_protocol.h" #include "distributed/distributed_planner.h" #include "distributed/errormessage.h" -#include "distributed/local_distributed_join_planner.h" #include "distributed/listutils.h" +#include "distributed/local_distributed_join_planner.h" #include "distributed/log_utils.h" #include "distributed/metadata_cache.h" -#include "distributed/multi_logical_planner.h" #include "distributed/multi_logical_optimizer.h" -#include "distributed/multi_router_planner.h" +#include "distributed/multi_logical_planner.h" #include "distributed/multi_physical_planner.h" -#include "distributed/multi_server_executor.h" #include "distributed/multi_router_planner.h" -#include "distributed/coordinator_protocol.h" +#include "distributed/multi_server_executor.h" #include "distributed/query_colocation_checker.h" #include "distributed/query_pushdown_planning.h" #include "distributed/recursive_planning.h" #include "distributed/relation_restriction_equivalence.h" -#include "distributed/log_utils.h" #include "distributed/shard_pruning.h" #include "distributed/version_compat.h" -#include "lib/stringinfo.h" -#include "optimizer/clauses.h" -#include "optimizer/optimizer.h" -#include "optimizer/planner.h" -#include "optimizer/prep.h" -#include "parser/parse_relation.h" -#include "parser/parsetree.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/nodes.h" -#include "nodes/nodeFuncs.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" -#include "nodes/pathnodes.h" -#include "utils/builtins.h" -#include "utils/guc.h" -#include "utils/lsyscache.h" #define INVALID_RTE_IDENTITY -1 diff --git a/src/backend/distributed/planner/local_plan_cache.c b/src/backend/distributed/planner/local_plan_cache.c index 1ac8e24a3e8..2e5ca4e550a 100644 --- a/src/backend/distributed/planner/local_plan_cache.c +++ b/src/backend/distributed/planner/local_plan_cache.c @@ -9,19 +9,20 @@ */ #include "postgres.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" + #include "pg_version_constants.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/deparse_shard_query.h" +#include "distributed/insert_select_planner.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" #include "distributed/local_plan_cache.h" -#include "distributed/deparse_shard_query.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/insert_select_planner.h" #include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" #include "distributed/version_compat.h" -#include "optimizer/optimizer.h" -#include "optimizer/clauses.h" static Query * GetLocalShardQueryForCache(Query *jobQuery, Task *task, diff --git a/src/backend/distributed/planner/merge_planner.c b/src/backend/distributed/planner/merge_planner.c index 5c593d15310..4d64b8f5625 100644 --- a/src/backend/distributed/planner/merge_planner.c +++ b/src/backend/distributed/planner/merge_planner.c @@ -12,6 +12,7 @@ #include #include "postgres.h" + #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" #include "optimizer/optimizer.h" @@ -20,6 +21,8 @@ #include "tcop/tcopprot.h" #include "utils/lsyscache.h" +#include "pg_version_constants.h" + #include "distributed/citus_clauses.h" #include "distributed/citus_custom_scan.h" #include "distributed/insert_select_planner.h" @@ -29,12 +32,11 @@ #include "distributed/multi_logical_optimizer.h" #include "distributed/multi_router_planner.h" #include "distributed/pg_dist_node_metadata.h" -#include "pg_version_constants.h" -#include "distributed/query_pushdown_planning.h" #include "distributed/query_colocation_checker.h" +#include "distributed/query_pushdown_planning.h" #include "distributed/repartition_executor.h" -#include "distributed/shared_library_init.h" #include "distributed/shard_pruning.h" +#include "distributed/shared_library_init.h" #if PG_VERSION_NUM >= PG_VERSION_15 diff --git a/src/backend/distributed/planner/multi_explain.c b/src/backend/distributed/planner/multi_explain.c index bf9a1871eb8..1d6a88934fc 100644 --- a/src/backend/distributed/planner/multi_explain.c +++ b/src/backend/distributed/planner/multi_explain.c @@ -8,11 +8,11 @@ */ #include "postgres.h" + +#include "fmgr.h" #include "libpq-fe.h" #include "miscadmin.h" -#include "pg_version_constants.h" - #include "access/htup_details.h" #include "access/xact.h" #include "catalog/namespace.h" @@ -24,52 +24,54 @@ #include "commands/dbcommands.h" #include "commands/explain.h" #include "commands/tablecmds.h" +#include "executor/tstoreReceiver.h" +#include "lib/stringinfo.h" +#include "nodes/plannodes.h" +#include "nodes/primnodes.h" +#include "nodes/print.h" +#include "optimizer/clauses.h" #include "optimizer/cost.h" +#include "optimizer/planner.h" +#include "parser/analyze.h" +#include "portability/instr_time.h" +#include "rewrite/rewriteHandler.h" +#include "tcop/dest.h" +#include "tcop/tcopprot.h" +#include "tcop/utility.h" +#include "utils/builtins.h" +#include "utils/json.h" +#include "utils/lsyscache.h" +#include "utils/snapmgr.h" + +#include "pg_version_constants.h" + #include "distributed/citus_depended_object.h" #include "distributed/citus_nodefuncs.h" +#include "distributed/combine_query_planner.h" +#include "distributed/commands/utility_hook.h" #include "distributed/connection_management.h" #include "distributed/deparse_shard_query.h" +#include "distributed/distributed_planner.h" #include "distributed/executor_util.h" -#include "distributed/insert_select_planner.h" #include "distributed/insert_select_executor.h" +#include "distributed/insert_select_planner.h" +#include "distributed/jsonbutils.h" #include "distributed/listutils.h" #include "distributed/merge_planner.h" #include "distributed/multi_executor.h" #include "distributed/multi_explain.h" #include "distributed/multi_logical_optimizer.h" #include "distributed/multi_logical_planner.h" -#include "distributed/combine_query_planner.h" #include "distributed/multi_physical_planner.h" #include "distributed/multi_router_planner.h" -#include "distributed/distributed_planner.h" #include "distributed/multi_server_executor.h" -#include "distributed/remote_commands.h" -#include "distributed/recursive_planning.h" #include "distributed/placement_connection.h" +#include "distributed/recursive_planning.h" +#include "distributed/remote_commands.h" #include "distributed/tuple_destination.h" #include "distributed/tuplestore.h" -#include "distributed/worker_protocol.h" #include "distributed/version_compat.h" -#include "distributed/jsonbutils.h" -#include "distributed/commands/utility_hook.h" -#include "executor/tstoreReceiver.h" -#include "fmgr.h" -#include "lib/stringinfo.h" -#include "nodes/plannodes.h" -#include "nodes/primnodes.h" -#include "nodes/print.h" -#include "optimizer/clauses.h" -#include "optimizer/planner.h" -#include "parser/analyze.h" -#include "portability/instr_time.h" -#include "rewrite/rewriteHandler.h" -#include "tcop/dest.h" -#include "tcop/tcopprot.h" -#include "tcop/utility.h" -#include "utils/builtins.h" -#include "utils/json.h" -#include "utils/lsyscache.h" -#include "utils/snapmgr.h" +#include "distributed/worker_protocol.h" /* Config variables that enable printing distributed query plans */ diff --git a/src/backend/distributed/planner/multi_join_order.c b/src/backend/distributed/planner/multi_join_order.c index 0eede6b9b42..908ed206ea6 100644 --- a/src/backend/distributed/planner/multi_join_order.c +++ b/src/backend/distributed/planner/multi_join_order.c @@ -11,32 +11,32 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" - -#include "pg_version_constants.h" - #include -#include "access/nbtree.h" +#include "postgres.h" + #include "access/heapam.h" #include "access/htup_details.h" +#include "access/nbtree.h" #include "catalog/pg_am.h" -#include "distributed/listutils.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_join_order.h" -#include "distributed/multi_physical_planner.h" -#include "distributed/pg_dist_partition.h" -#include "distributed/worker_protocol.h" #include "lib/stringinfo.h" -#include "optimizer/optimizer.h" -#include "utils/builtins.h" #include "nodes/nodeFuncs.h" +#include "optimizer/optimizer.h" #include "utils/builtins.h" #include "utils/datum.h" #include "utils/lsyscache.h" #include "utils/rel.h" #include "utils/syscache.h" +#include "pg_version_constants.h" + +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/multi_join_order.h" +#include "distributed/multi_physical_planner.h" +#include "distributed/pg_dist_partition.h" +#include "distributed/worker_protocol.h" + /* Config variables managed via guc.c */ bool LogMultiJoinOrder = false; /* print join order as a debugging aid */ diff --git a/src/backend/distributed/planner/multi_logical_optimizer.c b/src/backend/distributed/planner/multi_logical_optimizer.c index 9001d724d80..76e38237ad6 100644 --- a/src/backend/distributed/planner/multi_logical_optimizer.c +++ b/src/backend/distributed/planner/multi_logical_optimizer.c @@ -11,12 +11,10 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" - -#include "pg_version_constants.h" - #include +#include "postgres.h" + #include "access/genam.h" #include "access/heapam.h" #include "access/htup_details.h" @@ -27,6 +25,23 @@ #include "catalog/pg_proc.h" #include "catalog/pg_type.h" #include "commands/extension.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "optimizer/tlist.h" +#include "parser/parse_agg.h" +#include "parser/parse_coerce.h" +#include "parser/parse_oper.h" +#include "parser/parsetree.h" +#include "rewrite/rewriteManip.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_nodes.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" @@ -42,22 +57,8 @@ #include "distributed/query_pushdown_planning.h" #include "distributed/string_utils.h" #include "distributed/tdigest_extension.h" -#include "distributed/worker_protocol.h" #include "distributed/version_compat.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "optimizer/clauses.h" -#include "optimizer/tlist.h" -#include "optimizer/optimizer.h" -#include "parser/parse_agg.h" -#include "parser/parse_coerce.h" -#include "parser/parse_oper.h" -#include "parser/parsetree.h" -#include "rewrite/rewriteManip.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" -#include "utils/syscache.h" +#include "distributed/worker_protocol.h" /* Config variable managed via guc.c */ int LimitClauseRowFetchCount = -1; /* number of rows to fetch from each task */ diff --git a/src/backend/distributed/planner/multi_logical_planner.c b/src/backend/distributed/planner/multi_logical_planner.c index d6897d17b2c..f62e309f274 100644 --- a/src/backend/distributed/planner/multi_logical_planner.c +++ b/src/backend/distributed/planner/multi_logical_planner.c @@ -14,42 +14,43 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "access/heapam.h" #include "access/nbtree.h" #include "catalog/pg_am.h" #include "catalog/pg_class.h" #include "commands/defrem.h" -#include "distributed/citus_clauses.h" -#include "distributed/colocation_utils.h" -#include "distributed/metadata_cache.h" -#include "distributed/insert_select_planner.h" -#include "distributed/listutils.h" -#include "distributed/multi_logical_optimizer.h" -#include "distributed/multi_logical_planner.h" -#include "distributed/multi_physical_planner.h" -#include "distributed/reference_table_utils.h" -#include "distributed/relation_restriction_equivalence.h" -#include "distributed/query_pushdown_planning.h" -#include "distributed/query_utils.h" -#include "distributed/multi_router_planner.h" -#include "distributed/worker_protocol.h" -#include "distributed/version_compat.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" #include "nodes/pathnodes.h" -#include "optimizer/optimizer.h" #include "optimizer/clauses.h" +#include "optimizer/optimizer.h" #include "optimizer/prep.h" #include "optimizer/tlist.h" #include "parser/parsetree.h" #include "utils/builtins.h" #include "utils/datum.h" #include "utils/lsyscache.h" -#include "utils/syscache.h" #include "utils/rel.h" #include "utils/relcache.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + +#include "distributed/citus_clauses.h" +#include "distributed/colocation_utils.h" +#include "distributed/insert_select_planner.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/multi_logical_optimizer.h" +#include "distributed/multi_logical_planner.h" +#include "distributed/multi_physical_planner.h" +#include "distributed/multi_router_planner.h" +#include "distributed/query_pushdown_planning.h" +#include "distributed/query_utils.h" +#include "distributed/reference_table_utils.h" +#include "distributed/relation_restriction_equivalence.h" +#include "distributed/version_compat.h" +#include "distributed/worker_protocol.h" /* Struct to differentiate different qualifier types in an expression tree walker */ diff --git a/src/backend/distributed/planner/multi_physical_planner.c b/src/backend/distributed/planner/multi_physical_planner.c index aa2c2b5b4dc..fb7f844c7b4 100644 --- a/src/backend/distributed/planner/multi_physical_planner.c +++ b/src/backend/distributed/planner/multi_physical_planner.c @@ -11,13 +11,11 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" - -#include "pg_version_constants.h" - #include #include +#include "postgres.h" + #include "miscadmin.h" #include "access/genam.h" @@ -33,56 +31,59 @@ #include "catalog/pg_type.h" #include "commands/defrem.h" #include "commands/sequence.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/pathnodes.h" +#include "nodes/print.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "optimizer/restrictinfo.h" +#include "optimizer/tlist.h" +#include "parser/parse_relation.h" +#include "parser/parse_type.h" +#include "parser/parsetree.h" +#include "rewrite/rewriteManip.h" +#include "utils/builtins.h" +#include "utils/catcache.h" +#include "utils/datum.h" +#include "utils/fmgroids.h" +#include "utils/guc.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" +#include "utils/rel.h" +#include "utils/syscache.h" +#include "utils/typcache.h" + +#include "pg_version_constants.h" + #include "distributed/backend_data.h" -#include "distributed/listutils.h" #include "distributed/citus_nodefuncs.h" #include "distributed/citus_nodes.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" -#include "distributed/deparse_shard_query.h" #include "distributed/coordinator_protocol.h" +#include "distributed/deparse_shard_query.h" #include "distributed/intermediate_results.h" +#include "distributed/listutils.h" +#include "distributed/log_utils.h" #include "distributed/metadata_cache.h" -#include "distributed/multi_router_planner.h" #include "distributed/multi_join_order.h" #include "distributed/multi_logical_optimizer.h" #include "distributed/multi_logical_planner.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/multi_physical_planner.h" -#include "distributed/log_utils.h" +#include "distributed/multi_router_planner.h" #include "distributed/pg_dist_partition.h" #include "distributed/pg_dist_shard.h" #include "distributed/query_pushdown_planning.h" #include "distributed/query_utils.h" #include "distributed/recursive_planning.h" -#include "distributed/shardinterval_utils.h" #include "distributed/shard_pruning.h" +#include "distributed/shardinterval_utils.h" #include "distributed/string_utils.h" +#include "distributed/version_compat.h" #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" -#include "distributed/version_compat.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/print.h" -#include "optimizer/clauses.h" -#include "nodes/pathnodes.h" -#include "optimizer/optimizer.h" -#include "optimizer/restrictinfo.h" -#include "optimizer/tlist.h" -#include "parser/parse_relation.h" -#include "parser/parse_type.h" -#include "parser/parsetree.h" -#include "rewrite/rewriteManip.h" -#include "utils/builtins.h" -#include "utils/catcache.h" -#include "utils/datum.h" -#include "utils/fmgroids.h" -#include "utils/guc.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" -#include "utils/rel.h" -#include "utils/syscache.h" -#include "utils/typcache.h" /* RepartitionJoinBucketCountPerNode determines bucket amount during repartitions */ int RepartitionJoinBucketCountPerNode = 4; diff --git a/src/backend/distributed/planner/multi_router_planner.c b/src/backend/distributed/planner/multi_router_planner.c index c0930ca3436..620d506a0af 100644 --- a/src/backend/distributed/planner/multi_router_planner.c +++ b/src/backend/distributed/planner/multi_router_planner.c @@ -11,77 +11,77 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" - -#include "pg_version_constants.h" - #include +#include "postgres.h" + #include "access/stratnum.h" #include "access/xact.h" #include "catalog/pg_opfamily.h" +#include "catalog/pg_proc.h" #include "catalog/pg_type.h" -#include "distributed/colocation_utils.h" +#include "executor/execdesc.h" +#include "lib/stringinfo.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/nodes.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "optimizer/clauses.h" +#include "optimizer/joininfo.h" +#include "optimizer/optimizer.h" +#include "optimizer/pathnode.h" +#include "optimizer/paths.h" +#include "optimizer/planmain.h" +#include "optimizer/restrictinfo.h" +#include "parser/parse_oper.h" +#include "parser/parsetree.h" +#include "postmaster/postmaster.h" +#include "storage/lock.h" +#include "utils/builtins.h" +#include "utils/elog.h" +#include "utils/errcodes.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" +#include "utils/typcache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_clauses.h" -#include "distributed/citus_nodes.h" #include "distributed/citus_nodefuncs.h" +#include "distributed/citus_nodes.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/colocation_utils.h" +#include "distributed/coordinator_protocol.h" #include "distributed/deparse_shard_query.h" #include "distributed/distribution_column.h" #include "distributed/errormessage.h" #include "distributed/executor_util.h" -#include "distributed/log_utils.h" #include "distributed/insert_select_planner.h" #include "distributed/intermediate_result_pruning.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" +#include "distributed/listutils.h" +#include "distributed/log_utils.h" #include "distributed/merge_planner.h" #include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_join_order.h" -#include "distributed/multi_logical_planner.h" #include "distributed/multi_logical_optimizer.h" +#include "distributed/multi_logical_planner.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/multi_physical_planner.h" #include "distributed/multi_router_planner.h" #include "distributed/multi_server_executor.h" -#include "distributed/listutils.h" -#include "distributed/citus_ruleutils.h" #include "distributed/query_pushdown_planning.h" #include "distributed/query_utils.h" +#include "distributed/recursive_planning.h" #include "distributed/reference_table_utils.h" #include "distributed/relation_restriction_equivalence.h" #include "distributed/relay_utility.h" -#include "distributed/recursive_planning.h" #include "distributed/resource_lock.h" -#include "distributed/shardinterval_utils.h" #include "distributed/shard_pruning.h" -#include "executor/execdesc.h" -#include "lib/stringinfo.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/nodes.h" -#include "nodes/parsenodes.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" -#include "optimizer/clauses.h" -#include "optimizer/joininfo.h" -#include "optimizer/pathnode.h" -#include "optimizer/paths.h" -#include "optimizer/optimizer.h" -#include "optimizer/restrictinfo.h" -#include "parser/parsetree.h" -#include "parser/parse_oper.h" -#include "postmaster/postmaster.h" -#include "storage/lock.h" -#include "utils/builtins.h" -#include "utils/elog.h" -#include "utils/errcodes.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" -#include "utils/typcache.h" - -#include "catalog/pg_proc.h" -#include "optimizer/planmain.h" +#include "distributed/shardinterval_utils.h" /* intermediate value for INSERT processing */ typedef struct InsertValues diff --git a/src/backend/distributed/planner/query_colocation_checker.c b/src/backend/distributed/planner/query_colocation_checker.c index fd1df1be969..827a0286c3a 100644 --- a/src/backend/distributed/planner/query_colocation_checker.c +++ b/src/backend/distributed/planner/query_colocation_checker.c @@ -21,26 +21,26 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "access/relation.h" -#include "distributed/multi_logical_planner.h" -#include "distributed/query_colocation_checker.h" -#include "distributed/pg_dist_partition.h" -#include "distributed/relation_restriction_equivalence.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_logical_planner.h" /* only to access utility functions */ - #include "catalog/pg_type.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" -#include "parser/parsetree.h" -#include "distributed/listutils.h" -#include "parser/parse_relation.h" #include "optimizer/planner.h" #include "optimizer/prep.h" +#include "parser/parse_relation.h" +#include "parser/parsetree.h" #include "utils/rel.h" +#include "pg_version_constants.h" + +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/multi_logical_planner.h" +#include "distributed/multi_logical_planner.h" /* only to access utility functions */ +#include "distributed/pg_dist_partition.h" +#include "distributed/query_colocation_checker.h" +#include "distributed/relation_restriction_equivalence.h" + static RangeTblEntry * AnchorRte(Query *subquery); static List * UnionRelationRestrictionLists(List *firstRelationList, diff --git a/src/backend/distributed/planner/query_pushdown_planning.c b/src/backend/distributed/planner/query_pushdown_planning.c index 8ccc35c82be..2eda4e42a76 100644 --- a/src/backend/distributed/planner/query_pushdown_planning.c +++ b/src/backend/distributed/planner/query_pushdown_planning.c @@ -21,6 +21,13 @@ #include "postgres.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/pg_list.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "parser/parsetree.h" + #include "pg_version_constants.h" #include "distributed/citus_clauses.h" @@ -32,17 +39,11 @@ #include "distributed/multi_logical_planner.h" #include "distributed/multi_router_planner.h" #include "distributed/pg_dist_partition.h" -#include "distributed/query_utils.h" #include "distributed/query_pushdown_planning.h" +#include "distributed/query_utils.h" #include "distributed/recursive_planning.h" #include "distributed/relation_restriction_equivalence.h" #include "distributed/version_compat.h" -#include "nodes/nodeFuncs.h" -#include "nodes/makefuncs.h" -#include "optimizer/optimizer.h" -#include "nodes/pg_list.h" -#include "optimizer/clauses.h" -#include "parser/parsetree.h" #define INVALID_RELID -1 diff --git a/src/backend/distributed/planner/recursive_planning.c b/src/backend/distributed/planner/recursive_planning.c index d16280662e2..6c42046ff5c 100644 --- a/src/backend/distributed/planner/recursive_planning.c +++ b/src/backend/distributed/planner/recursive_planning.c @@ -48,50 +48,49 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "funcapi.h" -#include "catalog/pg_type.h" #include "catalog/pg_class.h" +#include "catalog/pg_type.h" +#include "lib/stringinfo.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/nodes.h" +#include "nodes/pathnodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "optimizer/clauses.h" +#include "optimizer/optimizer.h" +#include "optimizer/planner.h" +#include "optimizer/prep.h" +#include "parser/parse_relation.h" +#include "parser/parsetree.h" +#include "utils/builtins.h" +#include "utils/guc.h" +#include "utils/lsyscache.h" + +#include "pg_version_constants.h" + #include "distributed/citus_nodes.h" #include "distributed/citus_ruleutils.h" #include "distributed/commands/multi_copy.h" #include "distributed/distributed_planner.h" #include "distributed/errormessage.h" -#include "distributed/local_distributed_join_planner.h" #include "distributed/listutils.h" +#include "distributed/local_distributed_join_planner.h" #include "distributed/log_utils.h" #include "distributed/metadata_cache.h" -#include "distributed/multi_logical_planner.h" #include "distributed/multi_logical_optimizer.h" -#include "distributed/multi_router_planner.h" +#include "distributed/multi_logical_planner.h" #include "distributed/multi_physical_planner.h" +#include "distributed/multi_router_planner.h" #include "distributed/multi_server_executor.h" #include "distributed/query_colocation_checker.h" #include "distributed/query_pushdown_planning.h" #include "distributed/recursive_planning.h" #include "distributed/relation_restriction_equivalence.h" -#include "distributed/log_utils.h" #include "distributed/shard_pruning.h" #include "distributed/version_compat.h" -#include "lib/stringinfo.h" -#include "optimizer/clauses.h" -#include "optimizer/optimizer.h" -#include "optimizer/planner.h" -#include "optimizer/prep.h" -#include "parser/parse_relation.h" -#include "parser/parsetree.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "nodes/nodes.h" -#include "nodes/nodeFuncs.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" -#include "nodes/pathnodes.h" -#include "utils/builtins.h" -#include "utils/guc.h" -#include "utils/lsyscache.h" /* * RecursivePlanningContext is used to recursively plan subqueries diff --git a/src/backend/distributed/planner/relation_restriction_equivalence.c b/src/backend/distributed/planner/relation_restriction_equivalence.c index 4b51a537d4e..83d7cbcdb77 100644 --- a/src/backend/distributed/planner/relation_restriction_equivalence.c +++ b/src/backend/distributed/planner/relation_restriction_equivalence.c @@ -10,31 +10,31 @@ */ #include "postgres.h" +#include "catalog/pg_type.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "nodes/pathnodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "optimizer/optimizer.h" +#include "optimizer/pathnode.h" +#include "optimizer/paths.h" +#include "parser/parsetree.h" + #include "pg_version_constants.h" #include "distributed/colocation_utils.h" #include "distributed/distributed_planner.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" -#include "distributed/multi_logical_planner.h" #include "distributed/multi_logical_optimizer.h" +#include "distributed/multi_logical_planner.h" #include "distributed/multi_router_planner.h" #include "distributed/pg_dist_partition.h" #include "distributed/query_utils.h" #include "distributed/relation_restriction_equivalence.h" #include "distributed/shard_pruning.h" -#include "catalog/pg_type.h" -#include "nodes/nodeFuncs.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" -#include "nodes/pathnodes.h" -#include "optimizer/optimizer.h" -#include "nodes/makefuncs.h" -#include "optimizer/paths.h" -#include "parser/parsetree.h" -#include "optimizer/pathnode.h" - static uint32 AttributeEquivalenceId = 1; diff --git a/src/backend/distributed/planner/shard_pruning.c b/src/backend/distributed/planner/shard_pruning.c index ef244ea66f0..e68ac72b01c 100644 --- a/src/backend/distributed/planner/shard_pruning.c +++ b/src/backend/distributed/planner/shard_pruning.c @@ -66,28 +66,14 @@ */ #include "postgres.h" -#include "pg_version_constants.h" - #include "fmgr.h" -#include "distributed/shard_pruning.h" - #include "access/nbtree.h" #include "catalog/pg_am.h" #include "catalog/pg_collation.h" #include "catalog/pg_type.h" -#include "distributed/distributed_planner.h" -#include "distributed/listutils.h" -#include "distributed/log_utils.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_join_order.h" -#include "distributed/multi_physical_planner.h" -#include "distributed/pg_dist_partition.h" -#include "distributed/shardinterval_utils.h" -#include "distributed/version_compat.h" -#include "distributed/worker_protocol.h" -#include "nodes/nodeFuncs.h" #include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" #include "optimizer/clauses.h" #include "optimizer/planner.h" #include "parser/parse_coerce.h" @@ -98,6 +84,20 @@ #include "utils/memutils.h" #include "utils/ruleutils.h" +#include "pg_version_constants.h" + +#include "distributed/distributed_planner.h" +#include "distributed/listutils.h" +#include "distributed/log_utils.h" +#include "distributed/metadata_cache.h" +#include "distributed/multi_join_order.h" +#include "distributed/multi_physical_planner.h" +#include "distributed/pg_dist_partition.h" +#include "distributed/shard_pruning.h" +#include "distributed/shardinterval_utils.h" +#include "distributed/version_compat.h" +#include "distributed/worker_protocol.h" + /* * Tree node for compact representation of the given query logical tree. diff --git a/src/backend/distributed/planner/tdigest_extension.c b/src/backend/distributed/planner/tdigest_extension.c index 123b170d4a4..3a3701940ba 100644 --- a/src/backend/distributed/planner/tdigest_extension.c +++ b/src/backend/distributed/planner/tdigest_extension.c @@ -12,13 +12,14 @@ #include "access/htup_details.h" #include "catalog/pg_extension.h" #include "catalog/pg_type.h" -#include "distributed/metadata_cache.h" -#include "distributed/tdigest_extension.h" -#include "distributed/version_compat.h" #include "parser/parse_func.h" #include "utils/fmgroids.h" #include "utils/lsyscache.h" +#include "distributed/metadata_cache.h" +#include "distributed/tdigest_extension.h" +#include "distributed/version_compat.h" + static Oid LookupTDigestFunction(const char *functionName, int argcount, Oid *argtypes); diff --git a/src/backend/distributed/progress/multi_progress.c b/src/backend/distributed/progress/multi_progress.c index 8a3adf4bc87..64e0a5b4762 100644 --- a/src/backend/distributed/progress/multi_progress.c +++ b/src/backend/distributed/progress/multi_progress.c @@ -8,15 +8,17 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "pgstat.h" +#include "storage/dsm.h" +#include "utils/builtins.h" + #include "distributed/function_utils.h" #include "distributed/listutils.h" #include "distributed/multi_progress.h" #include "distributed/version_compat.h" -#include "storage/dsm.h" -#include "utils/builtins.h" /* dynamic shared memory handle of the current progress */ diff --git a/src/backend/distributed/relay/relay_event_utility.c b/src/backend/distributed/relay/relay_event_utility.c index 3284ead1172..d0267025bcc 100644 --- a/src/backend/distributed/relay/relay_event_utility.c +++ b/src/backend/distributed/relay/relay_event_utility.c @@ -12,34 +12,28 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" -#include "c.h" - #include #include +#include "postgres.h" + +#include "c.h" + #include "access/genam.h" -#include "access/heapam.h" -#include "access/htup_details.h" #include "access/hash.h" +#include "access/heapam.h" #include "access/htup.h" +#include "access/htup_details.h" #include "access/skey.h" #include "access/stratnum.h" #include "catalog/indexing.h" #include "catalog/namespace.h" #include "catalog/pg_class.h" #include "catalog/pg_constraint.h" -#include "distributed/citus_safe_lib.h" -#include "distributed/commands.h" -#include "distributed/listutils.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_partitioning_utils.h" -#include "distributed/relay_utility.h" -#include "distributed/version_compat.h" #include "lib/stringinfo.h" #include "mb/pg_wchar.h" -#include "nodes/nodes.h" #include "nodes/nodeFuncs.h" +#include "nodes/nodes.h" #include "nodes/parsenodes.h" #include "nodes/pg_list.h" #include "nodes/primnodes.h" @@ -53,6 +47,14 @@ #include "utils/palloc.h" #include "utils/relcache.h" +#include "distributed/citus_safe_lib.h" +#include "distributed/commands.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/multi_partitioning_utils.h" +#include "distributed/relay_utility.h" +#include "distributed/version_compat.h" + /* Local functions forward declarations */ static void RelayEventExtendConstraintAndIndexNames(AlterTableStmt *alterTableStmt, Constraint *constraint, diff --git a/src/backend/distributed/replication/multi_logical_replication.c b/src/backend/distributed/replication/multi_logical_replication.c index 97f6fdb3d35..c25856ffd69 100644 --- a/src/backend/distributed/replication/multi_logical_replication.c +++ b/src/backend/distributed/replication/multi_logical_replication.c @@ -10,61 +10,61 @@ *------------------------------------------------------------------------- */ #include "postgres.h" -#include "miscadmin.h" + #include "fmgr.h" -#include "pgstat.h" #include "libpq-fe.h" - -#include "pg_version_constants.h" +#include "miscadmin.h" +#include "pgstat.h" #include "access/genam.h" - -#include "postmaster/interrupt.h" - #include "access/htup_details.h" #include "access/sysattr.h" #include "access/xact.h" -#include "commands/dbcommands.h" -#include "common/hashfn.h" -#include "catalog/pg_subscription_rel.h" #include "catalog/namespace.h" #include "catalog/pg_constraint.h" +#include "catalog/pg_subscription_rel.h" +#include "commands/dbcommands.h" +#include "common/hashfn.h" +#include "nodes/bitmapset.h" +#include "parser/scansup.h" +#include "postmaster/interrupt.h" +#include "storage/ipc.h" +#include "storage/latch.h" +#include "storage/lock.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/fmgrprotos.h" +#include "utils/formatting.h" +#include "utils/guc.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/pg_lsn.h" +#include "utils/rel.h" +#include "utils/ruleutils.h" +#include "utils/syscache.h" + +#include "pg_version_constants.h" + #include "distributed/adaptive_executor.h" #include "distributed/citus_safe_lib.h" #include "distributed/colocation_utils.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/distributed_planner.h" #include "distributed/hash_helpers.h" #include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" #include "distributed/multi_join_order.h" #include "distributed/multi_logical_replication.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/priority.h" -#include "distributed/distributed_planner.h" #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" #include "distributed/shard_cleaner.h" #include "distributed/shard_rebalancer.h" #include "distributed/shard_transfer.h" #include "distributed/version_compat.h" -#include "nodes/bitmapset.h" -#include "parser/scansup.h" -#include "storage/ipc.h" -#include "storage/latch.h" -#include "storage/lock.h" -#include "utils/guc.h" -#include "utils/builtins.h" -#include "utils/fmgrprotos.h" -#include "utils/fmgroids.h" -#include "utils/formatting.h" -#include "utils/inval.h" -#include "utils/lsyscache.h" -#include "utils/pg_lsn.h" -#include "utils/rel.h" -#include "utils/ruleutils.h" -#include "utils/syscache.h" #define CURRENT_LOG_POSITION_COMMAND "SELECT pg_current_wal_lsn()" diff --git a/src/backend/distributed/shardsplit/shardsplit_decoder.c b/src/backend/distributed/shardsplit/shardsplit_decoder.c index 7145b4dfa69..f14f105576c 100644 --- a/src/backend/distributed/shardsplit/shardsplit_decoder.c +++ b/src/backend/distributed/shardsplit/shardsplit_decoder.c @@ -8,16 +8,18 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + +#include "catalog/pg_namespace.h" +#include "replication/logical.h" +#include "utils/lsyscache.h" +#include "utils/typcache.h" + +#include "distributed/listutils.h" +#include "distributed/metadata/distobject.h" #include "distributed/shardinterval_utils.h" #include "distributed/shardsplit_shared_memory.h" -#include "distributed/worker_shard_visibility.h" #include "distributed/worker_protocol.h" -#include "distributed/listutils.h" -#include "distributed/metadata/distobject.h" -#include "replication/logical.h" -#include "utils/typcache.h" -#include "utils/lsyscache.h" -#include "catalog/pg_namespace.h" +#include "distributed/worker_shard_visibility.h" extern void _PG_output_plugin_init(OutputPluginCallbacks *cb); static LogicalDecodeChangeCB pgOutputPluginChangeCB; diff --git a/src/backend/distributed/shardsplit/shardsplit_logical_replication.c b/src/backend/distributed/shardsplit/shardsplit_logical_replication.c index 8ffccb90c64..328dc9af946 100644 --- a/src/backend/distributed/shardsplit/shardsplit_logical_replication.c +++ b/src/backend/distributed/shardsplit/shardsplit_logical_replication.c @@ -10,23 +10,26 @@ */ #include "postgres.h" + #include "miscadmin.h" + +#include "commands/dbcommands.h" #include "nodes/pg_list.h" +#include "utils/builtins.h" + #include "distributed/colocation_utils.h" +#include "distributed/connection_management.h" #include "distributed/hash_helpers.h" +#include "distributed/listutils.h" #include "distributed/metadata_cache.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/priority.h" -#include "distributed/shardinterval_utils.h" -#include "distributed/connection_management.h" #include "distributed/remote_commands.h" +#include "distributed/resource_lock.h" #include "distributed/shard_split.h" -#include "distributed/shared_library_init.h" -#include "distributed/listutils.h" +#include "distributed/shardinterval_utils.h" #include "distributed/shardsplit_logical_replication.h" -#include "distributed/resource_lock.h" -#include "utils/builtins.h" -#include "commands/dbcommands.h" +#include "distributed/shared_library_init.h" static HTAB *ShardInfoHashMapForPublications = NULL; diff --git a/src/backend/distributed/shardsplit/shardsplit_shared_memory.c b/src/backend/distributed/shardsplit/shardsplit_shared_memory.c index 3e874575844..16ed79ad7be 100644 --- a/src/backend/distributed/shardsplit/shardsplit_shared_memory.c +++ b/src/backend/distributed/shardsplit/shardsplit_shared_memory.c @@ -12,13 +12,15 @@ */ #include "postgres.h" -#include "distributed/shardinterval_utils.h" -#include "distributed/shardsplit_shared_memory.h" -#include "distributed/citus_safe_lib.h" -#include "distributed/multi_logical_replication.h" + +#include "common/hashfn.h" #include "storage/ipc.h" #include "utils/memutils.h" -#include "common/hashfn.h" + +#include "distributed/citus_safe_lib.h" +#include "distributed/multi_logical_replication.h" +#include "distributed/shardinterval_utils.h" +#include "distributed/shardsplit_shared_memory.h" const char *SharedMemoryNameForHandleManagement = "Shared memory handle for shard split"; diff --git a/src/backend/distributed/shared_library_init.c b/src/backend/distributed/shared_library_init.c index 9b5768ee7ab..46abe0e30c7 100644 --- a/src/backend/distributed/shared_library_init.c +++ b/src/backend/distributed/shared_library_init.c @@ -7,12 +7,12 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" - #include #include #include +#include "postgres.h" + /* necessary to get alloca on illumos */ #ifdef __sun #include @@ -20,75 +20,92 @@ #include "fmgr.h" #include "miscadmin.h" - #include "safe_lib.h" -#include "catalog/pg_authid.h" #include "catalog/objectaccess.h" +#include "catalog/pg_authid.h" #include "catalog/pg_extension.h" -#include "citus_version.h" #include "commands/explain.h" #include "commands/extension.h" #include "common/string.h" #include "executor/executor.h" +#include "libpq/auth.h" +#include "optimizer/paths.h" +#include "optimizer/plancat.h" +#include "optimizer/planner.h" +#include "port/atomics.h" +#include "postmaster/postmaster.h" +#include "replication/walsender.h" +#include "storage/ipc.h" +#include "tcop/tcopprot.h" +#include "utils/guc.h" +#include "utils/guc_tables.h" +#include "utils/inval.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" +#include "utils/varlena.h" + +#include "citus_version.h" + +#include "columnar/columnar.h" + +#include "distributed/adaptive_executor.h" #include "distributed/backend_data.h" #include "distributed/background_jobs.h" #include "distributed/causal_clock.h" #include "distributed/citus_depended_object.h" #include "distributed/citus_nodefuncs.h" #include "distributed/citus_safe_lib.h" +#include "distributed/combine_query_planner.h" #include "distributed/commands.h" #include "distributed/commands/multi_copy.h" #include "distributed/commands/utility_hook.h" #include "distributed/connection_management.h" +#include "distributed/coordinator_protocol.h" #include "distributed/cte_inline.h" #include "distributed/distributed_deadlock_detection.h" +#include "distributed/distributed_planner.h" #include "distributed/errormessage.h" -#include "distributed/repartition_executor.h" #include "distributed/intermediate_result_pruning.h" -#include "distributed/local_multi_copy.h" -#include "distributed/local_executor.h" #include "distributed/local_distributed_join_planner.h" +#include "distributed/local_executor.h" +#include "distributed/local_multi_copy.h" #include "distributed/locally_reserved_shared_connections.h" #include "distributed/log_utils.h" #include "distributed/maintenanced.h" -#include "distributed/shard_cleaner.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" -#include "distributed/multi_physical_planner.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_explain.h" #include "distributed/multi_join_order.h" -#include "distributed/multi_logical_replication.h" #include "distributed/multi_logical_optimizer.h" -#include "distributed/distributed_planner.h" -#include "distributed/combine_query_planner.h" +#include "distributed/multi_logical_replication.h" +#include "distributed/multi_physical_planner.h" #include "distributed/multi_router_planner.h" #include "distributed/multi_server_executor.h" #include "distributed/pg_dist_partition.h" #include "distributed/placement_connection.h" #include "distributed/priority.h" +#include "distributed/query_pushdown_planning.h" #include "distributed/query_stats.h" #include "distributed/recursive_planning.h" #include "distributed/reference_table_utils.h" #include "distributed/relation_access_tracking.h" +#include "distributed/remote_commands.h" +#include "distributed/repartition_executor.h" #include "distributed/replication_origin_session_utils.h" +#include "distributed/resource_lock.h" #include "distributed/run_from_same_connection.h" #include "distributed/shard_cleaner.h" +#include "distributed/shard_rebalancer.h" #include "distributed/shard_transfer.h" -#include "distributed/shared_connection_stats.h" #include "distributed/shardsplit_shared_memory.h" -#include "distributed/query_pushdown_planning.h" -#include "distributed/time_constants.h" -#include "distributed/query_stats.h" -#include "distributed/remote_commands.h" -#include "distributed/shard_rebalancer.h" +#include "distributed/shared_connection_stats.h" #include "distributed/shared_library_init.h" #include "distributed/statistics_collection.h" #include "distributed/subplan_execution.h" -#include "distributed/resource_lock.h" +#include "distributed/time_constants.h" #include "distributed/transaction_management.h" #include "distributed/transaction_recovery.h" #include "distributed/utils/citus_stat_tenants.h" @@ -97,24 +114,6 @@ #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" #include "distributed/worker_shard_visibility.h" -#include "distributed/adaptive_executor.h" -#include "libpq/auth.h" -#include "port/atomics.h" -#include "postmaster/postmaster.h" -#include "replication/walsender.h" -#include "storage/ipc.h" -#include "optimizer/planner.h" -#include "optimizer/plancat.h" -#include "optimizer/paths.h" -#include "tcop/tcopprot.h" -#include "utils/guc.h" -#include "utils/guc_tables.h" -#include "utils/inval.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" -#include "utils/varlena.h" - -#include "columnar/columnar.h" /* marks shared object as one loadable by the postgres version compiled against */ PG_MODULE_MAGIC; diff --git a/src/backend/distributed/test/backend_counter.c b/src/backend/distributed/test/backend_counter.c index 1b9984ac9e0..f3f19f0d312 100644 --- a/src/backend/distributed/test/backend_counter.c +++ b/src/backend/distributed/test/backend_counter.c @@ -11,6 +11,7 @@ */ #include "postgres.h" + #include "fmgr.h" #include "distributed/backend_data.h" diff --git a/src/backend/distributed/test/citus_depended_object.c b/src/backend/distributed/test/citus_depended_object.c index 4e1e919e814..77fc2e4827c 100644 --- a/src/backend/distributed/test/citus_depended_object.c +++ b/src/backend/distributed/test/citus_depended_object.c @@ -13,17 +13,17 @@ #include "catalog/pg_am.h" #include "catalog/pg_amop.h" #include "catalog/pg_amproc.h" -#include "catalog/pg_attribute.h" #include "catalog/pg_attrdef.h" -#include "catalog/pg_constraint.h" +#include "catalog/pg_attribute.h" #include "catalog/pg_class.h" +#include "catalog/pg_constraint.h" #include "catalog/pg_depend.h" #include "catalog/pg_enum.h" #include "catalog/pg_event_trigger.h" #include "catalog/pg_language.h" #include "catalog/pg_namespace.h" -#include "catalog/pg_operator.h" #include "catalog/pg_opclass.h" +#include "catalog/pg_operator.h" #include "catalog/pg_opfamily.h" #include "catalog/pg_proc.h" #include "catalog/pg_rewrite.h" @@ -34,11 +34,12 @@ #include "catalog/pg_ts_dict.h" #include "catalog/pg_ts_template.h" #include "catalog/pg_type.h" + #include "distributed/citus_depended_object.h" #include "distributed/listutils.h" -#include "distributed/metadata_cache.h" #include "distributed/metadata/dependency.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata_cache.h" static bool IsCitusDependentObject(ObjectAddress objectAddress); diff --git a/src/backend/distributed/test/citus_stat_tenants.c b/src/backend/distributed/test/citus_stat_tenants.c index 2cfe0029b6e..b8fe305c634 100644 --- a/src/backend/distributed/test/citus_stat_tenants.c +++ b/src/backend/distributed/test/citus_stat_tenants.c @@ -10,11 +10,13 @@ */ #include "postgres.h" + #include "fmgr.h" -#include "distributed/utils/citus_stat_tenants.h" #include "sys/time.h" +#include "distributed/utils/citus_stat_tenants.h" + PG_FUNCTION_INFO_V1(sleep_until_next_period); /* diff --git a/src/backend/distributed/test/colocation_utils.c b/src/backend/distributed/test/colocation_utils.c index 19a4e166461..6a87539c46b 100644 --- a/src/backend/distributed/test/colocation_utils.c +++ b/src/backend/distributed/test/colocation_utils.c @@ -11,9 +11,11 @@ */ #include "postgres.h" + #include "fmgr.h" #include "catalog/pg_type.h" + #include "distributed/colocation_utils.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" diff --git a/src/backend/distributed/test/create_shards.c b/src/backend/distributed/test/create_shards.c index 4ed1db7c712..4ef13f1cb78 100644 --- a/src/backend/distributed/test/create_shards.c +++ b/src/backend/distributed/test/create_shards.c @@ -10,16 +10,18 @@ *------------------------------------------------------------------------- */ +#include + #include "postgres.h" + #include "c.h" #include "fmgr.h" -#include - -#include "distributed/listutils.h" #include "lib/stringinfo.h" #include "nodes/pg_list.h" +#include "distributed/listutils.h" + /* local function forward declarations */ static int CompareStrings(const void *leftElement, const void *rightElement); diff --git a/src/backend/distributed/test/deparse_function_query.c b/src/backend/distributed/test/deparse_function_query.c index 7a6e54424ac..8971f597a7d 100644 --- a/src/backend/distributed/test/deparse_function_query.c +++ b/src/backend/distributed/test/deparse_function_query.c @@ -13,9 +13,10 @@ #include "postgres.h" +#include "utils/builtins.h" + #include "distributed/deparser.h" #include "distributed/multi_executor.h" -#include "utils/builtins.h" /* declarations for dynamic loading */ PG_FUNCTION_INFO_V1(deparse_test); diff --git a/src/backend/distributed/test/deparse_shard_query.c b/src/backend/distributed/test/deparse_shard_query.c index a6196146fef..a9b4ced1da4 100644 --- a/src/backend/distributed/test/deparse_shard_query.c +++ b/src/backend/distributed/test/deparse_shard_query.c @@ -10,18 +10,14 @@ *------------------------------------------------------------------------- */ +#include + #include "postgres.h" + #include "c.h" #include "fmgr.h" -#include - #include "catalog/pg_type.h" -#include "distributed/listutils.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/insert_select_planner.h" -#include "distributed/multi_router_planner.h" #include "lib/stringinfo.h" #include "nodes/makefuncs.h" #include "nodes/nodes.h" @@ -33,6 +29,12 @@ #include "utils/builtins.h" #include "utils/palloc.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/insert_select_planner.h" +#include "distributed/listutils.h" +#include "distributed/multi_router_planner.h" + /* declarations for dynamic loading */ PG_FUNCTION_INFO_V1(deparse_shard_query_test); diff --git a/src/backend/distributed/test/dependency.c b/src/backend/distributed/test/dependency.c index 82e818b8ce1..7afbfdec732 100644 --- a/src/backend/distributed/test/dependency.c +++ b/src/backend/distributed/test/dependency.c @@ -9,6 +9,7 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + #include "c.h" #include "fmgr.h" diff --git a/src/backend/distributed/test/distributed_deadlock_detection.c b/src/backend/distributed/test/distributed_deadlock_detection.c index d3fa34db284..68b5622a72d 100644 --- a/src/backend/distributed/test/distributed_deadlock_detection.c +++ b/src/backend/distributed/test/distributed_deadlock_detection.c @@ -10,10 +10,15 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" #include "access/hash.h" +#include "nodes/pg_list.h" +#include "utils/hsearch.h" +#include "utils/timestamp.h" + #include "distributed/backend_data.h" #include "distributed/distributed_deadlock_detection.h" #include "distributed/hash_helpers.h" @@ -22,9 +27,6 @@ #include "distributed/metadata_cache.h" #include "distributed/transaction_identifier.h" #include "distributed/tuplestore.h" -#include "nodes/pg_list.h" -#include "utils/hsearch.h" -#include "utils/timestamp.h" PG_FUNCTION_INFO_V1(get_adjacency_list_wait_graph); diff --git a/src/backend/distributed/test/distributed_intermediate_results.c b/src/backend/distributed/test/distributed_intermediate_results.c index c3b286f526b..843bda476aa 100644 --- a/src/backend/distributed/test/distributed_intermediate_results.c +++ b/src/backend/distributed/test/distributed_intermediate_results.c @@ -13,12 +13,15 @@ #include #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" #include "pgstat.h" #include "catalog/pg_type.h" +#include "tcop/tcopprot.h" + #include "distributed/commands/multi_copy.h" #include "distributed/connection_management.h" #include "distributed/intermediate_results.h" @@ -26,10 +29,8 @@ #include "distributed/multi_executor.h" #include "distributed/remote_commands.h" #include "distributed/tuplestore.h" -#include "distributed/listutils.h" #include "distributed/utils/array_type.h" #include "distributed/version_compat.h" -#include "tcop/tcopprot.h" PG_FUNCTION_INFO_V1(partition_task_list_results); PG_FUNCTION_INFO_V1(redistribute_task_list_results); diff --git a/src/backend/distributed/test/distribution_metadata.c b/src/backend/distributed/test/distribution_metadata.c index c3bc7fb5189..01117922e36 100644 --- a/src/backend/distributed/test/distribution_metadata.c +++ b/src/backend/distributed/test/distribution_metadata.c @@ -10,37 +10,39 @@ *------------------------------------------------------------------------- */ +#include +#include + #include "postgres.h" + #include "c.h" #include "fmgr.h" -#include -#include - #include "access/heapam.h" #include "catalog/pg_type.h" -#include "distributed/distribution_column.h" -#include "distributed/listutils.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_join_order.h" -#include "distributed/multi_physical_planner.h" -#include "distributed/pg_dist_shard.h" -#include "distributed/query_utils.h" -#include "distributed/resource_lock.h" -#include "distributed/utils/array_type.h" #include "lib/stringinfo.h" #include "nodes/pg_list.h" #include "nodes/primnodes.h" #include "storage/lock.h" #include "tcop/tcopprot.h" #include "utils/array.h" +#include "utils/builtins.h" #include "utils/elog.h" #include "utils/errcodes.h" -#include "utils/builtins.h" #include "utils/palloc.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/distribution_column.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" +#include "distributed/multi_join_order.h" +#include "distributed/multi_physical_planner.h" +#include "distributed/pg_dist_shard.h" +#include "distributed/query_utils.h" +#include "distributed/resource_lock.h" +#include "distributed/utils/array_type.h" + /* declarations for dynamic loading */ PG_FUNCTION_INFO_V1(load_shard_id_array); diff --git a/src/backend/distributed/test/fake_am.c b/src/backend/distributed/test/fake_am.c index 4b11d7871e1..cff124961ac 100644 --- a/src/backend/distributed/test/fake_am.c +++ b/src/backend/distributed/test/fake_am.c @@ -19,14 +19,10 @@ #include "postgres.h" -#include "pg_version_constants.h" -#include "pg_version_compat.h" - - #include "access/amapi.h" #include "access/heapam.h" -#include "access/tableam.h" #include "access/multixact.h" +#include "access/tableam.h" #include "access/xact.h" #include "catalog/index.h" #include "catalog/storage.h" @@ -36,6 +32,9 @@ #include "storage/smgr.h" #include "utils/snapmgr.h" +#include "pg_version_compat.h" +#include "pg_version_constants.h" + PG_FUNCTION_INFO_V1(fake_am_handler); static const TableAmRoutine fake_methods; diff --git a/src/backend/distributed/test/fake_fdw.c b/src/backend/distributed/test/fake_fdw.c index f53242f7f28..585e61d4108 100644 --- a/src/backend/distributed/test/fake_fdw.c +++ b/src/backend/distributed/test/fake_fdw.c @@ -10,27 +10,27 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" +#include -#include "pg_version_constants.h" +#include "postgres.h" #include "c.h" #include "fmgr.h" -#include - #include "executor/tuptable.h" #include "foreign/fdwapi.h" #include "nodes/execnodes.h" #include "nodes/nodes.h" +#include "nodes/pathnodes.h" #include "nodes/pg_list.h" #include "nodes/plannodes.h" -#include "nodes/pathnodes.h" #include "optimizer/pathnode.h" #include "optimizer/planmain.h" #include "optimizer/restrictinfo.h" #include "utils/palloc.h" +#include "pg_version_constants.h" + /* local function forward declarations */ static void FakeGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid); diff --git a/src/backend/distributed/test/foreign_key_relationship_query.c b/src/backend/distributed/test/foreign_key_relationship_query.c index 545c2e97006..af187111a70 100644 --- a/src/backend/distributed/test/foreign_key_relationship_query.c +++ b/src/backend/distributed/test/foreign_key_relationship_query.c @@ -11,18 +11,20 @@ */ #include "postgres.h" + #include "fmgr.h" #include "funcapi.h" #include "catalog/dependency.h" #include "catalog/pg_constraint.h" -#include "distributed/foreign_key_relationship.h" +#include "utils/builtins.h" + #include "distributed/coordinator_protocol.h" +#include "distributed/foreign_key_relationship.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" #include "distributed/tuplestore.h" #include "distributed/version_compat.h" -#include "utils/builtins.h" #define GET_FKEY_CONNECTED_RELATIONS_COLUMNS 1 diff --git a/src/backend/distributed/test/global_pid.c b/src/backend/distributed/test/global_pid.c index de54f1929f2..b63b39b444e 100644 --- a/src/backend/distributed/test/global_pid.c +++ b/src/backend/distributed/test/global_pid.c @@ -10,6 +10,7 @@ */ #include "postgres.h" + #include "fmgr.h" #include "distributed/backend_data.h" diff --git a/src/backend/distributed/test/hide_shards.c b/src/backend/distributed/test/hide_shards.c index 59e738c360e..b1adf61b40a 100644 --- a/src/backend/distributed/test/hide_shards.c +++ b/src/backend/distributed/test/hide_shards.c @@ -10,6 +10,7 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" #include "pgstat.h" diff --git a/src/backend/distributed/test/intermediate_results.c b/src/backend/distributed/test/intermediate_results.c index b4f14bca6af..8681a6ca928 100644 --- a/src/backend/distributed/test/intermediate_results.c +++ b/src/backend/distributed/test/intermediate_results.c @@ -13,6 +13,7 @@ #include #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" diff --git a/src/backend/distributed/test/make_external_connection.c b/src/backend/distributed/test/make_external_connection.c index 424793deadd..14be057ab0b 100644 --- a/src/backend/distributed/test/make_external_connection.c +++ b/src/backend/distributed/test/make_external_connection.c @@ -11,10 +11,17 @@ */ #include "postgres.h" -#include "miscadmin.h" + #include "libpq-fe.h" +#include "miscadmin.h" #include "access/xact.h" +#include "executor/spi.h" +#include "lib/stringinfo.h" +#include "postmaster/postmaster.h" +#include "utils/builtins.h" +#include "utils/memutils.h" + #include "distributed/connection_management.h" #include "distributed/coordinator_protocol.h" #include "distributed/function_utils.h" @@ -23,13 +30,7 @@ #include "distributed/metadata_cache.h" #include "distributed/remote_commands.h" #include "distributed/run_from_same_connection.h" - #include "distributed/version_compat.h" -#include "executor/spi.h" -#include "lib/stringinfo.h" -#include "postmaster/postmaster.h" -#include "utils/builtins.h" -#include "utils/memutils.h" PG_FUNCTION_INFO_V1(make_external_connection_to_node); diff --git a/src/backend/distributed/test/metadata_sync.c b/src/backend/distributed/test/metadata_sync.c index 8ad4b15f29d..d6aeb842c6a 100644 --- a/src/backend/distributed/test/metadata_sync.c +++ b/src/backend/distributed/test/metadata_sync.c @@ -10,10 +10,17 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + #include "c.h" #include "fmgr.h" +#include "miscadmin.h" #include "catalog/pg_type.h" +#include "postmaster/postmaster.h" +#include "storage/latch.h" +#include "utils/array.h" +#include "utils/builtins.h" + #include "distributed/connection_management.h" #include "distributed/intermediate_result_pruning.h" #include "distributed/listutils.h" @@ -22,11 +29,6 @@ #include "distributed/remote_commands.h" #include "distributed/utils/array_type.h" #include "distributed/worker_manager.h" -#include "postmaster/postmaster.h" -#include "miscadmin.h" -#include "storage/latch.h" -#include "utils/array.h" -#include "utils/builtins.h" /* declarations for dynamic loading */ diff --git a/src/backend/distributed/test/partitioning_utils.c b/src/backend/distributed/test/partitioning_utils.c index 95adaddf6fd..be916356145 100644 --- a/src/backend/distributed/test/partitioning_utils.c +++ b/src/backend/distributed/test/partitioning_utils.c @@ -10,16 +10,18 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + #include "fmgr.h" #include "catalog/pg_type.h" -#include "distributed/listutils.h" -#include "distributed/multi_partitioning_utils.h" -#include "distributed/reference_table_utils.h" #include "lib/stringinfo.h" #include "utils/builtins.h" #include "utils/lsyscache.h" +#include "distributed/listutils.h" +#include "distributed/multi_partitioning_utils.h" +#include "distributed/reference_table_utils.h" + PG_FUNCTION_INFO_V1(generate_alter_table_detach_partition_command); PG_FUNCTION_INFO_V1(generate_alter_table_attach_partition_command); diff --git a/src/backend/distributed/test/progress_utils.c b/src/backend/distributed/test/progress_utils.c index 42b065dae21..e1ea09e3d2f 100644 --- a/src/backend/distributed/test/progress_utils.c +++ b/src/backend/distributed/test/progress_utils.c @@ -11,18 +11,20 @@ */ +#include + #include "postgres.h" -#include "miscadmin.h" + #include "fmgr.h" #include "funcapi.h" +#include "miscadmin.h" -#include +#include "nodes/execnodes.h" +#include "utils/tuplestore.h" #include "distributed/listutils.h" #include "distributed/multi_progress.h" #include "distributed/tuplestore.h" -#include "nodes/execnodes.h" -#include "utils/tuplestore.h" PG_FUNCTION_INFO_V1(create_progress); diff --git a/src/backend/distributed/test/prune_shard_list.c b/src/backend/distributed/test/prune_shard_list.c index 023a759cbe7..f972281ecc6 100644 --- a/src/backend/distributed/test/prune_shard_list.c +++ b/src/backend/distributed/test/prune_shard_list.c @@ -10,25 +10,15 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" +#include -#include "pg_version_constants.h" +#include "postgres.h" #include "c.h" #include "fmgr.h" -#include - #include "access/stratnum.h" #include "catalog/pg_type.h" -#include "distributed/listutils.h" -#include "distributed/metadata_cache.h" -#include "distributed/metadata_utility.h" -#include "distributed/multi_join_order.h" -#include "distributed/multi_physical_planner.h" -#include "distributed/resource_lock.h" -#include "distributed/shard_pruning.h" -#include "distributed/utils/array_type.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" #include "nodes/nodes.h" @@ -38,6 +28,17 @@ #include "utils/array.h" #include "utils/palloc.h" +#include "pg_version_constants.h" + +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" +#include "distributed/multi_join_order.h" +#include "distributed/multi_physical_planner.h" +#include "distributed/resource_lock.h" +#include "distributed/shard_pruning.h" +#include "distributed/utils/array_type.h" + /* local function forward declarations */ static Expr * MakeTextPartitionExpression(Oid distributedTableId, text *value); diff --git a/src/backend/distributed/test/relation_access_tracking.c b/src/backend/distributed/test/relation_access_tracking.c index 5715bd03d61..85c0ff2aacf 100644 --- a/src/backend/distributed/test/relation_access_tracking.c +++ b/src/backend/distributed/test/relation_access_tracking.c @@ -10,6 +10,7 @@ */ #include "postgres.h" + #include "c.h" #include "fmgr.h" diff --git a/src/backend/distributed/test/run_from_same_connection.c b/src/backend/distributed/test/run_from_same_connection.c index 04a3149dafa..5663a42fa73 100644 --- a/src/backend/distributed/test/run_from_same_connection.c +++ b/src/backend/distributed/test/run_from_same_connection.c @@ -12,10 +12,17 @@ */ #include "postgres.h" -#include "miscadmin.h" + #include "libpq-fe.h" +#include "miscadmin.h" #include "access/xact.h" +#include "executor/spi.h" +#include "lib/stringinfo.h" +#include "postmaster/postmaster.h" +#include "utils/builtins.h" +#include "utils/memutils.h" + #include "distributed/connection_management.h" #include "distributed/coordinator_protocol.h" #include "distributed/function_utils.h" @@ -24,13 +31,7 @@ #include "distributed/metadata_cache.h" #include "distributed/remote_commands.h" #include "distributed/run_from_same_connection.h" - #include "distributed/version_compat.h" -#include "executor/spi.h" -#include "lib/stringinfo.h" -#include "postmaster/postmaster.h" -#include "utils/builtins.h" -#include "utils/memutils.h" #define ALTER_CURRENT_PROCESS_ID \ diff --git a/src/backend/distributed/test/sequential_execution.c b/src/backend/distributed/test/sequential_execution.c index 9b88e3b7a5f..f967eb75fc4 100644 --- a/src/backend/distributed/test/sequential_execution.c +++ b/src/backend/distributed/test/sequential_execution.c @@ -11,6 +11,7 @@ */ #include "postgres.h" + #include "fmgr.h" #include "distributed/multi_executor.h" diff --git a/src/backend/distributed/test/shard_rebalancer.c b/src/backend/distributed/test/shard_rebalancer.c index 56a06398232..32bfd9f463c 100644 --- a/src/backend/distributed/test/shard_rebalancer.c +++ b/src/backend/distributed/test/shard_rebalancer.c @@ -11,26 +11,27 @@ */ #include "postgres.h" -#include "libpq-fe.h" +#include "funcapi.h" +#include "libpq-fe.h" +#include "miscadmin.h" #include "safe_lib.h" #include "catalog/pg_type.h" -#include "distributed/citus_safe_lib.h" +#include "utils/builtins.h" +#include "utils/json.h" +#include "utils/lsyscache.h" +#include "utils/memutils.h" + #include "distributed/citus_ruleutils.h" +#include "distributed/citus_safe_lib.h" #include "distributed/connection_management.h" #include "distributed/listutils.h" #include "distributed/metadata_utility.h" #include "distributed/multi_physical_planner.h" +#include "distributed/relay_utility.h" #include "distributed/shard_cleaner.h" #include "distributed/shard_rebalancer.h" -#include "distributed/relay_utility.h" -#include "funcapi.h" -#include "miscadmin.h" -#include "utils/builtins.h" -#include "utils/json.h" -#include "utils/lsyscache.h" -#include "utils/memutils.h" /* static declarations for json conversion */ static List * JsonArrayToShardPlacementTestInfoList( diff --git a/src/backend/distributed/test/shared_connection_counters.c b/src/backend/distributed/test/shared_connection_counters.c index 641cfd314c2..c596028876a 100644 --- a/src/backend/distributed/test/shared_connection_counters.c +++ b/src/backend/distributed/test/shared_connection_counters.c @@ -11,14 +11,16 @@ */ #include "postgres.h" -#include "miscadmin.h" + #include "fmgr.h" +#include "miscadmin.h" -#include "distributed/shared_connection_stats.h" -#include "distributed/listutils.h" #include "nodes/parsenodes.h" #include "utils/guc.h" +#include "distributed/listutils.h" +#include "distributed/shared_connection_stats.h" + /* exports for SQL callable functions */ PG_FUNCTION_INFO_V1(wake_up_connection_pool_waiters); PG_FUNCTION_INFO_V1(set_max_shared_pool_size); diff --git a/src/backend/distributed/test/xact_stats.c b/src/backend/distributed/test/xact_stats.c index 87e15aa646c..a968f8cb66e 100644 --- a/src/backend/distributed/test/xact_stats.c +++ b/src/backend/distributed/test/xact_stats.c @@ -13,6 +13,7 @@ #include #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" diff --git a/src/backend/distributed/transaction/backend_data.c b/src/backend/distributed/transaction/backend_data.c index c1981b77aa8..5f868f54899 100644 --- a/src/backend/distributed/transaction/backend_data.c +++ b/src/backend/distributed/transaction/backend_data.c @@ -12,18 +12,29 @@ #include "postgres.h" -#include "pg_version_constants.h" - +#include "funcapi.h" #include "miscadmin.h" -#include "unistd.h" - #include "safe_lib.h" +#include "unistd.h" -#include "funcapi.h" #include "access/htup_details.h" #include "catalog/pg_authid.h" #include "catalog/pg_type.h" #include "datatype/timestamp.h" +#include "nodes/execnodes.h" +#include "postmaster/autovacuum.h" /* to access autovacuum_max_workers */ +#include "replication/walsender.h" +#include "storage/ipc.h" +#include "storage/lmgr.h" +#include "storage/lwlock.h" +#include "storage/proc.h" +#include "storage/procarray.h" +#include "storage/s_lock.h" +#include "storage/spin.h" +#include "utils/timestamp.h" + +#include "pg_version_constants.h" + #include "distributed/backend_data.h" #include "distributed/connection_management.h" #include "distributed/listutils.h" @@ -34,17 +45,6 @@ #include "distributed/transaction_identifier.h" #include "distributed/tuplestore.h" #include "distributed/worker_manager.h" -#include "nodes/execnodes.h" -#include "postmaster/autovacuum.h" /* to access autovacuum_max_workers */ -#include "replication/walsender.h" -#include "storage/ipc.h" -#include "storage/lmgr.h" -#include "storage/lwlock.h" -#include "storage/procarray.h" -#include "storage/proc.h" -#include "storage/spin.h" -#include "storage/s_lock.h" -#include "utils/timestamp.h" #define GET_ACTIVE_TRANSACTION_QUERY "SELECT * FROM get_all_active_transactions();" diff --git a/src/backend/distributed/transaction/citus_dist_stat_activity.c b/src/backend/distributed/transaction/citus_dist_stat_activity.c index 3aa6372e6e7..b0ffc05eb0b 100644 --- a/src/backend/distributed/transaction/citus_dist_stat_activity.c +++ b/src/backend/distributed/transaction/citus_dist_stat_activity.c @@ -10,8 +10,9 @@ */ #include "postgres.h" -#include "miscadmin.h" + #include "funcapi.h" +#include "miscadmin.h" PG_FUNCTION_INFO_V1(citus_dist_stat_activity); PG_FUNCTION_INFO_V1(citus_worker_stat_activity); diff --git a/src/backend/distributed/transaction/distributed_deadlock_detection.c b/src/backend/distributed/transaction/distributed_deadlock_detection.c index cf8dd43f5ba..27bb48ee36c 100644 --- a/src/backend/distributed/transaction/distributed_deadlock_detection.c +++ b/src/backend/distributed/transaction/distributed_deadlock_detection.c @@ -15,8 +15,11 @@ #include "pgstat.h" #include "access/hash.h" +#include "nodes/pg_list.h" +#include "utils/hsearch.h" +#include "utils/timestamp.h" + #include "distributed/backend_data.h" -#include "distributed/errormessage.h" #include "distributed/distributed_deadlock_detection.h" #include "distributed/errormessage.h" #include "distributed/hash_helpers.h" @@ -25,9 +28,6 @@ #include "distributed/log_utils.h" #include "distributed/metadata_cache.h" #include "distributed/transaction_identifier.h" -#include "nodes/pg_list.h" -#include "utils/hsearch.h" -#include "utils/timestamp.h" /* used only for finding the deadlock cycle path */ diff --git a/src/backend/distributed/transaction/lock_graph.c b/src/backend/distributed/transaction/lock_graph.c index 0b4c0f02e9a..82f936243f0 100644 --- a/src/backend/distributed/transaction/lock_graph.c +++ b/src/backend/distributed/transaction/lock_graph.c @@ -18,6 +18,11 @@ #include "miscadmin.h" #include "access/hash.h" +#include "storage/proc.h" +#include "utils/builtins.h" +#include "utils/hsearch.h" +#include "utils/timestamp.h" + #include "distributed/backend_data.h" #include "distributed/connection_management.h" #include "distributed/hash_helpers.h" @@ -26,10 +31,6 @@ #include "distributed/metadata_cache.h" #include "distributed/remote_commands.h" #include "distributed/tuplestore.h" -#include "storage/proc.h" -#include "utils/builtins.h" -#include "utils/hsearch.h" -#include "utils/timestamp.h" /* diff --git a/src/backend/distributed/transaction/relation_access_tracking.c b/src/backend/distributed/transaction/relation_access_tracking.c index 3ad61ac79e0..5044941c471 100644 --- a/src/backend/distributed/transaction/relation_access_tracking.c +++ b/src/backend/distributed/transaction/relation_access_tracking.c @@ -15,22 +15,23 @@ */ #include "postgres.h" -#include "pg_version_constants.h" - #include "miscadmin.h" #include "access/xact.h" +#include "common/hashfn.h" +#include "utils/hsearch.h" +#include "utils/lsyscache.h" + +#include "pg_version_constants.h" + #include "distributed/colocation_utils.h" #include "distributed/hash_helpers.h" #include "distributed/listutils.h" +#include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" #include "distributed/multi_join_order.h" #include "distributed/multi_partitioning_utils.h" -#include "distributed/metadata_cache.h" #include "distributed/relation_access_tracking.h" -#include "utils/hsearch.h" -#include "common/hashfn.h" -#include "utils/lsyscache.h" /* Config variables managed via guc.c */ diff --git a/src/backend/distributed/transaction/remote_transaction.c b/src/backend/distributed/transaction/remote_transaction.c index 0f62417931f..3dc89c9952c 100644 --- a/src/backend/distributed/transaction/remote_transaction.c +++ b/src/backend/distributed/transaction/remote_transaction.c @@ -16,10 +16,12 @@ #include "postgres.h" #include "libpq-fe.h" - #include "miscadmin.h" #include "access/xact.h" +#include "utils/builtins.h" +#include "utils/hsearch.h" + #include "distributed/backend_data.h" #include "distributed/citus_safe_lib.h" #include "distributed/connection_management.h" @@ -32,8 +34,6 @@ #include "distributed/transaction_management.h" #include "distributed/transaction_recovery.h" #include "distributed/worker_manager.h" -#include "utils/builtins.h" -#include "utils/hsearch.h" #define PREPARED_TRANSACTION_NAME_FORMAT "citus_%u_%u_"UINT64_FORMAT "_%u" diff --git a/src/backend/distributed/transaction/transaction_management.c b/src/backend/distributed/transaction/transaction_management.c index 9a7bd908918..d133d7be6b2 100644 --- a/src/backend/distributed/transaction/transaction_management.c +++ b/src/backend/distributed/transaction/transaction_management.c @@ -14,15 +14,22 @@ #include "postgres.h" #include "libpq-fe.h" - #include "miscadmin.h" #include "access/twophase.h" #include "access/xact.h" #include "catalog/dependency.h" #include "common/hashfn.h" +#include "nodes/print.h" +#include "storage/fd.h" +#include "utils/datum.h" +#include "utils/guc.h" +#include "utils/hsearch.h" +#include "utils/memutils.h" + #include "distributed/backend_data.h" #include "distributed/citus_safe_lib.h" +#include "distributed/commands.h" #include "distributed/connection_management.h" #include "distributed/distributed_planner.h" #include "distributed/function_call_delegation.h" @@ -33,27 +40,20 @@ #include "distributed/locally_reserved_shared_connections.h" #include "distributed/maintenanced.h" #include "distributed/metadata/dependency.h" +#include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" -#include "distributed/multi_logical_replication.h" #include "distributed/multi_explain.h" -#include "distributed/repartition_join_execution.h" -#include "distributed/replication_origin_session_utils.h" -#include "distributed/transaction_management.h" +#include "distributed/multi_logical_replication.h" #include "distributed/placement_connection.h" #include "distributed/relation_access_tracking.h" -#include "distributed/shared_connection_stats.h" +#include "distributed/repartition_join_execution.h" +#include "distributed/replication_origin_session_utils.h" #include "distributed/shard_cleaner.h" +#include "distributed/shared_connection_stats.h" #include "distributed/subplan_execution.h" +#include "distributed/transaction_management.h" #include "distributed/version_compat.h" #include "distributed/worker_log_messages.h" -#include "distributed/commands.h" -#include "distributed/metadata_cache.h" -#include "utils/hsearch.h" -#include "utils/guc.h" -#include "utils/memutils.h" -#include "utils/datum.h" -#include "storage/fd.h" -#include "nodes/print.h" CoordinatedTransactionState CurrentCoordinatedTransactionState = COORD_TRANS_NONE; diff --git a/src/backend/distributed/transaction/transaction_recovery.c b/src/backend/distributed/transaction/transaction_recovery.c index a833f5a4679..0ec5ba0a3f6 100644 --- a/src/backend/distributed/transaction/transaction_recovery.c +++ b/src/backend/distributed/transaction/transaction_recovery.c @@ -12,15 +12,13 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" +#include +#include -#include "pg_version_constants.h" +#include "postgres.h" -#include "miscadmin.h" #include "libpq-fe.h" - -#include -#include +#include "miscadmin.h" #include "access/genam.h" #include "access/heapam.h" @@ -28,6 +26,16 @@ #include "access/relscan.h" #include "access/xact.h" #include "catalog/indexing.h" +#include "lib/stringinfo.h" +#include "storage/lmgr.h" +#include "storage/lock.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/memutils.h" +#include "utils/rel.h" + +#include "pg_version_constants.h" + #include "distributed/backend_data.h" #include "distributed/connection_management.h" #include "distributed/listutils.h" @@ -36,15 +44,8 @@ #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" #include "distributed/transaction_recovery.h" -#include "distributed/worker_manager.h" #include "distributed/version_compat.h" -#include "lib/stringinfo.h" -#include "storage/lmgr.h" -#include "storage/lock.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/memutils.h" -#include "utils/rel.h" +#include "distributed/worker_manager.h" /* exports for SQL callable functions */ diff --git a/src/backend/distributed/transaction/worker_transaction.c b/src/backend/distributed/transaction/worker_transaction.c index 3399365aa63..2af1e9a6cef 100644 --- a/src/backend/distributed/transaction/worker_transaction.c +++ b/src/backend/distributed/transaction/worker_transaction.c @@ -11,28 +11,30 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" -#include "miscadmin.h" -#include "libpq-fe.h" - #include #include +#include "postgres.h" + +#include "libpq-fe.h" +#include "miscadmin.h" + #include "access/xact.h" +#include "utils/builtins.h" +#include "utils/memutils.h" + #include "distributed/connection_management.h" +#include "distributed/jsonbutils.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" -#include "distributed/resource_lock.h" #include "distributed/metadata_sync.h" -#include "distributed/remote_commands.h" #include "distributed/pg_dist_node.h" #include "distributed/pg_dist_transaction.h" +#include "distributed/remote_commands.h" +#include "distributed/resource_lock.h" #include "distributed/transaction_recovery.h" #include "distributed/worker_manager.h" #include "distributed/worker_transaction.h" -#include "distributed/jsonbutils.h" -#include "utils/memutils.h" -#include "utils/builtins.h" static void SendCommandToRemoteMetadataNodesParams(const char *command, const char *user, int parameterCount, diff --git a/src/backend/distributed/utils/acquire_lock.c b/src/backend/distributed/utils/acquire_lock.c index f414167b3d7..d0f6193c272 100644 --- a/src/backend/distributed/utils/acquire_lock.c +++ b/src/backend/distributed/utils/acquire_lock.c @@ -22,12 +22,12 @@ #include "postgres.h" +#include "miscadmin.h" +#include "pgstat.h" #include "access/xact.h" #include "catalog/pg_type.h" #include "executor/spi.h" -#include "miscadmin.h" -#include "pgstat.h" #include "portability/instr_time.h" #include "storage/ipc.h" #include "storage/latch.h" diff --git a/src/backend/distributed/utils/aggregate_utils.c b/src/backend/distributed/utils/aggregate_utils.c index 773e0aa25cd..3fd584df9ae 100644 --- a/src/backend/distributed/utils/aggregate_utils.c +++ b/src/backend/distributed/utils/aggregate_utils.c @@ -16,11 +16,14 @@ #include "postgres.h" +#include "fmgr.h" +#include "miscadmin.h" +#include "pg_config_manual.h" + #include "access/htup_details.h" #include "catalog/pg_aggregate.h" #include "catalog/pg_proc.h" #include "catalog/pg_type.h" -#include "distributed/version_compat.h" #include "nodes/nodeFuncs.h" #include "utils/acl.h" #include "utils/builtins.h" @@ -28,9 +31,8 @@ #include "utils/lsyscache.h" #include "utils/syscache.h" #include "utils/typcache.h" -#include "fmgr.h" -#include "miscadmin.h" -#include "pg_config_manual.h" + +#include "distributed/version_compat.h" PG_FUNCTION_INFO_V1(worker_partial_agg_sfunc); PG_FUNCTION_INFO_V1(worker_partial_agg_ffunc); diff --git a/src/backend/distributed/utils/array_type.c b/src/backend/distributed/utils/array_type.c index 70c7dde141f..1c3663d4360 100644 --- a/src/backend/distributed/utils/array_type.c +++ b/src/backend/distributed/utils/array_type.c @@ -10,16 +10,19 @@ */ #include "postgres.h" + #include "miscadmin.h" -#include "pg_version_compat.h" #include "catalog/pg_type.h" #include "nodes/pg_list.h" -#include "distributed/utils/array_type.h" #include "utils/array.h" #include "utils/builtins.h" #include "utils/lsyscache.h" +#include "pg_version_compat.h" + +#include "distributed/utils/array_type.h" + /* * DeconstructArrayObject takes in a single dimensional array, and deserializes diff --git a/src/backend/distributed/utils/background_jobs.c b/src/backend/distributed/utils/background_jobs.c index 2b5ce2dca10..a7a124c7487 100644 --- a/src/backend/distributed/utils/background_jobs.c +++ b/src/backend/distributed/utils/background_jobs.c @@ -27,17 +27,17 @@ #include "postgres.h" +#include "libpq-fe.h" +#include "pgstat.h" #include "safe_mem_lib.h" #include "access/xact.h" #include "commands/dbcommands.h" #include "common/hashfn.h" -#include "libpq-fe.h" #include "libpq/pqformat.h" #include "libpq/pqmq.h" #include "libpq/pqsignal.h" #include "parser/analyze.h" -#include "pgstat.h" #include "storage/dsm.h" #include "storage/ipc.h" #include "storage/procarray.h" @@ -62,9 +62,9 @@ #include "distributed/maintenanced.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_utility.h" +#include "distributed/resource_lock.h" #include "distributed/shard_cleaner.h" #include "distributed/shard_rebalancer.h" -#include "distributed/resource_lock.h" /* Table-of-contents constants for our dynamic shared memory segment. */ #define CITUS_BACKGROUND_TASK_MAGIC 0x51028081 diff --git a/src/backend/distributed/utils/cancel_utils.c b/src/backend/distributed/utils/cancel_utils.c index 17383c03436..f135212e4ba 100644 --- a/src/backend/distributed/utils/cancel_utils.c +++ b/src/backend/distributed/utils/cancel_utils.c @@ -8,7 +8,9 @@ #include "postgres.h" + #include "miscadmin.h" + #include "distributed/cancel_utils.h" diff --git a/src/backend/distributed/utils/citus_clauses.c b/src/backend/distributed/utils/citus_clauses.c index 82900ea1a74..f88b173afe0 100644 --- a/src/backend/distributed/utils/citus_clauses.c +++ b/src/backend/distributed/utils/citus_clauses.c @@ -8,12 +8,6 @@ #include "postgres.h" -#include "distributed/citus_clauses.h" -#include "distributed/insert_select_planner.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_router_planner.h" -#include "distributed/version_compat.h" - #include "catalog/pg_proc.h" #include "catalog/pg_type.h" #include "executor/executor.h" @@ -28,6 +22,12 @@ #include "utils/lsyscache.h" #include "utils/syscache.h" +#include "distributed/citus_clauses.h" +#include "distributed/insert_select_planner.h" +#include "distributed/metadata_cache.h" +#include "distributed/multi_router_planner.h" +#include "distributed/version_compat.h" + /* private function declarations */ static bool IsVariableExpression(Node *node); diff --git a/src/backend/distributed/utils/citus_copyfuncs.c b/src/backend/distributed/utils/citus_copyfuncs.c index fe4429f04d0..e283a3034c2 100644 --- a/src/backend/distributed/utils/citus_copyfuncs.c +++ b/src/backend/distributed/utils/citus_copyfuncs.c @@ -11,11 +11,11 @@ */ #include "postgres.h" +#include "utils/datum.h" #include "distributed/citus_nodefuncs.h" -#include "distributed/multi_server_executor.h" #include "distributed/listutils.h" -#include "utils/datum.h" +#include "distributed/multi_server_executor.h" /* diff --git a/src/backend/distributed/utils/citus_depended_object.c b/src/backend/distributed/utils/citus_depended_object.c index 3b5a34b54f0..a160fcd56bc 100644 --- a/src/backend/distributed/utils/citus_depended_object.c +++ b/src/backend/distributed/utils/citus_depended_object.c @@ -7,6 +7,7 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "catalog/namespace.h" @@ -14,17 +15,17 @@ #include "catalog/pg_am.h" #include "catalog/pg_amop.h" #include "catalog/pg_amproc.h" -#include "catalog/pg_attribute.h" #include "catalog/pg_attrdef.h" -#include "catalog/pg_constraint.h" +#include "catalog/pg_attribute.h" #include "catalog/pg_class.h" +#include "catalog/pg_constraint.h" #include "catalog/pg_depend.h" #include "catalog/pg_enum.h" #include "catalog/pg_event_trigger.h" #include "catalog/pg_language.h" #include "catalog/pg_namespace.h" -#include "catalog/pg_operator.h" #include "catalog/pg_opclass.h" +#include "catalog/pg_operator.h" #include "catalog/pg_opfamily.h" #include "catalog/pg_proc.h" #include "catalog/pg_rewrite.h" @@ -35,12 +36,6 @@ #include "catalog/pg_ts_dict.h" #include "catalog/pg_ts_template.h" #include "catalog/pg_type.h" -#include "distributed/citus_depended_object.h" -#include "distributed/metadata_cache.h" -#include "distributed/commands.h" -#include "distributed/listutils.h" -#include "distributed/log_utils.h" -#include "distributed/shared_library_init.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" #include "nodes/parsenodes.h" @@ -49,6 +44,13 @@ #include "utils/lsyscache.h" #include "utils/syscache.h" +#include "distributed/citus_depended_object.h" +#include "distributed/commands.h" +#include "distributed/listutils.h" +#include "distributed/log_utils.h" +#include "distributed/metadata_cache.h" +#include "distributed/shared_library_init.h" + /* * GUC hides any objects, which depends on citus extension, from pg meta class queries, * it is intended to be used in vanilla tests to not break postgres test logs diff --git a/src/backend/distributed/utils/citus_nodefuncs.c b/src/backend/distributed/utils/citus_nodefuncs.c index 0998560fea0..55b83e6c52e 100644 --- a/src/backend/distributed/utils/citus_nodefuncs.c +++ b/src/backend/distributed/utils/citus_nodefuncs.c @@ -10,16 +10,17 @@ #include "postgres.h" +#include "catalog/pg_type.h" + #include "pg_version_constants.h" -#include "catalog/pg_type.h" -#include "distributed/citus_nodes.h" #include "distributed/citus_nodefuncs.h" +#include "distributed/citus_nodes.h" #include "distributed/coordinator_protocol.h" +#include "distributed/distributed_planner.h" #include "distributed/errormessage.h" #include "distributed/log_utils.h" #include "distributed/metadata_cache.h" -#include "distributed/distributed_planner.h" #include "distributed/multi_router_planner.h" #include "distributed/multi_server_executor.h" diff --git a/src/backend/distributed/utils/citus_safe_lib.c b/src/backend/distributed/utils/citus_safe_lib.c index cbd06fc500a..2d504a644f1 100644 --- a/src/backend/distributed/utils/citus_safe_lib.c +++ b/src/backend/distributed/utils/citus_safe_lib.c @@ -12,16 +12,17 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" +#include -#include "pg_version_constants.h" +#include "postgres.h" #include "safe_lib.h" -#include +#include "lib/stringinfo.h" + +#include "pg_version_constants.h" #include "distributed/citus_safe_lib.h" -#include "lib/stringinfo.h" /* diff --git a/src/backend/distributed/utils/citus_stat_tenants.c b/src/backend/distributed/utils/citus_stat_tenants.c index aa813e15243..6af5c0d586c 100644 --- a/src/backend/distributed/utils/citus_stat_tenants.c +++ b/src/backend/distributed/utils/citus_stat_tenants.c @@ -8,21 +8,13 @@ *------------------------------------------------------------------------- */ +#include + #include "postgres.h" + #include "unistd.h" #include "access/hash.h" -#include "distributed/citus_safe_lib.h" -#include "distributed/colocation_utils.h" -#include "distributed/distributed_planner.h" -#include "distributed/jsonbutils.h" -#include "distributed/log_utils.h" -#include "distributed/listutils.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_executor.h" -#include "distributed/tenant_schema_metadata.h" -#include "distributed/tuplestore.h" -#include "distributed/utils/citus_stat_tenants.h" #include "executor/execdesc.h" #include "storage/ipc.h" #include "storage/lwlock.h" @@ -34,7 +26,17 @@ #include "utils/lsyscache.h" #include "utils/syscache.h" -#include +#include "distributed/citus_safe_lib.h" +#include "distributed/colocation_utils.h" +#include "distributed/distributed_planner.h" +#include "distributed/jsonbutils.h" +#include "distributed/listutils.h" +#include "distributed/log_utils.h" +#include "distributed/metadata_cache.h" +#include "distributed/multi_executor.h" +#include "distributed/tenant_schema_metadata.h" +#include "distributed/tuplestore.h" +#include "distributed/utils/citus_stat_tenants.h" #if (PG_VERSION_NUM >= PG_VERSION_15) #include "common/pg_prng.h" diff --git a/src/backend/distributed/utils/citus_version.c b/src/backend/distributed/utils/citus_version.c index 95945a30f62..edae4f9273f 100644 --- a/src/backend/distributed/utils/citus_version.c +++ b/src/backend/distributed/utils/citus_version.c @@ -11,9 +11,10 @@ #include "postgres.h" -#include "citus_version.h" #include "utils/builtins.h" +#include "citus_version.h" + /* exports for SQL callable functions */ PG_FUNCTION_INFO_V1(citus_version); diff --git a/src/backend/distributed/utils/colocation_utils.c b/src/backend/distributed/utils/colocation_utils.c index e7007874bb3..b8db3c80faa 100644 --- a/src/backend/distributed/utils/colocation_utils.c +++ b/src/backend/distributed/utils/colocation_utils.c @@ -10,6 +10,7 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "access/genam.h" @@ -19,28 +20,29 @@ #include "catalog/indexing.h" #include "catalog/pg_type.h" #include "commands/sequence.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" + #include "distributed/colocation_utils.h" #include "distributed/commands.h" -#include "distributed/listutils.h" -#include "distributed/metadata_utility.h" #include "distributed/coordinator_protocol.h" +#include "distributed/listutils.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_logical_planner.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/pg_dist_colocation.h" #include "distributed/resource_lock.h" #include "distributed/shardinterval_utils.h" #include "distributed/tenant_schema_metadata.h" -#include "distributed/version_compat.h" #include "distributed/utils/array_type.h" +#include "distributed/version_compat.h" #include "distributed/worker_protocol.h" #include "distributed/worker_transaction.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" /* local function forward declarations */ diff --git a/src/backend/distributed/utils/directory.c b/src/backend/distributed/utils/directory.c index b749b9cd607..bad585809ef 100644 --- a/src/backend/distributed/utils/directory.c +++ b/src/backend/distributed/utils/directory.c @@ -12,6 +12,7 @@ #include #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" diff --git a/src/backend/distributed/utils/distribution_column.c b/src/backend/distributed/utils/distribution_column.c index 474133f73bc..5927be612fe 100644 --- a/src/backend/distributed/utils/distribution_column.c +++ b/src/backend/distributed/utils/distribution_column.c @@ -12,19 +12,14 @@ #include "postgres.h" - #include "access/attnum.h" #include "access/heapam.h" #include "access/htup_details.h" -#include "distributed/distribution_column.h" -#include "distributed/metadata_cache.h" -#include "distributed/multi_partitioning_utils.h" -#include "distributed/version_compat.h" #include "nodes/makefuncs.h" #include "nodes/nodes.h" #include "nodes/primnodes.h" -#include "parser/scansup.h" #include "parser/parse_relation.h" +#include "parser/scansup.h" #include "utils/builtins.h" #include "utils/elog.h" #include "utils/errcodes.h" @@ -33,6 +28,11 @@ #include "utils/relcache.h" #include "utils/syscache.h" +#include "distributed/distribution_column.h" +#include "distributed/metadata_cache.h" +#include "distributed/multi_partitioning_utils.h" +#include "distributed/version_compat.h" + /* exports for SQL callable functions */ PG_FUNCTION_INFO_V1(column_name_to_column); diff --git a/src/backend/distributed/utils/distribution_column_map.c b/src/backend/distributed/utils/distribution_column_map.c index c3c0db01f72..43f9939b1d2 100644 --- a/src/backend/distributed/utils/distribution_column_map.c +++ b/src/backend/distributed/utils/distribution_column_map.c @@ -11,12 +11,13 @@ #include "postgres.h" #include "common/hashfn.h" +#include "nodes/primnodes.h" + #include "distributed/distribution_column.h" #include "distributed/listutils.h" #include "distributed/multi_join_order.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/utils/distribution_column_map.h" -#include "nodes/primnodes.h" /* diff --git a/src/backend/distributed/utils/enable_ssl.c b/src/backend/distributed/utils/enable_ssl.c index 35b1e0f1a80..261225450c3 100644 --- a/src/backend/distributed/utils/enable_ssl.c +++ b/src/backend/distributed/utils/enable_ssl.c @@ -18,17 +18,19 @@ * it otherwise we get warnings about redefining this value. This needs to be * done before including libpq.h. */ -#include "pg_version_constants.h" +#include "miscadmin.h" -#include "distributed/connection_management.h" -#include "distributed/memutils.h" -#include "distributed/worker_protocol.h" #include "libpq/libpq.h" -#include "miscadmin.h" #include "nodes/parsenodes.h" #include "postmaster/postmaster.h" #include "utils/guc.h" +#include "pg_version_constants.h" + +#include "distributed/connection_management.h" +#include "distributed/memutils.h" +#include "distributed/worker_protocol.h" + #ifdef USE_OPENSSL #include "openssl/dsa.h" #include "openssl/err.h" diff --git a/src/backend/distributed/utils/errormessage.c b/src/backend/distributed/utils/errormessage.c index 72758f9cac8..dbc55019deb 100644 --- a/src/backend/distributed/utils/errormessage.c +++ b/src/backend/distributed/utils/errormessage.c @@ -6,13 +6,14 @@ */ #include "postgres.h" -#include "utils/memutils.h" #include "common/sha2.h" +#include "utils/builtins.h" +#include "utils/memutils.h" + #include "distributed/citus_nodes.h" #include "distributed/errormessage.h" #include "distributed/log_utils.h" -#include "utils/builtins.h" /* diff --git a/src/backend/distributed/utils/foreign_key_relationship.c b/src/backend/distributed/utils/foreign_key_relationship.c index d69d9044d08..1abb7ae0717 100644 --- a/src/backend/distributed/utils/foreign_key_relationship.c +++ b/src/backend/distributed/utils/foreign_key_relationship.c @@ -12,29 +12,29 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "access/genam.h" #include "access/htup_details.h" #include "access/stratnum.h" #include "access/table.h" #include "catalog/pg_constraint.h" -#include "distributed/commands.h" -#include "distributed/hash_helpers.h" -#include "distributed/foreign_key_relationship.h" -#include "distributed/hash_helpers.h" -#include "distributed/listutils.h" -#include "distributed/metadata_cache.h" -#include "distributed/version_compat.h" +#include "common/hashfn.h" #include "nodes/pg_list.h" #include "storage/lockdefs.h" #include "utils/catcache.h" #include "utils/fmgroids.h" #include "utils/hsearch.h" -#include "common/hashfn.h" #include "utils/inval.h" #include "utils/memutils.h" +#include "pg_version_constants.h" + +#include "distributed/commands.h" +#include "distributed/foreign_key_relationship.h" +#include "distributed/hash_helpers.h" +#include "distributed/listutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/version_compat.h" + /* * ForeignConstraintRelationshipGraph holds the graph data structure for foreign constraint relationship diff --git a/src/backend/distributed/utils/function.c b/src/backend/distributed/utils/function.c index bfb59181c75..dcfcff6fea9 100644 --- a/src/backend/distributed/utils/function.c +++ b/src/backend/distributed/utils/function.c @@ -10,13 +10,15 @@ */ #include "postgres.h" + #include "fmgr.h" #include "miscadmin.h" #include "commands/defrem.h" -#include "distributed/utils/function.h" #include "utils/lsyscache.h" +#include "distributed/utils/function.h" + /* * GetFunctionInfo first resolves the operator for the given data type, access diff --git a/src/backend/distributed/utils/function_utils.c b/src/backend/distributed/utils/function_utils.c index 48f878e1327..0770b8cb9b3 100644 --- a/src/backend/distributed/utils/function_utils.c +++ b/src/backend/distributed/utils/function_utils.c @@ -10,12 +10,13 @@ #include "postgres.h" #include "catalog/namespace.h" -#include "distributed/function_utils.h" -#include "distributed/version_compat.h" #include "executor/executor.h" #include "utils/builtins.h" #include "utils/regproc.h" +#include "distributed/function_utils.h" +#include "distributed/version_compat.h" + /* * FunctionOid searches for a function that has the given name and the given diff --git a/src/backend/distributed/utils/hash_helpers.c b/src/backend/distributed/utils/hash_helpers.c index d2bfe38fa21..2aaaaef12bf 100644 --- a/src/backend/distributed/utils/hash_helpers.c +++ b/src/backend/distributed/utils/hash_helpers.c @@ -11,9 +11,10 @@ #include "postgres.h" #include "common/hashfn.h" +#include "utils/hsearch.h" + #include "distributed/citus_safe_lib.h" #include "distributed/hash_helpers.h" -#include "utils/hsearch.h" /* diff --git a/src/backend/distributed/utils/jsonbutils.c b/src/backend/distributed/utils/jsonbutils.c index 4855ee00465..47e6aa2c7b8 100644 --- a/src/backend/distributed/utils/jsonbutils.c +++ b/src/backend/distributed/utils/jsonbutils.c @@ -1,21 +1,21 @@ #include "postgres.h" -#include "pg_version_compat.h" +#include "fmgr.h" #include "catalog/namespace.h" #include "catalog/pg_class.h" #include "catalog/pg_collation.h" #include "catalog/pg_type.h" - #include "utils/array.h" +#include "utils/builtins.h" #include "utils/json.h" +#include "utils/lsyscache.h" + +#include "pg_version_compat.h" + #include "distributed/jsonbutils.h" #include "distributed/metadata_cache.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "fmgr.h" - /* * ExtractFieldJsonb gets value of fieldName from jsonbDoc and puts it diff --git a/src/backend/distributed/utils/listutils.c b/src/backend/distributed/utils/listutils.c index dd54443c4f8..eddef1fea09 100644 --- a/src/backend/distributed/utils/listutils.c +++ b/src/backend/distributed/utils/listutils.c @@ -10,16 +10,18 @@ */ #include "postgres.h" + #include "c.h" #include "port.h" -#include "utils/lsyscache.h" #include "lib/stringinfo.h" -#include "distributed/citus_safe_lib.h" -#include "distributed/listutils.h" #include "nodes/pg_list.h" +#include "utils/lsyscache.h" #include "utils/memutils.h" +#include "distributed/citus_safe_lib.h" +#include "distributed/listutils.h" + /* * SortList takes in a list of void pointers, and sorts these pointers (and the diff --git a/src/backend/distributed/utils/log_utils.c b/src/backend/distributed/utils/log_utils.c index 7d808591b0c..2e9d94c440d 100644 --- a/src/backend/distributed/utils/log_utils.c +++ b/src/backend/distributed/utils/log_utils.c @@ -9,16 +9,15 @@ #include "postgres.h" -#include "pg_version_constants.h" - -#include "utils/guc.h" -#include "distributed/log_utils.h" -#include "distributed/errormessage.h" +#include "common/cryptohash.h" #include "common/sha2.h" - #include "utils/builtins.h" +#include "utils/guc.h" -#include "common/cryptohash.h" +#include "pg_version_constants.h" + +#include "distributed/errormessage.h" +#include "distributed/log_utils.h" /* diff --git a/src/backend/distributed/utils/maintenanced.c b/src/backend/distributed/utils/maintenanced.c index 851335abe33..9cef13539b4 100644 --- a/src/backend/distributed/utils/maintenanced.c +++ b/src/backend/distributed/utils/maintenanced.c @@ -14,52 +14,52 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" - -#include "pg_version_constants.h" - #include +#include "postgres.h" + #include "miscadmin.h" #include "pgstat.h" #include "access/xact.h" #include "access/xlog.h" -#include "catalog/pg_extension.h" -#include "citus_version.h" +#include "catalog/namespace.h" #include "catalog/pg_authid.h" +#include "catalog/pg_extension.h" #include "catalog/pg_namespace.h" #include "commands/async.h" #include "commands/extension.h" +#include "common/hashfn.h" #include "libpq/pqsignal.h" -#include "catalog/namespace.h" -#include "distributed/background_jobs.h" -#include "distributed/citus_safe_lib.h" -#include "distributed/distributed_deadlock_detection.h" -#include "distributed/maintenanced.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/metadata_cache.h" -#include "distributed/shard_cleaner.h" -#include "distributed/metadata_sync.h" -#include "distributed/query_stats.h" -#include "distributed/statistics_collection.h" -#include "distributed/transaction_recovery.h" -#include "distributed/version_compat.h" #include "nodes/makefuncs.h" #include "postmaster/bgworker.h" #include "postmaster/postmaster.h" -#include "nodes/makefuncs.h" #include "storage/ipc.h" -#include "storage/proc.h" #include "storage/latch.h" #include "storage/lmgr.h" #include "storage/lwlock.h" +#include "storage/proc.h" #include "tcop/tcopprot.h" -#include "common/hashfn.h" #include "utils/builtins.h" -#include "utils/memutils.h" #include "utils/lsyscache.h" +#include "utils/memutils.h" + +#include "citus_version.h" +#include "pg_version_constants.h" + +#include "distributed/background_jobs.h" +#include "distributed/citus_safe_lib.h" +#include "distributed/coordinator_protocol.h" +#include "distributed/distributed_deadlock_detection.h" +#include "distributed/maintenanced.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_sync.h" +#include "distributed/query_stats.h" #include "distributed/resource_lock.h" +#include "distributed/shard_cleaner.h" +#include "distributed/statistics_collection.h" +#include "distributed/transaction_recovery.h" +#include "distributed/version_compat.h" /* * Shared memory data for all maintenance workers. diff --git a/src/backend/distributed/utils/multi_partitioning_utils.c b/src/backend/distributed/utils/multi_partitioning_utils.c index 404d792f938..ede2008cabc 100644 --- a/src/backend/distributed/utils/multi_partitioning_utils.c +++ b/src/backend/distributed/utils/multi_partitioning_utils.c @@ -6,7 +6,7 @@ */ #include "postgres.h" -#include "pg_version_constants.h" +#include "pgstat.h" #include "access/genam.h" #include "access/heapam.h" @@ -19,8 +19,21 @@ #include "catalog/pg_inherits.h" #include "commands/tablecmds.h" #include "common/string.h" -#include "distributed/citus_nodes.h" +#include "lib/stringinfo.h" +#include "nodes/makefuncs.h" +#include "nodes/pg_list.h" +#include "partitioning/partdesc.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" +#include "utils/syscache.h" +#include "utils/varlena.h" + +#include "pg_version_constants.h" + #include "distributed/adaptive_executor.h" +#include "distributed/citus_nodes.h" #include "distributed/citus_ruleutils.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" @@ -36,17 +49,6 @@ #include "distributed/shardinterval_utils.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" -#include "lib/stringinfo.h" -#include "nodes/makefuncs.h" -#include "nodes/pg_list.h" -#include "pgstat.h" -#include "partitioning/partdesc.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" -#include "utils/syscache.h" -#include "utils/varlena.h" static char * PartitionBound(Oid partitionId); static Relation try_relation_open_nolock(Oid relationId); diff --git a/src/backend/distributed/utils/namespace_utils.c b/src/backend/distributed/utils/namespace_utils.c index 4f822b7d2b8..a5401b00c1f 100644 --- a/src/backend/distributed/utils/namespace_utils.c +++ b/src/backend/distributed/utils/namespace_utils.c @@ -11,10 +11,11 @@ #include "postgres.h" -#include "distributed/namespace_utils.h" #include "utils/guc.h" #include "utils/regproc.h" +#include "distributed/namespace_utils.h" + /* * We use the equivalent of a function SET option to allow the setting to * persist for the exact duration of the transaction, guc.c takes care of diff --git a/src/backend/distributed/utils/param_utils.c b/src/backend/distributed/utils/param_utils.c index 8aefecb7ddf..a500b5b6535 100644 --- a/src/backend/distributed/utils/param_utils.c +++ b/src/backend/distributed/utils/param_utils.c @@ -9,12 +9,13 @@ #include "postgres.h" -#include -#include -#include -#include -#include -#include +#include "nodes/bitmapset.h" +#include "nodes/nodeFuncs.h" +#include "nodes/nodes.h" +#include "nodes/params.h" +#include "nodes/parsenodes.h" +#include "nodes/primnodes.h" + #include "distributed/param_utils.h" /* diff --git a/src/backend/distributed/utils/priority.c b/src/backend/distributed/utils/priority.c index 2e7972d2d62..ceb75ac2668 100644 --- a/src/backend/distributed/utils/priority.c +++ b/src/backend/distributed/utils/priority.c @@ -7,13 +7,13 @@ *------------------------------------------------------------------------- */ -#include "postgres.h" - -#include #include #include #include #include +#include + +#include "postgres.h" #include "distributed/priority.h" diff --git a/src/backend/distributed/utils/query_utils.c b/src/backend/distributed/utils/query_utils.c index 4ae49ed817b..ac33bdd523f 100644 --- a/src/backend/distributed/utils/query_utils.c +++ b/src/backend/distributed/utils/query_utils.c @@ -11,13 +11,14 @@ */ #include "postgres.h" -#include "nodes/primnodes.h" #include "catalog/pg_class.h" +#include "nodes/nodeFuncs.h" +#include "nodes/primnodes.h" + +#include "distributed/listutils.h" #include "distributed/query_utils.h" #include "distributed/version_compat.h" -#include "distributed/listutils.h" -#include "nodes/nodeFuncs.h" static bool CitusQueryableRangeTableRelation(RangeTblEntry *rangeTableEntry); diff --git a/src/backend/distributed/utils/reference_table_utils.c b/src/backend/distributed/utils/reference_table_utils.c index 314044ab5cb..b1710c1d6d2 100644 --- a/src/backend/distributed/utils/reference_table_utils.c +++ b/src/backend/distributed/utils/reference_table_utils.c @@ -10,19 +10,27 @@ */ #include "postgres.h" + #include "miscadmin.h" +#include "access/genam.h" #include "access/heapam.h" #include "access/htup_details.h" -#include "access/genam.h" +#include "postmaster/postmaster.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/rel.h" + #include "distributed/backend_data.h" #include "distributed/colocation_utils.h" #include "distributed/commands.h" -#include "distributed/listutils.h" #include "distributed/coordinator_protocol.h" -#include "distributed/metadata_utility.h" +#include "distributed/listutils.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_logical_planner.h" #include "distributed/reference_table_utils.h" @@ -33,12 +41,6 @@ #include "distributed/transaction_management.h" #include "distributed/worker_manager.h" #include "distributed/worker_transaction.h" -#include "postmaster/postmaster.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/rel.h" /* local function forward declarations */ static List * WorkersWithoutReferenceTablePlacement(uint64 shardId, LOCKMODE lockMode); diff --git a/src/backend/distributed/utils/replication_origin_session_utils.c b/src/backend/distributed/utils/replication_origin_session_utils.c index 3a1a94a6f6f..370b061be6c 100644 --- a/src/backend/distributed/utils/replication_origin_session_utils.c +++ b/src/backend/distributed/utils/replication_origin_session_utils.c @@ -9,12 +9,14 @@ */ #include "postgres.h" -#include "distributed/replication_origin_session_utils.h" -#include "distributed/remote_commands.h" -#include "distributed/metadata_cache.h" -#include "utils/builtins.h" #include "miscadmin.h" +#include "utils/builtins.h" + +#include "distributed/metadata_cache.h" +#include "distributed/remote_commands.h" +#include "distributed/replication_origin_session_utils.h" + static bool IsRemoteReplicationOriginSessionSetup(MultiConnection *connection); static void SetupMemoryContextResetReplicationOriginHandler(void); diff --git a/src/backend/distributed/utils/resource_lock.c b/src/backend/distributed/utils/resource_lock.c index c76830c1d34..13e88a16e75 100644 --- a/src/backend/distributed/utils/resource_lock.c +++ b/src/backend/distributed/utils/resource_lock.c @@ -14,38 +14,40 @@ */ #include "postgres.h" + #include "c.h" #include "miscadmin.h" #include "access/xact.h" #include "catalog/namespace.h" #include "commands/tablecmds.h" +#include "storage/lmgr.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/varlena.h" + #include "distributed/colocation_utils.h" #include "distributed/commands.h" -#include "distributed/listutils.h" -#include "distributed/metadata_utility.h" #include "distributed/coordinator_protocol.h" +#include "distributed/distributed_planner.h" +#include "distributed/listutils.h" +#include "distributed/local_executor.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_executor.h" #include "distributed/multi_join_order.h" #include "distributed/multi_partitioning_utils.h" -#include "distributed/distributed_planner.h" -#include "distributed/relay_utility.h" #include "distributed/reference_table_utils.h" +#include "distributed/relay_utility.h" #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" #include "distributed/shardinterval_utils.h" -#include "distributed/worker_protocol.h" -#include "distributed/worker_transaction.h" #include "distributed/utils/array_type.h" #include "distributed/version_compat.h" -#include "distributed/local_executor.h" +#include "distributed/worker_protocol.h" #include "distributed/worker_shard_visibility.h" -#include "storage/lmgr.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/varlena.h" +#include "distributed/worker_transaction.h" #define LOCK_RELATION_IF_EXISTS \ "SELECT pg_catalog.lock_relation_if_exists(%s, %s);" diff --git a/src/backend/distributed/utils/role.c b/src/backend/distributed/utils/role.c index 3a9a90f9fca..9e92a3290a1 100644 --- a/src/backend/distributed/utils/role.c +++ b/src/backend/distributed/utils/role.c @@ -10,13 +10,15 @@ */ #include "postgres.h" -#include "distributed/commands/utility_hook.h" -#include "distributed/worker_protocol.h" #include "fmgr.h" + #include "tcop/dest.h" #include "tcop/utility.h" #include "utils/builtins.h" +#include "distributed/commands/utility_hook.h" +#include "distributed/worker_protocol.h" + PG_FUNCTION_INFO_V1(alter_role_if_exists); PG_FUNCTION_INFO_V1(worker_create_or_alter_role); diff --git a/src/backend/distributed/utils/shard_utils.c b/src/backend/distributed/utils/shard_utils.c index d6d41f19223..cd688b745b0 100644 --- a/src/backend/distributed/utils/shard_utils.c +++ b/src/backend/distributed/utils/shard_utils.c @@ -12,9 +12,11 @@ #include "postgres.h" #include "miscadmin.h" + #include "utils/builtins.h" #include "utils/fmgrprotos.h" #include "utils/lsyscache.h" + #include "distributed/coordinator_protocol.h" #include "distributed/listutils.h" #include "distributed/log_utils.h" diff --git a/src/backend/distributed/utils/shardinterval_utils.c b/src/backend/distributed/utils/shardinterval_utils.c index 6c18e201ec7..16d43ffdcb2 100644 --- a/src/backend/distributed/utils/shardinterval_utils.c +++ b/src/backend/distributed/utils/shardinterval_utils.c @@ -8,23 +8,25 @@ * *------------------------------------------------------------------------- */ -#include "stdint.h" #include "postgres.h" +#include "stdint.h" + #include "access/nbtree.h" #include "catalog/pg_am.h" #include "catalog/pg_collation.h" #include "catalog/pg_type.h" +#include "utils/catcache.h" +#include "utils/memutils.h" + +#include "distributed/distributed_planner.h" #include "distributed/listutils.h" #include "distributed/metadata_cache.h" #include "distributed/multi_join_order.h" -#include "distributed/distributed_planner.h" +#include "distributed/pg_dist_partition.h" #include "distributed/shard_pruning.h" #include "distributed/shardinterval_utils.h" -#include "distributed/pg_dist_partition.h" #include "distributed/worker_protocol.h" -#include "utils/catcache.h" -#include "utils/memutils.h" /* diff --git a/src/backend/distributed/utils/statistics_collection.c b/src/backend/distributed/utils/statistics_collection.c index a442aac9544..1cadea968c3 100644 --- a/src/backend/distributed/utils/statistics_collection.c +++ b/src/backend/distributed/utils/statistics_collection.c @@ -10,10 +10,12 @@ #include "postgres.h" -#include "citus_version.h" #include "fmgr.h" + #include "utils/uuid.h" +#include "citus_version.h" + #if defined(HAVE_LIBCURL) && defined(ENABLE_CITUS_STATISTICS_COLLECTION) bool EnableStatisticsCollection = true; /* send basic usage statistics to Citus */ #else @@ -28,18 +30,19 @@ PG_FUNCTION_INFO_V1(citus_server_id); #include #include "access/xact.h" +#include "lib/stringinfo.h" +#include "utils/builtins.h" +#include "utils/fmgrprotos.h" +#include "utils/json.h" +#include "utils/jsonb.h" + #include "distributed/listutils.h" #include "distributed/metadata_cache.h" #include "distributed/multi_join_order.h" #include "distributed/shardinterval_utils.h" #include "distributed/statistics_collection.h" -#include "distributed/worker_manager.h" #include "distributed/version_compat.h" -#include "lib/stringinfo.h" -#include "utils/builtins.h" -#include "utils/json.h" -#include "utils/jsonb.h" -#include "utils/fmgrprotos.h" +#include "distributed/worker_manager.h" static size_t StatisticsCallback(char *contents, size_t size, size_t count, void *userData); diff --git a/src/backend/distributed/utils/task_execution_utils.c b/src/backend/distributed/utils/task_execution_utils.c index 7251514b5f4..5a6f74283d8 100644 --- a/src/backend/distributed/utils/task_execution_utils.c +++ b/src/backend/distributed/utils/task_execution_utils.c @@ -1,16 +1,21 @@ -#include "postgres.h" -#include "miscadmin.h" - +#include #include #include -#include -#include "pg_version_constants.h" +#include "postgres.h" -#include "common/hashfn.h" +#include "miscadmin.h" #include "commands/dbcommands.h" +#include "common/hashfn.h" +#include "storage/fd.h" +#include "utils/builtins.h" +#include "utils/hsearch.h" +#include "utils/timestamp.h" + +#include "pg_version_constants.h" + #include "distributed/citus_custom_scan.h" #include "distributed/citus_nodes.h" #include "distributed/connection_management.h" @@ -27,12 +32,8 @@ #include "distributed/resource_lock.h" #include "distributed/subplan_execution.h" #include "distributed/task_execution_utils.h" -#include "distributed/worker_protocol.h" #include "distributed/version_compat.h" -#include "storage/fd.h" -#include "utils/builtins.h" -#include "utils/hsearch.h" -#include "utils/timestamp.h" +#include "distributed/worker_protocol.h" /* TaskMapKey is used as a key in task hash */ typedef struct TaskMapKey diff --git a/src/backend/distributed/utils/tenant_schema_metadata.c b/src/backend/distributed/utils/tenant_schema_metadata.c index e634795a217..57ae1d15199 100644 --- a/src/backend/distributed/utils/tenant_schema_metadata.c +++ b/src/backend/distributed/utils/tenant_schema_metadata.c @@ -14,14 +14,15 @@ #include "access/genam.h" #include "access/htup.h" #include "access/table.h" +#include "storage/lockdefs.h" +#include "utils/fmgroids.h" +#include "utils/relcache.h" + #include "distributed/colocation_utils.h" #include "distributed/metadata_cache.h" #include "distributed/metadata_sync.h" #include "distributed/pg_dist_schema.h" #include "distributed/tenant_schema_metadata.h" -#include "storage/lockdefs.h" -#include "utils/relcache.h" -#include "utils/fmgroids.h" /* diff --git a/src/backend/distributed/utils/tuplestore.c b/src/backend/distributed/utils/tuplestore.c index 4473c1f3eb1..ea59e70405a 100644 --- a/src/backend/distributed/utils/tuplestore.c +++ b/src/backend/distributed/utils/tuplestore.c @@ -10,9 +10,10 @@ #include "postgres.h" -#include "distributed/tuplestore.h" #include "miscadmin.h" +#include "distributed/tuplestore.h" + /* * CheckTuplestoreReturn checks if a tuplestore can be returned in the callsite * of the UDF. diff --git a/src/backend/distributed/utils/type_utils.c b/src/backend/distributed/utils/type_utils.c index 66a924a02ac..fca3313741e 100644 --- a/src/backend/distributed/utils/type_utils.c +++ b/src/backend/distributed/utils/type_utils.c @@ -10,13 +10,14 @@ */ #include "postgres.h" + #include "fmgr.h" #include "libpq-fe.h" #include "catalog/pg_type.h" +#include "libpq/pqformat.h" #include "nodes/pg_list.h" #include "utils/syscache.h" -#include "libpq/pqformat.h" #include "distributed/causal_clock.h" diff --git a/src/backend/distributed/worker/task_tracker_protocol.c b/src/backend/distributed/worker/task_tracker_protocol.c index 9b2016f67ab..abe1f765e1e 100644 --- a/src/backend/distributed/worker/task_tracker_protocol.c +++ b/src/backend/distributed/worker/task_tracker_protocol.c @@ -12,6 +12,7 @@ */ #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" diff --git a/src/backend/distributed/worker/worker_create_or_replace.c b/src/backend/distributed/worker/worker_create_or_replace.c index 804e711259a..2fab84ac6b6 100644 --- a/src/backend/distributed/worker/worker_create_or_replace.c +++ b/src/backend/distributed/worker/worker_create_or_replace.c @@ -9,23 +9,24 @@ #include "postgres.h" +#include "fmgr.h" +#include "funcapi.h" + #include "access/htup_details.h" #include "catalog/dependency.h" #include "catalog/pg_collation.h" #include "catalog/pg_proc.h" #include "catalog/pg_ts_config.h" #include "catalog/pg_type.h" -#include "fmgr.h" -#include "funcapi.h" #include "nodes/makefuncs.h" #include "nodes/nodes.h" #include "parser/parse_type.h" #include "tcop/dest.h" #include "tcop/utility.h" #include "utils/builtins.h" -#include "utils/syscache.h" #include "utils/lsyscache.h" #include "utils/regproc.h" +#include "utils/syscache.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" diff --git a/src/backend/distributed/worker/worker_data_fetch_protocol.c b/src/backend/distributed/worker/worker_data_fetch_protocol.c index 11fdda28715..f51d9c80c31 100644 --- a/src/backend/distributed/worker/worker_data_fetch_protocol.c +++ b/src/backend/distributed/worker/worker_data_fetch_protocol.c @@ -12,12 +12,14 @@ *------------------------------------------------------------------------- */ +#include +#include + #include "postgres.h" + #include "funcapi.h" #include "libpq-fe.h" #include "miscadmin.h" -#include -#include #include "access/xact.h" #include "catalog/dependency.h" @@ -27,6 +29,17 @@ #include "commands/dbcommands.h" #include "commands/extension.h" #include "commands/sequence.h" +#include "executor/spi.h" +#include "nodes/makefuncs.h" +#include "parser/parse_relation.h" +#include "storage/lmgr.h" +#include "tcop/tcopprot.h" +#include "tcop/utility.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/regproc.h" +#include "utils/varlena.h" + #include "distributed/citus_ruleutils.h" #include "distributed/commands.h" #include "distributed/commands/multi_copy.h" @@ -44,20 +57,9 @@ #include "distributed/relay_utility.h" #include "distributed/remote_commands.h" #include "distributed/resource_lock.h" - +#include "distributed/version_compat.h" #include "distributed/worker_create_or_replace.h" #include "distributed/worker_protocol.h" -#include "distributed/version_compat.h" -#include "executor/spi.h" -#include "nodes/makefuncs.h" -#include "parser/parse_relation.h" -#include "storage/lmgr.h" -#include "tcop/tcopprot.h" -#include "tcop/utility.h" -#include "utils/builtins.h" -#include "utils/lsyscache.h" -#include "utils/regproc.h" -#include "utils/varlena.h" /* Local functions forward declarations */ diff --git a/src/backend/distributed/worker/worker_drop_protocol.c b/src/backend/distributed/worker/worker_drop_protocol.c index 16b7bb66a75..6d7b5326a82 100644 --- a/src/backend/distributed/worker/worker_drop_protocol.c +++ b/src/backend/distributed/worker/worker_drop_protocol.c @@ -19,21 +19,22 @@ #include "catalog/dependency.h" #include "catalog/pg_depend.h" #include "catalog/pg_foreign_server.h" +#include "foreign/foreign.h" +#include "tcop/utility.h" +#include "utils/builtins.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" + #include "distributed/citus_ruleutils.h" +#include "distributed/commands/utility_hook.h" +#include "distributed/coordinator_protocol.h" #include "distributed/distribution_column.h" #include "distributed/listutils.h" -#include "distributed/metadata_utility.h" -#include "distributed/coordinator_protocol.h" -#include "distributed/commands/utility_hook.h" -#include "distributed/metadata_cache.h" #include "distributed/metadata/distobject.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" #include "distributed/multi_partitioning_utils.h" #include "distributed/worker_protocol.h" -#include "foreign/foreign.h" -#include "tcop/utility.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" PG_FUNCTION_INFO_V1(worker_drop_distributed_table); PG_FUNCTION_INFO_V1(worker_drop_shell_table); diff --git a/src/backend/distributed/worker/worker_partition_protocol.c b/src/backend/distributed/worker/worker_partition_protocol.c index 2291633d470..cdbda6d3e07 100644 --- a/src/backend/distributed/worker/worker_partition_protocol.c +++ b/src/backend/distributed/worker/worker_partition_protocol.c @@ -10,6 +10,7 @@ */ #include "postgres.h" + #include "funcapi.h" #include "miscadmin.h" diff --git a/src/backend/distributed/worker/worker_shard_visibility.c b/src/backend/distributed/worker/worker_shard_visibility.c index 63a9cca348a..49131ef6dbb 100644 --- a/src/backend/distributed/worker/worker_shard_visibility.c +++ b/src/backend/distributed/worker/worker_shard_visibility.c @@ -8,25 +8,27 @@ */ #include "postgres.h" + #include "miscadmin.h" #include "catalog/index.h" #include "catalog/namespace.h" #include "catalog/pg_class.h" #include "catalog/pg_type.h" +#include "nodes/makefuncs.h" +#include "nodes/nodeFuncs.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" +#include "utils/varlena.h" + #include "distributed/backend_data.h" -#include "distributed/metadata_cache.h" #include "distributed/coordinator_protocol.h" #include "distributed/listutils.h" #include "distributed/local_executor.h" +#include "distributed/metadata_cache.h" #include "distributed/query_colocation_checker.h" #include "distributed/worker_protocol.h" #include "distributed/worker_shard_visibility.h" -#include "nodes/makefuncs.h" -#include "nodes/nodeFuncs.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" -#include "utils/varlena.h" /* HideShardsMode is used to determine whether to hide shards */ diff --git a/src/backend/distributed/worker/worker_sql_task_protocol.c b/src/backend/distributed/worker/worker_sql_task_protocol.c index 38dba5e35f0..a3adbb9d8ba 100644 --- a/src/backend/distributed/worker/worker_sql_task_protocol.c +++ b/src/backend/distributed/worker/worker_sql_task_protocol.c @@ -10,16 +10,18 @@ */ #include "postgres.h" + #include "funcapi.h" #include "pgstat.h" +#include "utils/builtins.h" +#include "utils/memutils.h" + #include "distributed/commands/multi_copy.h" #include "distributed/multi_executor.h" #include "distributed/transmit.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" -#include "utils/builtins.h" -#include "utils/memutils.h" /* necessary to get S_IRUSR, S_IWUSR definitions on illumos */ #include diff --git a/src/backend/distributed/worker/worker_truncate_trigger_protocol.c b/src/backend/distributed/worker/worker_truncate_trigger_protocol.c index dc4e7ffd89d..3f8f96b2d70 100644 --- a/src/backend/distributed/worker/worker_truncate_trigger_protocol.c +++ b/src/backend/distributed/worker/worker_truncate_trigger_protocol.c @@ -12,16 +12,18 @@ */ #include "postgres.h" + #include "fmgr.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/metadata_utility.h" -#include "distributed/metadata_cache.h" -#include "distributed/metadata_sync.h" #include "utils/elog.h" #include "utils/fmgroids.h" #include "utils/lsyscache.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_sync.h" +#include "distributed/metadata_utility.h" + PG_FUNCTION_INFO_V1(worker_create_truncate_trigger); diff --git a/src/include/columnar/columnar.h b/src/include/columnar/columnar.h index 64cf745e101..7167bcc1c20 100644 --- a/src/include/columnar/columnar.h +++ b/src/include/columnar/columnar.h @@ -14,11 +14,13 @@ #include "postgres.h" #include "fmgr.h" + #include "lib/stringinfo.h" #include "nodes/parsenodes.h" -#include "pg_version_compat.h" #include "storage/bufpage.h" #include "storage/lockdefs.h" + +#include "pg_version_compat.h" #if PG_VERSION_NUM >= PG_VERSION_16 #include "storage/relfilelocator.h" #else diff --git a/src/include/columnar/columnar_tableam.h b/src/include/columnar/columnar_tableam.h index 657491ef87a..18331bd70b4 100644 --- a/src/include/columnar/columnar_tableam.h +++ b/src/include/columnar/columnar_tableam.h @@ -1,16 +1,18 @@ #ifndef COLUMNAR_TABLEAM_H #define COLUMNAR_TABLEAM_H -#include "citus_version.h" - #include "postgres.h" + #include "fmgr.h" -#include "access/tableam.h" -#include "access/skey.h" -#include "nodes/bitmapset.h" + #include "access/heapam.h" +#include "access/skey.h" +#include "access/tableam.h" #include "catalog/indexing.h" +#include "nodes/bitmapset.h" #include "utils/acl.h" +#include "citus_version.h" + /* * Number of valid ItemPointer Offset's for "row number" <> "ItemPointer" * mapping. diff --git a/src/include/distributed/backend_data.h b/src/include/distributed/backend_data.h index 1fcd3114176..8014fe5a6a9 100644 --- a/src/include/distributed/backend_data.h +++ b/src/include/distributed/backend_data.h @@ -15,12 +15,13 @@ #include "access/twophase.h" #include "datatype/timestamp.h" -#include "distributed/transaction_identifier.h" #include "nodes/pg_list.h" #include "storage/lwlock.h" #include "storage/proc.h" #include "storage/s_lock.h" +#include "distributed/transaction_identifier.h" + /* * Each backend's active distributed transaction information is tracked via diff --git a/src/include/distributed/citus_custom_scan.h b/src/include/distributed/citus_custom_scan.h index a3da4958c8d..db1f0ce1f2a 100644 --- a/src/include/distributed/citus_custom_scan.h +++ b/src/include/distributed/citus_custom_scan.h @@ -10,11 +10,12 @@ #ifndef CITUS_CUSTOM_SCAN_H #define CITUS_CUSTOM_SCAN_H -#include "distributed/distributed_planner.h" -#include "distributed/multi_server_executor.h" #include "executor/execdesc.h" #include "nodes/plannodes.h" +#include "distributed/distributed_planner.h" +#include "distributed/multi_server_executor.h" + typedef struct CitusScanState { CustomScanState customScanState; /* underlying custom scan node */ diff --git a/src/include/distributed/citus_depended_object.h b/src/include/distributed/citus_depended_object.h index b520184119e..1efbe4e2a1d 100644 --- a/src/include/distributed/citus_depended_object.h +++ b/src/include/distributed/citus_depended_object.h @@ -12,10 +12,11 @@ #ifndef CITUS_DEPENDED_OBJECT_H #define CITUS_DEPENDED_OBJECT_H -#include "distributed/commands.h" #include "nodes/nodes.h" #include "nodes/parsenodes.h" +#include "distributed/commands.h" + extern bool HideCitusDependentObjects; /* DistOpsValidationState to be used to determine validity of dist ops */ diff --git a/src/include/distributed/citus_nodefuncs.h b/src/include/distributed/citus_nodefuncs.h index caeda3a728c..f7c0061b977 100644 --- a/src/include/distributed/citus_nodefuncs.h +++ b/src/include/distributed/citus_nodefuncs.h @@ -11,10 +11,11 @@ #ifndef CITUS_NODEFUNCS_H #define CITUS_NODEFUNCS_H -#include "distributed/multi_physical_planner.h" #include "nodes/nodes.h" #include "nodes/parsenodes.h" +#include "distributed/multi_physical_planner.h" + /* citus_nodefuncs.c */ extern void SetRangeTblExtraData(RangeTblEntry *rte, CitusRTEKind rteKind, char *fragmentSchemaName, char *fragmentTableName, diff --git a/src/include/distributed/citus_ruleutils.h b/src/include/distributed/citus_ruleutils.h index e45ddb26978..3a9c364824f 100644 --- a/src/include/distributed/citus_ruleutils.h +++ b/src/include/distributed/citus_ruleutils.h @@ -15,11 +15,12 @@ #include "catalog/pg_sequence.h" #include "commands/sequence.h" -#include "distributed/coordinator_protocol.h" #include "lib/stringinfo.h" #include "nodes/parsenodes.h" #include "nodes/pg_list.h" +#include "distributed/coordinator_protocol.h" + /* Function declarations for version independent Citus ruleutils wrapper functions */ extern char * pg_get_extensiondef_string(Oid tableRelationId); extern Oid get_extension_schema(Oid ext_oid); diff --git a/src/include/distributed/colocation_utils.h b/src/include/distributed/colocation_utils.h index bba78afd1ef..018f9757078 100644 --- a/src/include/distributed/colocation_utils.h +++ b/src/include/distributed/colocation_utils.h @@ -12,9 +12,10 @@ #ifndef COLOCATION_UTILS_H_ #define COLOCATION_UTILS_H_ -#include "distributed/shardinterval_utils.h" #include "nodes/pg_list.h" +#include "distributed/shardinterval_utils.h" + #define INVALID_COLOCATION_ID 0 extern uint32 TableColocationId(Oid distributedTableId); diff --git a/src/include/distributed/combine_query_planner.h b/src/include/distributed/combine_query_planner.h index 71001091355..2afc8aa5f53 100644 --- a/src/include/distributed/combine_query_planner.h +++ b/src/include/distributed/combine_query_planner.h @@ -14,9 +14,8 @@ #include "lib/stringinfo.h" #include "nodes/parsenodes.h" -#include "nodes/plannodes.h" - #include "nodes/pathnodes.h" +#include "nodes/plannodes.h" /* Function declarations for building local plans on the coordinator node */ diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index 43429278f1a..c5a4c09d6c7 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -15,12 +15,13 @@ #include "postgres.h" -#include "distributed/metadata_utility.h" -#include "utils/rel.h" #include "nodes/parsenodes.h" #include "tcop/dest.h" #include "tcop/utility.h" #include "utils/acl.h" +#include "utils/rel.h" + +#include "distributed/metadata_utility.h" extern bool AddAllLocalTablesToMetadata; diff --git a/src/include/distributed/commands/multi_copy.h b/src/include/distributed/commands/multi_copy.h index fa59894ad87..1fc42df60ca 100644 --- a/src/include/distributed/commands/multi_copy.h +++ b/src/include/distributed/commands/multi_copy.h @@ -13,14 +13,15 @@ #define MULTI_COPY_H -#include "distributed/metadata_utility.h" -#include "distributed/metadata_cache.h" -#include "distributed/version_compat.h" #include "nodes/execnodes.h" #include "nodes/parsenodes.h" #include "parser/parse_coerce.h" #include "tcop/dest.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" +#include "distributed/version_compat.h" + #define INVALID_PARTITION_COLUMN_INDEX -1 diff --git a/src/include/distributed/commands/utility_hook.h b/src/include/distributed/commands/utility_hook.h index c474dcc430e..d2fb08ea7be 100644 --- a/src/include/distributed/commands/utility_hook.h +++ b/src/include/distributed/commands/utility_hook.h @@ -10,12 +10,12 @@ #ifndef MULTI_UTILITY_H #define MULTI_UTILITY_H -#include "pg_version_constants.h" - #include "postgres.h" -#include "utils/relcache.h" #include "tcop/utility.h" +#include "utils/relcache.h" + +#include "pg_version_constants.h" #include "distributed/coordinator_protocol.h" #include "distributed/function_call_delegation.h" diff --git a/src/include/distributed/connection_management.h b/src/include/distributed/connection_management.h index 158f0b1ce3d..9eadbde9dee 100644 --- a/src/include/distributed/connection_management.h +++ b/src/include/distributed/connection_management.h @@ -13,16 +13,18 @@ #include "postgres.h" -#include "distributed/transaction_management.h" -#include "distributed/remote_transaction.h" -#include "lib/ilist.h" #include "pg_config.h" + +#include "lib/ilist.h" #include "portability/instr_time.h" #include "storage/latch.h" #include "utils/guc.h" #include "utils/hsearch.h" #include "utils/timestamp.h" +#include "distributed/remote_transaction.h" +#include "distributed/transaction_management.h" + /* maximum (textual) lengths of hostname and port */ #define MAX_NODE_LENGTH 255 /* includes 0 byte */ diff --git a/src/include/distributed/coordinator_protocol.h b/src/include/distributed/coordinator_protocol.h index 0dcc6614118..b2170fd2edc 100644 --- a/src/include/distributed/coordinator_protocol.h +++ b/src/include/distributed/coordinator_protocol.h @@ -13,16 +13,18 @@ #define COORDINATOR_PROTOCOL_H #include "postgres.h" + #include "c.h" #include "fmgr.h" -#include "distributed/connection_management.h" -#include "distributed/shardinterval_utils.h" #include "nodes/pg_list.h" -#include "distributed/metadata_utility.h" #include "columnar/columnar.h" +#include "distributed/connection_management.h" +#include "distributed/metadata_utility.h" +#include "distributed/shardinterval_utils.h" + /* * In our distributed database, we need a mechanism to make remote procedure * calls between clients, the coordinator node, and worker nodes. These remote calls diff --git a/src/include/distributed/deparse_shard_query.h b/src/include/distributed/deparse_shard_query.h index 9370e51e225..8fb012588de 100644 --- a/src/include/distributed/deparse_shard_query.h +++ b/src/include/distributed/deparse_shard_query.h @@ -18,6 +18,7 @@ #include "nodes/nodes.h" #include "nodes/parsenodes.h" #include "nodes/pg_list.h" + #include "distributed/citus_custom_scan.h" diff --git a/src/include/distributed/deparser.h b/src/include/distributed/deparser.h index 95d948bc9e9..23d2e0e59ac 100644 --- a/src/include/distributed/deparser.h +++ b/src/include/distributed/deparser.h @@ -15,10 +15,10 @@ #include "postgres.h" -#include "nodes/nodes.h" -#include "nodes/parsenodes.h" #include "catalog/objectaddress.h" #include "lib/stringinfo.h" +#include "nodes/nodes.h" +#include "nodes/parsenodes.h" /* forward declarations for format_collate.c */ /* Control flags for FormatCollateExtended, compatible with format_type_extended */ diff --git a/src/include/distributed/distributed_deadlock_detection.h b/src/include/distributed/distributed_deadlock_detection.h index 23f6554efe7..5f391cc7073 100644 --- a/src/include/distributed/distributed_deadlock_detection.h +++ b/src/include/distributed/distributed_deadlock_detection.h @@ -14,11 +14,12 @@ #include "postgres.h" #include "access/hash.h" +#include "nodes/pg_list.h" + #include "distributed/backend_data.h" #include "distributed/listutils.h" #include "distributed/lock_graph.h" #include "distributed/transaction_identifier.h" -#include "nodes/pg_list.h" typedef struct TransactionNode { diff --git a/src/include/distributed/distributed_execution_locks.h b/src/include/distributed/distributed_execution_locks.h index e789843ae33..3ca31b3308e 100644 --- a/src/include/distributed/distributed_execution_locks.h +++ b/src/include/distributed/distributed_execution_locks.h @@ -14,6 +14,7 @@ #include "nodes/pg_list.h" #include "storage/lockdefs.h" + #include "distributed/multi_physical_planner.h" extern void AcquireExecutorShardLocksForExecution(RowModifyLevel modLevel, diff --git a/src/include/distributed/distributed_planner.h b/src/include/distributed/distributed_planner.h index bc8f5bc9434..d7234e4bcc5 100644 --- a/src/include/distributed/distributed_planner.h +++ b/src/include/distributed/distributed_planner.h @@ -12,11 +12,10 @@ #include "postgres.h" -#include "pg_version_constants.h" - +#include "nodes/pathnodes.h" #include "nodes/plannodes.h" -#include "nodes/pathnodes.h" +#include "pg_version_constants.h" #include "distributed/citus_nodes.h" #include "distributed/errormessage.h" diff --git a/src/include/distributed/enterprise.h b/src/include/distributed/enterprise.h index 26a882bd688..2ba2fa1ffb2 100644 --- a/src/include/distributed/enterprise.h +++ b/src/include/distributed/enterprise.h @@ -13,6 +13,7 @@ #define CITUS_ENTERPRISE_H #include "postgres.h" + #include "fmgr.h" diff --git a/src/include/distributed/errormessage.h b/src/include/distributed/errormessage.h index 3c19a9c834f..7a38d513c29 100644 --- a/src/include/distributed/errormessage.h +++ b/src/include/distributed/errormessage.h @@ -11,9 +11,11 @@ #define ERRORMESSAGE_H #include "c.h" -#include "distributed/citus_nodes.h" + #include "pg_version_compat.h" +#include "distributed/citus_nodes.h" + typedef struct DeferredErrorMessage { diff --git a/src/include/distributed/executor_util.h b/src/include/distributed/executor_util.h index 8560c6dfd2e..b39122d263b 100644 --- a/src/include/distributed/executor_util.h +++ b/src/include/distributed/executor_util.h @@ -12,10 +12,11 @@ #include "funcapi.h" #include "access/tupdesc.h" -#include "distributed/multi_physical_planner.h" #include "nodes/params.h" #include "nodes/pg_list.h" +#include "distributed/multi_physical_planner.h" + /* utility functions for dealing with tasks in the executor */ extern bool TaskListModifiesDatabase(RowModifyLevel modLevel, List *taskList); diff --git a/src/include/distributed/foreign_key_relationship.h b/src/include/distributed/foreign_key_relationship.h index fbbee831e7a..bbaf8be7353 100644 --- a/src/include/distributed/foreign_key_relationship.h +++ b/src/include/distributed/foreign_key_relationship.h @@ -10,10 +10,12 @@ #define FOREIGN_KEY_RELATIONSHIP_H #include "postgres.h" + #include "postgres_ext.h" -#include "utils/relcache.h" -#include "utils/hsearch.h" + #include "nodes/primnodes.h" +#include "utils/hsearch.h" +#include "utils/relcache.h" extern List * GetForeignKeyConnectedRelationIdList(Oid relationId); extern bool ShouldUndistributeCitusLocalTable(Oid relationId); diff --git a/src/include/distributed/hash_helpers.h b/src/include/distributed/hash_helpers.h index 168879b4d8d..b64bfde71ae 100644 --- a/src/include/distributed/hash_helpers.h +++ b/src/include/distributed/hash_helpers.h @@ -11,10 +11,10 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "utils/hsearch.h" +#include "pg_version_constants.h" + /* * assert_valid_hash_key2 checks if a type that contains 2 fields contains no * padding bytes. This is necessary to use a type as a hash key with tag_hash. diff --git a/src/include/distributed/insert_select_planner.h b/src/include/distributed/insert_select_planner.h index 771d1d60f39..a9100b02dfd 100644 --- a/src/include/distributed/insert_select_planner.h +++ b/src/include/distributed/insert_select_planner.h @@ -16,12 +16,13 @@ #include "postgres.h" -#include "distributed/multi_physical_planner.h" -#include "distributed/distributed_planner.h" #include "nodes/execnodes.h" #include "nodes/parsenodes.h" #include "nodes/plannodes.h" +#include "distributed/distributed_planner.h" +#include "distributed/multi_physical_planner.h" + extern bool InsertSelectIntoCitusTable(Query *query); extern bool CheckInsertSelectQuery(Query *query); diff --git a/src/include/distributed/intermediate_results.h b/src/include/distributed/intermediate_results.h index 63eca5ad1a4..ca4fa581e05 100644 --- a/src/include/distributed/intermediate_results.h +++ b/src/include/distributed/intermediate_results.h @@ -14,13 +14,14 @@ #include "fmgr.h" -#include "distributed/commands/multi_copy.h" #include "nodes/execnodes.h" #include "nodes/pg_list.h" #include "tcop/dest.h" #include "utils/builtins.h" #include "utils/palloc.h" +#include "distributed/commands/multi_copy.h" + /* * DistributedResultFragment represents a fragment of a distributed result. diff --git a/src/include/distributed/listutils.h b/src/include/distributed/listutils.h index 833c77d2263..2a52cbc7527 100644 --- a/src/include/distributed/listutils.h +++ b/src/include/distributed/listutils.h @@ -13,13 +13,15 @@ #define CITUS_LISTUTILS_H #include "postgres.h" + #include "c.h" #include "nodes/pg_list.h" -#include "pg_version_compat.h" #include "utils/array.h" #include "utils/hsearch.h" +#include "pg_version_compat.h" + /* * ListCellAndListWrapper stores a list and list cell. diff --git a/src/include/distributed/local_distributed_join_planner.h b/src/include/distributed/local_distributed_join_planner.h index dfb45f149ae..3390ab213eb 100644 --- a/src/include/distributed/local_distributed_join_planner.h +++ b/src/include/distributed/local_distributed_join_planner.h @@ -14,6 +14,7 @@ #define LOCAL_DISTRIBUTED_JOIN_PLANNER_H #include "postgres.h" + #include "distributed/recursive_planning.h" /* managed via guc.c */ diff --git a/src/include/distributed/lock_graph.h b/src/include/distributed/lock_graph.h index f204ebb034b..e14a515803c 100644 --- a/src/include/distributed/lock_graph.h +++ b/src/include/distributed/lock_graph.h @@ -14,12 +14,14 @@ #include "postgres.h" + #include "libpq-fe.h" #include "datatype/timestamp.h" -#include "distributed/backend_data.h" #include "storage/lock.h" +#include "distributed/backend_data.h" + /* * Describes an edge in a waiting-for graph of locks. This isn't used for diff --git a/src/include/distributed/merge_planner.h b/src/include/distributed/merge_planner.h index 89829260327..b6636687aa1 100644 --- a/src/include/distributed/merge_planner.h +++ b/src/include/distributed/merge_planner.h @@ -15,6 +15,7 @@ #include "c.h" #include "nodes/parsenodes.h" + #include "distributed/distributed_planner.h" #include "distributed/errormessage.h" #include "distributed/multi_physical_planner.h" diff --git a/src/include/distributed/metadata/dependency.h b/src/include/distributed/metadata/dependency.h index 2d3759e1f08..2cfefc87eb0 100644 --- a/src/include/distributed/metadata/dependency.h +++ b/src/include/distributed/metadata/dependency.h @@ -16,9 +16,10 @@ #include "catalog/objectaddress.h" #include "catalog/pg_depend.h" -#include "distributed/errormessage.h" #include "nodes/pg_list.h" +#include "distributed/errormessage.h" + typedef bool (*AddressPredicate)(const ObjectAddress *); extern List * GetUniqueDependenciesList(List *objectAddressesList); diff --git a/src/include/distributed/metadata_cache.h b/src/include/distributed/metadata_cache.h index 34b95b859e4..f1120497b72 100644 --- a/src/include/distributed/metadata_cache.h +++ b/src/include/distributed/metadata_cache.h @@ -14,10 +14,12 @@ #include "postgres.h" #include "fmgr.h" + +#include "utils/hsearch.h" + #include "distributed/metadata_utility.h" #include "distributed/pg_dist_partition.h" #include "distributed/worker_manager.h" -#include "utils/hsearch.h" extern bool EnableVersionChecks; diff --git a/src/include/distributed/metadata_sync.h b/src/include/distributed/metadata_sync.h index 237df363a13..4e190ec3904 100644 --- a/src/include/distributed/metadata_sync.h +++ b/src/include/distributed/metadata_sync.h @@ -13,10 +13,11 @@ #define METADATA_SYNC_H +#include "nodes/pg_list.h" + #include "distributed/commands/utility_hook.h" #include "distributed/coordinator_protocol.h" #include "distributed/metadata_cache.h" -#include "nodes/pg_list.h" /* managed via guc.c */ typedef enum diff --git a/src/include/distributed/metadata_utility.h b/src/include/distributed/metadata_utility.h index 7e50a6af639..04a4b500bfe 100644 --- a/src/include/distributed/metadata_utility.h +++ b/src/include/distributed/metadata_utility.h @@ -21,13 +21,14 @@ #include "access/tupdesc.h" #include "catalog/indexing.h" #include "catalog/objectaddress.h" +#include "utils/acl.h" +#include "utils/relcache.h" + #include "distributed/citus_nodes.h" #include "distributed/connection_management.h" #include "distributed/errormessage.h" #include "distributed/relay_utility.h" #include "distributed/worker_manager.h" -#include "utils/acl.h" -#include "utils/relcache.h" /* total number of hash tokens (2^32) */ diff --git a/src/include/distributed/multi_executor.h b/src/include/distributed/multi_executor.h index 5ae010d870d..6708d9a6445 100644 --- a/src/include/distributed/multi_executor.h +++ b/src/include/distributed/multi_executor.h @@ -11,8 +11,8 @@ #define MULTI_EXECUTOR_H #include "executor/execdesc.h" -#include "nodes/parsenodes.h" #include "nodes/execnodes.h" +#include "nodes/parsenodes.h" #include "distributed/citus_custom_scan.h" #include "distributed/multi_physical_planner.h" diff --git a/src/include/distributed/multi_explain.h b/src/include/distributed/multi_explain.h index 29663490544..f6dad83c2f3 100644 --- a/src/include/distributed/multi_explain.h +++ b/src/include/distributed/multi_explain.h @@ -10,9 +10,10 @@ #ifndef MULTI_EXPLAIN_H #define MULTI_EXPLAIN_H -#include "executor/executor.h" #include "tuple_destination.h" +#include "executor/executor.h" + typedef enum { EXPLAIN_ANALYZE_SORT_BY_TIME = 0, diff --git a/src/include/distributed/multi_logical_planner.h b/src/include/distributed/multi_logical_planner.h index de4901ea2d0..f68fd3ed5b8 100644 --- a/src/include/distributed/multi_logical_planner.h +++ b/src/include/distributed/multi_logical_planner.h @@ -14,15 +14,16 @@ #ifndef MULTI_LOGICAL_PLANNER_H #define MULTI_LOGICAL_PLANNER_H +#include "nodes/nodes.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" + #include "distributed/citus_nodes.h" #include "distributed/errormessage.h" #include "distributed/log_utils.h" #include "distributed/multi_join_order.h" #include "distributed/relation_restriction_equivalence.h" -#include "nodes/nodes.h" -#include "nodes/primnodes.h" -#include "nodes/parsenodes.h" -#include "nodes/pg_list.h" #define SUBQUERY_RANGE_TABLE_ID -1 diff --git a/src/include/distributed/multi_logical_replication.h b/src/include/distributed/multi_logical_replication.h index f5a9dc342a5..2a57c02241a 100644 --- a/src/include/distributed/multi_logical_replication.h +++ b/src/include/distributed/multi_logical_replication.h @@ -15,6 +15,7 @@ #include "c.h" #include "nodes/pg_list.h" + #include "distributed/connection_management.h" #include "distributed/hash_helpers.h" #include "distributed/shard_cleaner.h" diff --git a/src/include/distributed/multi_partitioning_utils.h b/src/include/distributed/multi_partitioning_utils.h index b8cfe38c050..7d76b9aa3d3 100644 --- a/src/include/distributed/multi_partitioning_utils.h +++ b/src/include/distributed/multi_partitioning_utils.h @@ -8,9 +8,10 @@ #define MULTI_PARTITIONING_UTILS_H_ -#include "distributed/metadata_utility.h" #include "nodes/pg_list.h" +#include "distributed/metadata_utility.h" + extern bool PartitionedTable(Oid relationId); extern bool PartitionedTableNoLock(Oid relationId); diff --git a/src/include/distributed/multi_physical_planner.h b/src/include/distributed/multi_physical_planner.h index 6bdc95cb3bf..60c5c978374 100644 --- a/src/include/distributed/multi_physical_planner.h +++ b/src/include/distributed/multi_physical_planner.h @@ -16,21 +16,22 @@ #include "postgres.h" -#include "pg_version_constants.h" - #include "c.h" #include "datatype/timestamp.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" +#include "utils/array.h" + +#include "pg_version_constants.h" + #include "distributed/citus_nodes.h" +#include "distributed/distributed_planner.h" #include "distributed/errormessage.h" #include "distributed/log_utils.h" #include "distributed/metadata_utility.h" -#include "distributed/worker_manager.h" #include "distributed/multi_logical_planner.h" -#include "distributed/distributed_planner.h" -#include "lib/stringinfo.h" -#include "nodes/parsenodes.h" -#include "utils/array.h" +#include "distributed/worker_manager.h" /* Definitions local to the physical planner */ diff --git a/src/include/distributed/multi_progress.h b/src/include/distributed/multi_progress.h index 64bad527f73..2a9cf1cbb5c 100644 --- a/src/include/distributed/multi_progress.h +++ b/src/include/distributed/multi_progress.h @@ -16,6 +16,7 @@ #include "postgres.h" #include "fmgr.h" + #include "nodes/pg_list.h" #include "storage/dsm.h" diff --git a/src/include/distributed/multi_router_planner.h b/src/include/distributed/multi_router_planner.h index 160cf6605ff..ae75ee63147 100644 --- a/src/include/distributed/multi_router_planner.h +++ b/src/include/distributed/multi_router_planner.h @@ -14,12 +14,13 @@ #include "c.h" +#include "nodes/parsenodes.h" + +#include "distributed/distributed_planner.h" #include "distributed/errormessage.h" #include "distributed/log_utils.h" #include "distributed/multi_logical_planner.h" #include "distributed/multi_physical_planner.h" -#include "distributed/distributed_planner.h" -#include "nodes/parsenodes.h" /* reserved alias name for UPSERTs */ diff --git a/src/include/distributed/placement_access.h b/src/include/distributed/placement_access.h index 28b05baae8d..0eafa678a4c 100644 --- a/src/include/distributed/placement_access.h +++ b/src/include/distributed/placement_access.h @@ -11,7 +11,9 @@ #define PLACEMENT_ACCESS_H #include "postgres.h" + #include "nodes/pg_list.h" + #include "distributed/multi_physical_planner.h" /* forward declare, to avoid dependency on ShardPlacement definition */ diff --git a/src/include/distributed/query_colocation_checker.h b/src/include/distributed/query_colocation_checker.h index 562869a9248..2a46d364cfe 100644 --- a/src/include/distributed/query_colocation_checker.h +++ b/src/include/distributed/query_colocation_checker.h @@ -11,10 +11,11 @@ #define QUERY_COLOCATION_CHECKER_H -#include "distributed/distributed_planner.h" #include "nodes/parsenodes.h" #include "nodes/primnodes.h" +#include "distributed/distributed_planner.h" + /* * ColocatedJoinChecker is a helper structure that is used to decide diff --git a/src/include/distributed/query_pushdown_planning.h b/src/include/distributed/query_pushdown_planning.h index 061a4a73082..e0d4f25ddc5 100644 --- a/src/include/distributed/query_pushdown_planning.h +++ b/src/include/distributed/query_pushdown_planning.h @@ -13,10 +13,10 @@ #include "postgres.h" #include "distributed/distributed_planner.h" -#include "distributed/multi_logical_planner.h" -#include "distributed/multi_physical_planner.h" #include "distributed/errormessage.h" #include "distributed/log_utils.h" +#include "distributed/multi_logical_planner.h" +#include "distributed/multi_physical_planner.h" /* Config variables managed via guc.c */ diff --git a/src/include/distributed/query_utils.h b/src/include/distributed/query_utils.h index 7e1ba54e6bd..0b216d158c7 100644 --- a/src/include/distributed/query_utils.h +++ b/src/include/distributed/query_utils.h @@ -12,6 +12,7 @@ #define QUERY_UTILS_H #include "postgres.h" + #include "nodes/pg_list.h" #include "nodes/primnodes.h" diff --git a/src/include/distributed/recursive_planning.h b/src/include/distributed/recursive_planning.h index 87df7fba2e5..c37eba34334 100644 --- a/src/include/distributed/recursive_planning.h +++ b/src/include/distributed/recursive_planning.h @@ -10,13 +10,15 @@ #ifndef RECURSIVE_PLANNING_H #define RECURSIVE_PLANNING_H +#include "nodes/pathnodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" + #include "pg_version_constants.h" + #include "distributed/errormessage.h" #include "distributed/log_utils.h" #include "distributed/relation_restriction_equivalence.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" -#include "nodes/pathnodes.h" typedef struct RecursivePlanningContextInternal RecursivePlanningContext; diff --git a/src/include/distributed/relay_utility.h b/src/include/distributed/relay_utility.h index f5a37da45a5..6fa2172e315 100644 --- a/src/include/distributed/relay_utility.h +++ b/src/include/distributed/relay_utility.h @@ -16,6 +16,7 @@ #define RELAY_UTILITY_H #include "fmgr.h" + #include "lib/stringinfo.h" #include "nodes/nodes.h" diff --git a/src/include/distributed/remote_transaction.h b/src/include/distributed/remote_transaction.h index 6136f25c9f8..1c422da2099 100644 --- a/src/include/distributed/remote_transaction.h +++ b/src/include/distributed/remote_transaction.h @@ -12,8 +12,9 @@ #include "libpq-fe.h" -#include "nodes/pg_list.h" + #include "lib/ilist.h" +#include "nodes/pg_list.h" /* forward declare, to avoid recursive includes */ diff --git a/src/include/distributed/replication_origin_session_utils.h b/src/include/distributed/replication_origin_session_utils.h index e90bd8ab87b..b11d56ffc4d 100644 --- a/src/include/distributed/replication_origin_session_utils.h +++ b/src/include/distributed/replication_origin_session_utils.h @@ -12,7 +12,9 @@ #define REPLICATION_ORIGIN_SESSION_UTILS_H #include "postgres.h" + #include "replication/origin.h" + #include "distributed/connection_management.h" extern void InitializeReplicationOriginSessionUtils(void); diff --git a/src/include/distributed/resource_lock.h b/src/include/distributed/resource_lock.h index 9efa1b7672c..8e0e367352e 100644 --- a/src/include/distributed/resource_lock.h +++ b/src/include/distributed/resource_lock.h @@ -11,13 +11,15 @@ #define RESOURCE_LOCK_H #include "postgres.h" /* IWYU pragma: keep */ + #include "c.h" -#include "distributed/worker_transaction.h" #include "nodes/pg_list.h" #include "storage/lock.h" #include "tcop/utility.h" +#include "distributed/worker_transaction.h" + /* * Postgres' advisory locks use 'field4' to discern between different kind of diff --git a/src/include/distributed/shard_pruning.h b/src/include/distributed/shard_pruning.h index 04176314e81..1b1ffce8abc 100644 --- a/src/include/distributed/shard_pruning.h +++ b/src/include/distributed/shard_pruning.h @@ -11,9 +11,10 @@ #ifndef SHARD_PRUNING_H_ #define SHARD_PRUNING_H_ -#include "distributed/metadata_cache.h" #include "nodes/primnodes.h" +#include "distributed/metadata_cache.h" + #define INVALID_SHARD_INDEX -1 /* Function declarations for shard pruning */ diff --git a/src/include/distributed/shard_rebalancer.h b/src/include/distributed/shard_rebalancer.h index 38ce4f48562..8e47ac1e5c1 100644 --- a/src/include/distributed/shard_rebalancer.h +++ b/src/include/distributed/shard_rebalancer.h @@ -17,7 +17,9 @@ #include "postgres.h" #include "fmgr.h" + #include "nodes/pg_list.h" + #include "distributed/coordinator_protocol.h" #include "distributed/worker_manager.h" diff --git a/src/include/distributed/shard_transfer.h b/src/include/distributed/shard_transfer.h index a6d024a2e97..c1621879bb8 100644 --- a/src/include/distributed/shard_transfer.h +++ b/src/include/distributed/shard_transfer.h @@ -9,9 +9,10 @@ #include "postgres.h" -#include "distributed/shard_rebalancer.h" #include "nodes/pg_list.h" +#include "distributed/shard_rebalancer.h" + extern Datum citus_move_shard_placement(PG_FUNCTION_ARGS); extern Datum citus_move_shard_placement_with_nodeid(PG_FUNCTION_ARGS); diff --git a/src/include/distributed/shardinterval_utils.h b/src/include/distributed/shardinterval_utils.h index 4cc99e6d53c..ed5600a11d8 100644 --- a/src/include/distributed/shardinterval_utils.h +++ b/src/include/distributed/shardinterval_utils.h @@ -12,10 +12,11 @@ #ifndef SHARDINTERVAL_UTILS_H_ #define SHARDINTERVAL_UTILS_H_ -#include "distributed/metadata_utility.h" -#include "distributed/metadata_cache.h" #include "nodes/primnodes.h" +#include "distributed/metadata_cache.h" +#include "distributed/metadata_utility.h" + #define INVALID_SHARD_INDEX -1 /* OperatorCacheEntry contains information for each element in OperatorCache */ diff --git a/src/include/distributed/transaction_management.h b/src/include/distributed/transaction_management.h index ca4e632a93a..fa762682b3b 100644 --- a/src/include/distributed/transaction_management.h +++ b/src/include/distributed/transaction_management.h @@ -14,7 +14,6 @@ #include "lib/ilist.h" #include "lib/stringinfo.h" #include "nodes/pg_list.h" -#include "lib/stringinfo.h" #include "nodes/primnodes.h" #include "utils/hsearch.h" diff --git a/src/include/distributed/tuple_destination.h b/src/include/distributed/tuple_destination.h index 0480ffdc465..5b4f649835f 100644 --- a/src/include/distributed/tuple_destination.h +++ b/src/include/distributed/tuple_destination.h @@ -11,10 +11,11 @@ #define TUPLE_DESTINATION_H #include "access/tupdesc.h" -#include "distributed/multi_physical_planner.h" #include "tcop/dest.h" #include "utils/tuplestore.h" +#include "distributed/multi_physical_planner.h" + typedef struct TupleDestination TupleDestination; diff --git a/src/include/distributed/utils/citus_stat_tenants.h b/src/include/distributed/utils/citus_stat_tenants.h index 0a482b2417b..573502606eb 100644 --- a/src/include/distributed/utils/citus_stat_tenants.h +++ b/src/include/distributed/utils/citus_stat_tenants.h @@ -11,13 +11,14 @@ #ifndef CITUS_ATTRIBUTE_H #define CITUS_ATTRIBUTE_H -#include "distributed/hash_helpers.h" #include "executor/execdesc.h" #include "executor/executor.h" #include "storage/lwlock.h" #include "utils/datetime.h" #include "utils/hsearch.h" +#include "distributed/hash_helpers.h" + #define MAX_TENANT_ATTRIBUTE_LENGTH 100 /* diff --git a/src/include/distributed/utils/directory.h b/src/include/distributed/utils/directory.h index 7ed8a3f95a1..76b6cf1dfdc 100644 --- a/src/include/distributed/utils/directory.h +++ b/src/include/distributed/utils/directory.h @@ -12,6 +12,7 @@ #define CITUS_DIRECTORY_H #include "postgres.h" + #include "lib/stringinfo.h" diff --git a/src/include/distributed/utils/function.h b/src/include/distributed/utils/function.h index 91d4ab84b94..6f527218c27 100644 --- a/src/include/distributed/utils/function.h +++ b/src/include/distributed/utils/function.h @@ -12,6 +12,7 @@ #define CITUS_FUNCTION_H #include "postgres.h" + #include "fmgr.h" diff --git a/src/include/distributed/version_compat.h b/src/include/distributed/version_compat.h index b990b82ef39..f450dc1cee8 100644 --- a/src/include/distributed/version_compat.h +++ b/src/include/distributed/version_compat.h @@ -13,21 +13,21 @@ #include "postgres.h" -#include "access/sdir.h" #include "access/heapam.h" -#include "commands/explain.h" +#include "access/sdir.h" #include "catalog/namespace.h" -#include "distributed/citus_ruleutils.h" -#include "distributed/citus_safe_lib.h" +#include "commands/explain.h" #include "executor/tuptable.h" #include "nodes/parsenodes.h" -#include "parser/parse_func.h" #include "optimizer/optimizer.h" - +#include "parser/parse_func.h" #include "tcop/tcopprot.h" #include "pg_version_compat.h" +#include "distributed/citus_ruleutils.h" +#include "distributed/citus_safe_lib.h" + typedef struct { File fd; diff --git a/src/include/distributed/worker_manager.h b/src/include/distributed/worker_manager.h index 694d38ccf37..02a43fe0b99 100644 --- a/src/include/distributed/worker_manager.h +++ b/src/include/distributed/worker_manager.h @@ -16,9 +16,9 @@ #include "postgres.h" +#include "nodes/pg_list.h" #include "storage/lmgr.h" #include "storage/lockdefs.h" -#include "nodes/pg_list.h" /* Worker nodeName's, nodePort's, and nodeCluster's maximum length */ diff --git a/src/include/distributed/worker_protocol.h b/src/include/distributed/worker_protocol.h index 29d364247b0..21c0c44c87e 100644 --- a/src/include/distributed/worker_protocol.h +++ b/src/include/distributed/worker_protocol.h @@ -17,11 +17,13 @@ #include "postgres.h" #include "fmgr.h" -#include "distributed/shardinterval_utils.h" + #include "lib/stringinfo.h" #include "nodes/parsenodes.h" #include "storage/fd.h" #include "utils/array.h" + +#include "distributed/shardinterval_utils.h" #include "distributed/version_compat.h" diff --git a/src/include/distributed/worker_transaction.h b/src/include/distributed/worker_transaction.h index d622fe366cd..b9a85582871 100644 --- a/src/include/distributed/worker_transaction.h +++ b/src/include/distributed/worker_transaction.h @@ -12,9 +12,10 @@ #ifndef WORKER_TRANSACTION_H #define WORKER_TRANSACTION_H +#include "storage/lockdefs.h" + #include "distributed/connection_management.h" #include "distributed/worker_manager.h" -#include "storage/lockdefs.h" /*