From 24ba897b17272f86b12598b5c186008edc5a5b6d Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Wed, 8 Apr 2020 12:57:35 +0200 Subject: [PATCH] Allow COPY always continue --- src/backend/distributed/commands/multi_copy.c | 9 +++++++++ src/backend/distributed/executor/adaptive_executor.c | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index 7724d2018..926528688 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -3425,6 +3425,15 @@ CopyGetPlacementConnection(ShardPlacement *placement, bool stopOnFailure) MultiShardConnectionType != SEQUENTIAL_CONNECTION) { connectionFlags |= CONNECTION_PER_PLACEMENT; + + /* + * Via connection throttling, the connection establishments may be suspended + * until a connection slot is empty to the remote host. When forced to use + * one connection per placement, do not enforce this restriction as it could + * deadlock against concurrent operation where each operation is blocked on + * waiting for others. + */ + connectionFlags |= NEVER_WAIT_FOR_CONNECTION; } connection = GetPlacementConnection(connectionFlags, placement, nodeUser); diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index 8a832cfa1..d48a5b8c9 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -2400,7 +2400,9 @@ ManageWorkerPool(WorkerPool *workerPool) /* * Via connection throttling, the connection establishments may be suspended * until a connection slot is empty to the remote host. When forced to use - * one connection per placement, do not enforce this restriction. + * one connection per placement, do not enforce this restriction as it could + * deadlock against concurrent operation where each operation is blocked on + * waiting for others. */ connectionFlags |= NEVER_WAIT_FOR_CONNECTION; }