aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr/proc.c
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2020-03-20 08:20:56 +0530
committerAmit Kapila <akapila@postgresql.org>2020-03-20 08:20:56 +0530
commit85f6b49c2c53fb1e08d918ec9305faac13cf7ad6 (patch)
tree72007fac1932d51757c964c5e064aba9c04c04a4 /src/backend/storage/lmgr/proc.c
parentb27e1b3418b189e1a5aee13cbd09bff94f010a86 (diff)
downloadpostgresql-85f6b49c2c53fb1e08d918ec9305faac13cf7ad6.tar.gz
postgresql-85f6b49c2c53fb1e08d918ec9305faac13cf7ad6.zip
Allow relation extension lock to conflict among parallel group members.
This is required as it is no safer for two related processes to extend the same relation at a time than for unrelated processes to do the same. We don't acquire a heavyweight lock on any other object after relation extension lock which means such a lock can never participate in the deadlock cycle. So, avoid checking wait edges from this lock. This provides an infrastructure to allow parallel operations like insert, copy, etc. which were earlier not possible as parallel group members won't conflict for relation extension lock. Author: Dilip Kumar, Amit Kapila Reviewed-by: Amit Kapila, Kuntal Ghosh and Sawada Masahiko Discussion: https://postgr.es/m/CAD21AoCmT3cFQUN4aVvzy5chw7DuzXrJCbrjTU05B+Ss=Gn1LA@mail.gmail.com
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
-rw-r--r--src/backend/storage/lmgr/proc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index eb321f72ea4..fa07ddf4f75 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -1077,7 +1077,13 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
/*
* If group locking is in use, locks held by members of my locking group
- * need to be included in myHeldLocks.
+ * need to be included in myHeldLocks. This is not required for relation
+ * extension lock which conflict among group members. However, including
+ * them in myHeldLocks will give group members the priority to get those
+ * locks as compared to other backends which are also trying to acquire
+ * those locks. OTOH, we can avoid giving priority to group members for
+ * that kind of locks, but there doesn't appear to be a clear advantage of
+ * the same.
*/
if (leader != NULL)
{