From 32b7e152a3518e199d965a2744cc7cd787bb3a3e Mon Sep 17 00:00:00 2001 From: metdos Date: Thu, 21 Dec 2017 12:53:48 +0200 Subject: [PATCH] Get shard resource locks for only DMLs --- .../distributed/executor/multi_router_executor.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/executor/multi_router_executor.c b/src/backend/distributed/executor/multi_router_executor.c index 6ac238d88..04b4beb15 100644 --- a/src/backend/distributed/executor/multi_router_executor.c +++ b/src/backend/distributed/executor/multi_router_executor.c @@ -1063,8 +1063,15 @@ ExecuteModifyTasks(List *taskList, bool expectResults, ParamListInfo paramListIn LockPartitionRelations(firstShardInterval->relationId, RowExclusiveLock); } - /* ensure that there are no concurrent modifications on the same shards */ - AcquireExecutorMultiShardLocks(taskList); + /* + * Ensure that there are no concurrent modifications on the same + * shards. For DDL commands, we already obtained the appropriate + * locks in ProcessUtility. + */ + if (firstTask->taskType == MODIFY_TASK) + { + AcquireExecutorMultiShardLocks(taskList); + } BeginOrContinueCoordinatedTransaction();