diff options
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 93e225ab4f1..abc5c5ee995 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.225 2001/06/21 16:43:24 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.226 2001/06/22 19:16:22 wieck Exp $ * * NOTES * @@ -105,6 +105,8 @@ #include "utils/memutils.h" #include "bootstrap/bootstrap.h" +#include "pgstat.h" + #define INVALID_SOCK (-1) #define ARGV_SIZE 64 @@ -573,6 +575,14 @@ PostmasterMain(int argc, char *argv[]) ExitPostmaster(1); } + /* + * Initialize and startup the statistics collector process + */ + if (pgstat_init() < 0) + ExitPostmaster(1); + if (pgstat_start() < 0) + ExitPostmaster(1); + if (DebugLvl > 2) { extern char **environ; @@ -1465,6 +1475,18 @@ reaper(SIGNAL_ARGS) { exitstatus = status.w_status; #endif + /* + * Check if this child was the statistics collector. If + * so, start a new one. + */ + if (pgstat_ispgstat(pid)) + { + fprintf(stderr, "%s: Performance collector exited with status %d\n", + progname, exitstatus); + pgstat_start(); + continue; + } + if (ShutdownPID > 0) { if (pid != ShutdownPID) @@ -1511,6 +1533,7 @@ reaper(SIGNAL_ARGS) errno = save_errno; return; } + CleanupProc(pid, exitstatus); } @@ -1609,6 +1632,8 @@ CleanupProc(int pid, GetRedoRecPtr(); } } + else + pgstat_beterm(pid); return; } @@ -1665,6 +1690,13 @@ CleanupProc(int pid, CheckPointPID = 0; checkpointed = 0; } + else + { + /* + * Tell the collector about backend termination + */ + pgstat_beterm(pid); + } FatalError = true; } |