postgresql/src/backend/storage/ipc
Tom Lane 969d7cd431 Install a "dead man switch" to allow the postmaster to detect cases where
a backend has done exit(0) or exit(1) without having disengaged itself
from shared memory.  We are at risk for this whenever third-party code is
loaded into a backend, since such code might not know it's supposed to go
through proc_exit() instead.  Also, it is reported that under Windows
there are ways to externally kill a process that cause the status code
returned to the postmaster to be indistinguishable from a voluntary exit
(thank you, Microsoft).  If this does happen then the system is probably
hosed --- for instance, the dead session might still be holding locks.
So the best recovery method is to treat this like a backend crash.

The dead man switch is armed for a particular child process when it
acquires a regular PGPROC, and disarmed when the PGPROC is released;
these should be the first and last touches of shared memory resources
in a backend, or close enough anyway.  This choice means there is no
coverage for auxiliary processes, but I doubt we need that, since they
shouldn't be executing any user-provided code anyway.

This patch also improves the management of the EXEC_BACKEND
ShmemBackendArray array a bit, by reducing search costs.

Although this problem is of long standing, the lack of field complaints
seems to mean it's not critical enough to risk back-patching; at least
not till we get some more testing of this mechanism.
2009-05-05 19:59:00 +00:00
..
ipc.c Update copyright for 2009. 2009-01-01 17:24:05 +00:00
ipci.c Install a "dead man switch" to allow the postmaster to detect cases where 2009-05-05 19:59:00 +00:00
Makefile Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
pmsignal.c Install a "dead man switch" to allow the postmaster to detect cases where 2009-05-05 19:59:00 +00:00
procarray.c A session that does not have any live snapshots does not have to be waited for 2009-04-04 17:40:36 +00:00
README Make source code READMEs more consistent. Add CVS tags to all README files. 2008-03-20 17:55:15 +00:00
shmem.c Update copyright for 2009. 2009-01-01 17:24:05 +00:00
shmqueue.c Update copyright for 2009. 2009-01-01 17:24:05 +00:00
sinval.c Update copyright for 2009. 2009-01-01 17:24:05 +00:00
sinvaladt.c Update copyright for 2009. 2009-01-01 17:24:05 +00:00

$PostgreSQL: pgsql/src/backend/storage/ipc/README,v 1.5 2008/03/20 17:55:15 momjian Exp $

Cache Invalidation Synchronization Routines
===========================================

Mon Jul 18 11:09:22 PDT 1988  W.KLAS

The cache synchronization is done using a message queue. Every
backend can register a message which then has to be read by
all backends. A message read by all backends is removed from the 
queue automatically. If a message has been lost because the buffer
was full, all backends that haven't read this message will be
told that they have to reset their cache state. This is done
at the time when they try to read the message queue.

The message queue is implemented as a shared buffer segment. Actually,
the queue is a circle to allow fast inserting, reading (invalidate data) and
maintaining the buffer.