Introduce group locking to prevent parallel processes from deadlocking.
For locking purposes, we now regard heavyweight locks as mutually
non-conflicting between cooperating parallel processes. There are some
possible pitfalls to this approach that are not to be taken lightly,
but it works OK for now and can be changed later if we find a better
approach. Without this, it's very easy for parallel queries to
silently self-deadlock if the user backend holds strong relation locks.
Robert Haas, with help from Amit Kapila. Thanks to Noah Misch and
Andres Freund for extensive discussion of possible issues with this
approach.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/a1c1af2a1f6099c039f145c1edb52257f315be51
Modified Files
--------------
src/backend/access/transam/parallel.c | 16 ++
src/backend/storage/lmgr/README | 63 ++++++++
src/backend/storage/lmgr/deadlock.c | 279 +++++++++++++++++++++++++++-------
src/backend/storage/lmgr/lock.c | 122 ++++++++++++---
src/backend/storage/lmgr/proc.c | 158 ++++++++++++++++++-
src/include/storage/lock.h | 13 +-
src/include/storage/proc.h | 12 ++
7 files changed, 587 insertions(+), 76 deletions(-)