citus/src/include/distributed
Nils Dijk 8bbfff34c6
Fix reference table lock contention (#6173)
DESCRIPTION: Fix reference table lock contention

Dropping and creating reference tables unintentionally blocked on each other due to the use of an ExclusiveLock for both the Drop and conditionally copying existing reference tables to (new) nodes.

The patch does the following:
 - Lower lock lever for dropping (reference) tables to `ShareLock` so they don't self conflict
 - Treat reference tables and distributed tables equally and acquire the colocation lock when dropping any table that is in a colocation group
 - Perform the precondition check for copying reference tables twice, first time with a lower lock that doesn't conflict with anything. Could have been a NoLock, however, in preparation for dropping a colocation group, it is an `AccessShareLock`

During normal operation the first check will always pass and we don't have to escalate that lock. Making it that we won't be blocked on adding and remove reference tables. Only after a node addition the first `create_reference_table` will still need to acquire an `ExclusiveLock` on the colocation group to perform the copy.
2022-08-18 14:58:49 +02:00
..
commands Removes support for old protocols in Copy functions from PG14 2021-09-03 15:27:24 +03:00
metadata Fixes the bug where undistribute can drop Citus extension 2022-06-13 15:17:54 +03:00
adaptive_executor.h Wait until all connections are successfully established 2021-05-19 15:59:13 +02:00
argutils.h Add the necessary changes for rebalance strategies on enterprise (#3325) 2019-12-19 15:23:08 +01:00
backend_data.h Use current user to sync metadata 2021-07-16 13:25:27 +02:00
cancel_utils.h add IsHoldOffCancellationReceived utility function (#3290) 2019-12-12 17:32:59 +03:00
citus_acquire_lock.h remove copyright years (#3286) 2019-12-11 21:14:08 +03:00
citus_clauses.h Rename master evaluation to coordinator evaluation 2020-07-07 10:37:41 +02:00
citus_custom_scan.h Do not execute subplans multiple times with cursors 2020-11-20 10:43:56 +01:00
citus_nodefuncs.h refactor table ddl events scoped for shards (#4342) 2020-11-26 13:31:59 +01:00
citus_nodes.h refactor table ddl events scoped for shards (#4342) 2020-11-26 13:31:59 +01:00
citus_ruleutils.h Fixes bug about int and smallint sequences on MX (#5254) 2021-09-09 23:41:07 +03:00
citus_safe_lib.h Semmle: Ensure stack memory is not leaked through uninitialized… (#3561) 2020-03-11 20:05:36 +01:00
colocation_utils.h Introduce citus_internal_update_relation_colocation 2021-08-03 11:44:58 +02:00
combine_query_planner.h Drop postgres 11 support 2021-03-25 09:20:28 +03:00
commands.h Fixes bug about int and smallint sequences on MX (#5254) 2021-09-09 23:41:07 +03:00
connection_management.h Tell other backends it's safe to ignore the backend that concurrently built the shell table index (#5520) 2022-01-13 14:36:22 +03:00
coordinator_protocol.h Fixes bug about int and smallint sequences on MX (#5254) 2021-09-09 23:41:07 +03:00
cte_inline.h Update regression tests-2 2020-01-16 12:28:15 +01:00
deparse_shard_query.h Fix missing from entry 2021-11-08 12:44:18 +03:00
deparser.h Adds propagation of ALTER SEQUENCE and other improvements (#5061) 2021-06-24 21:23:25 +03:00
directed_acyclic_graph_execution.h Fill in jobIdList field of DistributedExecution 2020-02-05 17:32:22 +00:00
distributed_deadlock_detection.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
distributed_execution_locks.h Remove real time router executors (#3142) 2019-11-05 12:48:10 +01:00
distributed_planner.h Fix FROM ONLY queries on partitioned tables 2021-04-27 16:10:07 +02:00
distribution_column.h Dropped columns do not diverge distribution column for partitioned tables 2021-08-06 13:36:12 +02:00
enterprise.h remove copyright years (#3286) 2019-12-11 21:14:08 +03:00
error_codes.h Issue worker messages with the same log level 2020-04-14 21:08:25 +02:00
errormessage.h Introduce GetDistributeObjectOps to organize dispatch of logic dependent on node/object type 2020-01-09 18:24:29 +00:00
extended_op_node_utils.h Fix some more master->coordinator comments 2020-07-07 10:37:53 +02:00
foreign_key_relationship.h Accept invalidation before fk graph validity check (#5017) 2021-06-02 14:45:35 +03:00
function_call_delegation.h Refactor distributed_planner for better understandability 2020-01-06 14:23:38 +01:00
function_utils.h Semmle: Fix obvious issues (#3502) 2020-02-21 10:16:00 +01:00
hash_helpers.h Drop postgres 11 support 2021-03-25 09:20:28 +03:00
insert_select_executor.h Fix issues with insert..select casts and column ordering 2022-07-28 16:24:17 +02:00
insert_select_planner.h Move more from insert_select_executor to insert_select_planner 2020-06-26 08:08:26 -07:00
intermediate_result_pruning.h Feature: localhost guc (#4836) 2021-05-12 16:59:44 +02:00
intermediate_results.h Fix materialized view intermediate result filename (#5982) 2022-06-14 15:39:52 +03:00
listutils.h Introduce foreach_ptr_modify macro (#4303) 2020-11-09 12:03:59 +03:00
local_distributed_join_planner.h Add more tests 2020-12-15 18:18:36 +03:00
local_executor.h Deparse/parse the local cached queries 2021-06-21 12:24:29 +03:00
local_multi_copy.h Allow local execution for intermediate results in COPY 2021-02-09 15:00:06 +01:00
local_plan_cache.h Deparse/parse the local cached queries 2021-06-21 12:24:29 +03:00
locally_reserved_shared_connections.h COPY uses adaptive connection management on local node 2021-02-04 09:45:07 +01:00
lock_graph.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
log_utils.h Issue worker messages with the same log level 2020-04-14 21:08:25 +02:00
maintenanced.h Reland #4419 2021-01-19 07:48:47 -08:00
memutils.h Implementation for asycn FinishConnectionListEstablishment (#2584) 2019-03-22 17:30:42 +01:00
metadata_cache.h Use current user to sync metadata 2021-07-16 13:25:27 +02:00
metadata_sync.h Synchronize hasmetadata flag on mx workers (#5086) 2021-08-12 14:16:18 +03:00
metadata_utility.h Only change the sequence types if the target column type is a supported sequence type 2022-03-17 00:42:12 +03:00
multi_client_executor.h Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
multi_executor.h Support EXPLAIN EXECUTE ANALYZE. 2020-08-10 13:44:30 -07:00
multi_explain.h Sort explain analyze output by task time 2020-09-24 11:38:40 +03:00
multi_join_order.h Rename ForceXxx functions to to XxxOrError 2020-09-01 11:19:17 +02:00
multi_logical_optimizer.h Fix union pushdown issue (#5079) 2021-07-29 13:52:55 +03:00
multi_logical_planner.h Fix FROM ONLY queries on partitioned tables 2021-04-27 16:10:07 +02:00
multi_partitioning_utils.h Remove length limitations for table renames 2021-02-24 03:35:27 +03:00
multi_physical_planner.h Use current user to sync metadata 2021-07-16 13:25:27 +02:00
multi_progress.h Avoid two race conditions in the rebalance progress monitor (#5050) 2021-06-21 14:03:42 +00:00
multi_router_planner.h Only consider pseudo constants for shortcuts (#4712) 2021-02-15 18:39:37 +03:00
multi_server_executor.h Local execution considers intermediate result size limit 2020-10-15 17:18:55 +02:00
namespace_utils.h Implement PushOverrideEmptySearchPath (#3874) 2020-06-05 19:23:59 +03:00
pg_dist_colocation.h Add distributioncolumncollation to to pg_dist_colocation 2019-12-09 19:51:40 +00:00
pg_dist_local_group.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
pg_dist_node.h Replace master with citus in logs and comments (#5210) 2021-08-26 11:31:17 +03:00
pg_dist_node_metadata.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
pg_dist_partition.h Use current user to sync metadata 2021-07-16 13:25:27 +02:00
pg_dist_placement.h Fix some more master->coordinator comments 2020-07-07 10:37:53 +02:00
pg_dist_rebalance_strategy.h Implement an improvement threshold in the rebalancer (#4927) 2021-05-11 14:24:59 +02:00
pg_dist_shard.h Implement partitioned intermediate results. 2019-12-24 03:53:39 -08:00
pg_dist_transaction.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
pg_version_constants.h Adds copy of ruleutils_13.c as ruleutils_14.c 2021-09-03 15:27:24 +03:00
placement_access.h Remove real time router executors (#3142) 2019-11-05 12:48:10 +01:00
placement_connection.h Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
query_colocation_checker.h Refactor WrapRteRelationIntoSubquery 2020-12-15 18:18:36 +03:00
query_pushdown_planning.h Allow constant VALUES clauses in pushdown queries 2021-04-21 14:28:08 +02:00
query_stats.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
query_utils.h Fix partition column index issue (#4591) 2021-01-29 14:40:40 +03:00
recursive_planning.h Drop postgres 11 support 2021-03-25 09:20:28 +03:00
reference_table_utils.h Fix reference table lock contention (#6173) 2022-08-18 14:58:49 +02:00
relation_access_tracking.h Record non-distributed table accesses in local executor (#4139) 2020-09-07 18:19:08 +03:00
relation_restriction_equivalence.h Fix union pushdown issue (#5079) 2021-07-29 13:52:55 +03:00
relation_utils.h Refactor PreprocessIndexStmt (#4272) 2020-11-25 12:19:37 +03:00
relay_utility.h Rename RelayFileState to ShardState 2020-01-12 05:57:53 +00:00
remote_commands.h Replace MAX_PUT_COPY_DATA_BUFFER_SIZE by citus.remote_copy_flush_threshold GUC 2021-03-16 06:00:38 +01:00
remote_transaction.h Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
repair_shards.h Only allow moves of shards of distributed tables (#5072) 2021-06-23 16:25:46 +02:00
repartition_join_execution.h Add adaptive executor support for repartition joins (#3169) 2019-12-17 19:09:45 +03:00
resource_lock.h Use current user to sync metadata 2021-07-16 13:25:27 +02:00
run_from_same_connection.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
shard_cleaner.h Use "orphaned shards" naming in more places 2021-06-04 11:39:19 +02:00
shard_pruning.h Enable citus-local distributed table joins 2020-12-15 18:17:10 +03:00
shard_rebalancer.h Add ExecuteCriticalCommandInDifferentTransaction function 2021-06-04 11:30:27 +02:00
shard_utils.h Switch to sequential mode on long partition names 2021-04-14 15:27:50 +03:00
shardinterval_utils.h Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
shared_connection_stats.h Local node connection management 2020-12-03 14:16:13 +03:00
shared_library_init.h refactor some of hard coded values in citus gucs (#3137) 2019-10-30 10:35:39 +03:00
statistics_collection.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
string_utils.h Degrade gracefully when no background workers available 2020-10-05 16:55:00 +03:00
subplan_execution.h Locally execute queries that don't need any data access (#3410) 2020-01-23 18:28:34 +01:00
task_execution_utils.h Remove task tracker executor (#3850) 2020-07-18 13:11:36 +03:00
tdigest_extension.h Feature: tdigest aggregate (#3897) 2020-06-12 13:50:28 +02:00
time_constants.h refactor some of hard coded values in citus gucs (#3137) 2019-10-30 10:35:39 +03:00
transaction_identifier.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
transaction_management.h Rename CoordinatedTransactionShouldUse2PC (#4995) 2021-05-21 18:57:42 +03:00
transaction_recovery.h Delete transactions when removing node 2020-12-07 11:35:20 +03:00
transmit.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
tuple_destination.h Local execution considers intermediate result size limit 2020-10-15 17:18:55 +02:00
tuplestore.h Remove copyright years (#2918) 2019-10-15 17:44:30 +03:00
version_compat.h Apply latest version compat without conflicts 2021-09-03 16:09:59 +03:00
worker_create_or_replace.h create_distributed_function: accept aggregates 2019-11-06 18:23:37 +00:00
worker_log_messages.h Issue worker messages with the same log level 2020-04-14 21:08:25 +02:00
worker_manager.h Synchronize hasmetadata flag on mx workers (#5086) 2021-08-12 14:16:18 +03:00
worker_protocol.h Fixes bug about int and smallint sequences on MX (#5254) 2021-09-09 23:41:07 +03:00
worker_shard_visibility.h Refactor RelationIsAKnownShard to remove onlySearchPath argument 2021-06-02 14:30:27 +02:00
worker_transaction.h transactional metadata sync for maintanince daemon 2021-08-09 10:34:55 +02:00