https://github.com/postgres/postgres
Revision 712ba6b8b73870fa9e3336df8d88f4bc5f824112 authored by Tom Lane on 24 July 2021, 22:35:52 UTC, committed by Tom Lane on 24 July 2021, 22:35:52 UTC
We have an implementation restriction that PREPARE TRANSACTION can't
handle cases where both session-lifespan and transaction-lifespan locks
are held on the same lockable object.  (That's because we'd otherwise
need to acquire a new PROCLOCK entry during post-prepare cleanup, which
is an operation that might fail.  The situation can only arise with odd
usages of advisory locks, so removing the restriction is probably not
worth the amount of effort it would take.)  AtPrepare_Locks attempted
to enforce this, but its logic was many bricks shy of a load, because
it only detected cases where the session and transaction locks had the
same lockmode.  Locks of different modes on the same object would lead
to the rather unhelpful message "PANIC: we seem to have dropped a bit
somewhere".

To fix, build a transient hashtable with one entry per locktag,
not one per locktag + mode, and use that to detect conflicts.

Per bug #17122 from Alexander Pyhalov.  This bug is ancient,
so back-patch to all supported branches.

Discussion: https://postgr.es/m/17122-04f3c32098a62233@postgresql.org
1 parent 89ad14c
History
Tip revision: 712ba6b8b73870fa9e3336df8d88f4bc5f824112 authored by Tom Lane on 24 July 2021, 22:35:52 UTC
Fix check for conflicting session- vs transaction-level locks.
Tip revision: 712ba6b
File Mode Size
config
contrib
doc
src
.dir-locals.el -rw-r--r-- 730 bytes
.editorconfig -rw-r--r-- 183 bytes
.git-blame-ignore-revs -rw-r--r-- 8.6 KB
.gitattributes -rw-r--r-- 1.5 KB
.gitignore -rw-r--r-- 504 bytes
COPYRIGHT -rw-r--r-- 1.2 KB
GNUmakefile.in -rw-r--r-- 4.2 KB
HISTORY -rw-r--r-- 277 bytes
Makefile -rw-r--r-- 1.6 KB
README -rw-r--r-- 1.2 KB
README.git -rw-r--r-- 721 bytes
aclocal.m4 -rw-r--r-- 490 bytes
configure -rwxr-xr-x 567.2 KB
configure.ac -rw-r--r-- 81.3 KB

README

back to top