From d60c56335f131dd78acd1c132890be50b92becdb Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Thu, 4 Nov 2021 13:44:24 +0100 Subject: [PATCH] Readability improvement - 4 --- src/backend/distributed/executor/adaptive_executor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index c8385d700..f634f102d 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -1578,11 +1578,11 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution) return; } - bool parallelExecutionNotPossible = - list_length(taskList) == 1 || ShouldRunTasksSequentially(taskList); + bool requiresParallelExecutionLocks = + !(list_length(taskList) == 1 || ShouldRunTasksSequentially(taskList)); bool anyAnchorTableIsReplicated = AnyAnchorTableIsReplicated(taskList); - if (!anyAnchorTableIsReplicated && parallelExecutionNotPossible) + if (!anyAnchorTableIsReplicated && !requiresParallelExecutionLocks) { /* * When a distributed query on tables with replication @@ -1603,7 +1603,7 @@ AcquireExecutorShardLocksForExecution(DistributedExecution *execution) */ int lockMode = ExclusiveLock; - if (!anyAnchorTableIsReplicated && !parallelExecutionNotPossible) + if (!anyAnchorTableIsReplicated && requiresParallelExecutionLocks) { /* * 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, * hence lowering the lock level to RowExclusiveLock. */ - if (parallelExecutionNotPossible && modLevel < ROW_MODIFY_NONCOMMUTATIVE) + if (!requiresParallelExecutionLocks && modLevel < ROW_MODIFY_NONCOMMUTATIVE) { lockMode = RowExclusiveLock; }