From 60bf5ce127933a343ae228811abb5ce131c05c0f Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Thu, 4 Nov 2021 11:54:36 +0100 Subject: [PATCH] Readability improvement - 3 --- .../distributed/executor/adaptive_executor.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index 05e69ac87..c8385d700 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -1620,6 +1620,16 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution) */ lockMode = EnableDeadlockPrevention ? ShareUpdateExclusiveLock : RowExclusiveLock; + + if (!IsCoordinator()) + { + /* + * We also skip taking a heavy-weight lock when running a multi-shard + * commands from workers, since we currently do not prevent concurrency + * across workers anyway. + */ + lockMode = RowExclusiveLock; + } } else if (anyAnchorTableIsReplicated) { @@ -1648,15 +1658,6 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution) */ lockMode = RowExclusiveLock; } - else if (!IsCoordinator()) - { - /* - * We also skip taking a heavy-weight lock when running a multi-shard - * commands from workers, since we currently do not prevent concurrency - * across workers anyway. - */ - lockMode = RowExclusiveLock; - } /* now, iterate on the tasks and acquire the executor locks on the shards */ Task *task = NULL;