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;