postgresql/src
Tom Lane e81e8f9342 Split up process latch initialization for more-fail-soft behavior.
In the previous coding, new backend processes would attempt to create their
self-pipe during the OwnLatch call in InitProcess.  However, pipe creation
could fail if the kernel is short of resources; and the system does not
recover gracefully from a FATAL error right there, since we have armed the
dead-man switch for this process and not yet set up the on_shmem_exit
callback that would disarm it.  The postmaster then forces an unnecessary
database-wide crash and restart, as reported by Sean Chittenden.

There are various ways we could rearrange the code to fix this, but the
simplest and sanest seems to be to split out creation of the self-pipe into
a new function InitializeLatchSupport, which must be called from a place
where failure is allowed.  For most processes that gets called in
InitProcess or InitAuxiliaryProcess, but processes that don't call either
but still use latches need their own calls.

Back-patch to 9.1, which has only a part of the latch logic that 9.2 and
HEAD have, but nonetheless includes this bug.
2012-10-14 22:59:56 -04:00
..
backend Split up process latch initialization for more-fail-soft behavior. 2012-10-14 22:59:56 -04:00
bin In our source code, make a copy of getopt's 'optarg' string arguments, 2012-10-12 13:35:43 -04:00
include Split up process latch initialization for more-fail-soft behavior. 2012-10-14 22:59:56 -04:00
interfaces In our source code, make a copy of getopt's 'optarg' string arguments, 2012-10-12 13:35:43 -04:00
makefiles Fix PGXS support for building loadable modules on AIX. 2012-10-09 21:04:06 -04:00
pl Refactor flex and bison make rules 2012-10-11 06:57:04 -04:00
port Remove redundant code for getnameinfo() replacement 2012-10-04 21:45:14 -04:00
template Remove _FORTIFY_SOURCE 2012-10-10 21:42:38 -04:00
test Fix oversight in new code for printing rangetable aliases. 2012-10-12 16:14:43 -04:00
timezone In our source code, make a copy of getopt's 'optarg' string arguments, 2012-10-12 13:35:43 -04:00
tools Unbreak MSVC builds after recent Makefile refactoring. 2012-10-11 12:36:42 -04:00
tutorial Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Refactor flex and bison make rules 2012-10-11 06:57:04 -04:00
Makefile.shlib Remove configure flag --disable-shared, as it is no longer used by any 2012-08-30 16:26:53 -04:00
nls-global.mk Lots of doc corrections. 2012-04-23 22:43:09 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00