diff options
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
-rw-r--r-- | src/backend/storage/lmgr/proc.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index e108179e0ba..8f5b4e33047 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.205 2009/01/01 17:23:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.206 2009/05/05 19:59:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -41,6 +41,7 @@ #include "postmaster/autovacuum.h" #include "storage/ipc.h" #include "storage/lmgr.h" +#include "storage/pmsignal.h" #include "storage/proc.h" #include "storage/procarray.h" #include "storage/spin.h" @@ -275,6 +276,14 @@ InitProcess(void) } /* + * Now that we have a PGPROC, mark ourselves as an active postmaster + * child; this is so that the postmaster can detect it if we exit + * without cleaning up. + */ + if (IsUnderPostmaster) + MarkPostmasterChildActive(); + + /* * Initialize all fields of MyProc, except for the semaphore which was * prepared for us by InitProcGlobal. */ @@ -614,6 +623,13 @@ ProcKill(int code, Datum arg) SpinLockRelease(ProcStructLock); + /* + * This process is no longer present in shared memory in any meaningful + * way, so tell the postmaster we've cleaned up acceptably well. + */ + if (IsUnderPostmaster) + MarkPostmasterChildInactive(); + /* wake autovac launcher if needed -- see comments in FreeWorkerInfo */ if (AutovacuumLauncherPid != 0) kill(AutovacuumLauncherPid, SIGUSR1); |