Readability improvement - 3

simplify_executor_locks_4
Onder Kalaci 2021-11-04 11:54:36 +01:00
parent fb4c760ce0
commit 60bf5ce127
1 changed files with 10 additions and 9 deletions

View File

@ -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;