From 04fcd73eb61cdfa43fc000f2541ea75ff0054547 Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Wed, 27 Jan 2021 10:19:01 +0100 Subject: [PATCH] When reaches to shared pool size, COPY sets the placement access It looks like we forgot to set the placement accesses, and this could lead to self-deadlocks on complex transaction blocks. --- src/backend/distributed/commands/multi_copy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index 2c5f55152..50ca597e3 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -3649,6 +3649,12 @@ CopyGetPlacementConnection(HTAB *connectionStateHash, ShardPlacement *placement, connection = GetLeastUtilisedCopyConnection(copyConnectionStateList, nodeName, nodePort); + + /* + * Make sure that the connection management remembers that Citus + * accesses this placement over the connection. + */ + AssignPlacementListToConnection(list_make1(placementAccess), connection); } else {