Readability improvement - 4

simplify_executor_locks_4
Onder Kalaci 2021-11-04 13:44:24 +01:00
parent 60bf5ce127
commit d60c56335f
1 changed files with 5 additions and 5 deletions

View File

@ -1578,11 +1578,11 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution)
return; return;
} }
bool parallelExecutionNotPossible = bool requiresParallelExecutionLocks =
list_length(taskList) == 1 || ShouldRunTasksSequentially(taskList); !(list_length(taskList) == 1 || ShouldRunTasksSequentially(taskList));
bool anyAnchorTableIsReplicated = AnyAnchorTableIsReplicated(taskList); bool anyAnchorTableIsReplicated = AnyAnchorTableIsReplicated(taskList);
if (!anyAnchorTableIsReplicated && parallelExecutionNotPossible) if (!anyAnchorTableIsReplicated && !requiresParallelExecutionLocks)
{ {
/* /*
* When a distributed query on tables with replication * When a distributed query on tables with replication
@ -1603,7 +1603,7 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution)
*/ */
int lockMode = ExclusiveLock; int lockMode = ExclusiveLock;
if (!anyAnchorTableIsReplicated && !parallelExecutionNotPossible) if (!anyAnchorTableIsReplicated && requiresParallelExecutionLocks)
{ {
/* /*
* When there is no replication then we only need to prevent * When there is no replication then we only need to prevent
@ -1642,7 +1642,7 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution)
* INSERTs. In that case, we should allow concurrency among such backends, * INSERTs. In that case, we should allow concurrency among such backends,
* hence lowering the lock level to RowExclusiveLock. * hence lowering the lock level to RowExclusiveLock.
*/ */
if (parallelExecutionNotPossible && modLevel < ROW_MODIFY_NONCOMMUTATIVE) if (!requiresParallelExecutionLocks && modLevel < ROW_MODIFY_NONCOMMUTATIVE)
{ {
lockMode = RowExclusiveLock; lockMode = RowExclusiveLock;
} }