postgresql/src/backend/utils
Tom Lane 2065dd2834 Prevent very-low-probability PANIC during PREPARE TRANSACTION.
The code in PostPrepare_Locks supposed that it could reassign locks to
the prepared transaction's dummy PGPROC by deleting the PROCLOCK table
entries and immediately creating new ones.  This was safe when that code
was written, but since we invented partitioning of the shared lock table,
it's not safe --- another process could steal away the PROCLOCK entry in
the short interval when it's on the freelist.  Then, if we were otherwise
out of shared memory, PostPrepare_Locks would have to PANIC, since it's
too late to back out of the PREPARE at that point.

Fix by inventing a dynahash.c function to atomically update a hashtable
entry's key.  (This might possibly have other uses in future.)

This is an ancient bug that in principle we ought to back-patch, but the
odds of someone hitting it in the field seem really tiny, because (a) the
risk window is small, and (b) nobody runs servers with maxed-out lock
tables for long, because they'll be getting non-PANIC out-of-memory errors
anyway.  So fixing it in HEAD seems sufficient, at least until the new
code has gotten some testing.
2013-01-13 22:20:22 -05:00
..
adt Make spelling more uniform 2013-01-13 21:42:03 -05:00
cache Invent a "one-shot" variant of CachedPlans for better performance. 2013-01-04 17:42:19 -05:00
error Update comments for elog_start(). 2013-01-13 18:50:48 -05:00
fmgr Update copyrights for 2013 2013-01-01 17:15:01 -05:00
hash Prevent very-low-probability PANIC during PREPARE TRANSACTION. 2013-01-13 22:20:22 -05:00
init Fix IsUnderPostmaster/EXEC_BACKEND confusion 2013-01-02 18:39:20 -03:00
mb Update copyrights for 2013 2013-01-01 17:15:01 -05:00
misc Fix background workers for EXEC_BACKEND 2013-01-02 12:01:14 -03:00
mmgr Update copyrights for 2013 2013-01-01 17:15:01 -05:00
resowner Update copyrights for 2013 2013-01-01 17:15:01 -05:00
sort Update copyrights for 2013 2013-01-01 17:15:01 -05:00
time Update copyrights for 2013 2013-01-01 17:15:01 -05:00
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
errcodes.txt Update copyrights for 2013 2013-01-01 17:15:01 -05:00
Gen_dummy_probes.sed Update copyrights for 2013 2013-01-01 17:15:01 -05:00
Gen_fmgrtab.pl Update copyrights for 2013 2013-01-01 17:15:01 -05:00
generate-errcodes.pl Update copyrights for 2013 2013-01-01 17:15:01 -05:00
Makefile Make handling of errcodes.h more consistent with other generated headers. 2011-02-04 09:29:10 -05:00
probes.d Update copyrights for 2013 2013-01-01 17:15:01 -05:00