Readability improvement

simplify_executor_locks_2
Onder Kalaci 2021-11-04 11:18:02 +01:00
parent 7cdee3347d
commit 23f800ca3a
1 changed files with 6 additions and 3 deletions

View File

@ -1603,7 +1603,7 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution)
*/ */
int lockMode = ExclusiveLock; int lockMode = ExclusiveLock;
if (!anyAnchorTableIsReplicated && IsCoordinator()) if (!anyAnchorTableIsReplicated && !parallelExecutionNotPossible && IsCoordinator())
{ {
/* /*
* When all writes are commutative then we only need to prevent multi-shard * When all writes are commutative then we only need to prevent multi-shard
@ -1628,8 +1628,7 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution)
EnableDeadlockPrevention ? ShareUpdateExclusiveLock : RowExclusiveLock; EnableDeadlockPrevention ? ShareUpdateExclusiveLock : RowExclusiveLock;
} }
if (AllModificationsCommutative || if (AllModificationsCommutative)
(parallelExecutionNotPossible && modLevel < ROW_MODIFY_NONCOMMUTATIVE))
{ {
/* /*
* If either the user allows via a GUC or the commands are * If either the user allows via a GUC or the commands are
@ -1639,6 +1638,10 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution)
*/ */
lockMode = RowExclusiveLock; lockMode = RowExclusiveLock;
} }
else if (parallelExecutionNotPossible && modLevel < ROW_MODIFY_NONCOMMUTATIVE)
{
lockMode = RowExclusiveLock;
}
/* now, iterate on the tasks and acquire the executor locks on the shards */ /* now, iterate on the tasks and acquire the executor locks on the shards */
Task *task = NULL; Task *task = NULL;