aboutsummaryrefslogtreecommitdiff
path: root/src/backend/postmaster/postmaster.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-08-05 02:06:50 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-08-05 02:06:50 +0000
commite8f1097361d9d2012c751d7e66cd4dd1b6d26ac6 (patch)
treee507c9ebaf5da19a1234c0927485fb49c6c83c78 /src/backend/postmaster/postmaster.c
parent5181d37e4c88c2b622fe54feb74845320e36c71e (diff)
downloadpostgresql-e8f1097361d9d2012c751d7e66cd4dd1b6d26ac6.tar.gz
postgresql-e8f1097361d9d2012c751d7e66cd4dd1b6d26ac6.zip
Endeavor to make pgstats buffer process (a) safe and (b) useful.
Make sure it exits immediately when collector process dies --- in old code, buffer process would hang around and compete with the new buffer process for packets. Make sure it doesn't block on writing the pipe when the collector falls more than a pipeload behind. Avoid leaking pgstats FDs into every backend.
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r--src/backend/postmaster/postmaster.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 511f9bc0ee6..c3036630bc5 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.234 2001/08/04 00:14:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.235 2001/08/05 02:06:50 tgl Exp $
*
* NOTES
*
@@ -227,7 +227,6 @@ extern int optreset;
static void pmdaemonize(int argc, char *argv[]);
static Port *ConnCreate(int serverFd);
static void ConnFree(Port *port);
-static void ClosePostmasterPorts(void);
static void reset_shared(unsigned short port);
static void SIGHUP_handler(SIGNAL_ARGS);
static void pmdie(SIGNAL_ARGS);
@@ -1241,8 +1240,8 @@ ConnFree(Port *conn)
* that are not needed by that child process. The postmaster still has
* them open, of course.
*/
-static void
-ClosePostmasterPorts(void)
+void
+ClosePostmasterPorts(bool pgstat_too)
{
/* Close the listen sockets */
if (NetServer)
@@ -1252,6 +1251,9 @@ ClosePostmasterPorts(void)
StreamClose(ServerSock_UNIX);
ServerSock_UNIX = INVALID_SOCK;
#endif
+ /* Close pgstat control sockets, unless we're starting pgstat itself */
+ if (pgstat_too)
+ pgstat_close_sockets();
}
@@ -1900,7 +1902,7 @@ DoBackend(Port *port)
*/
/* Close the postmaster's other sockets */
- ClosePostmasterPorts();
+ ClosePostmasterPorts(true);
/* Save port etc. for ps status */
MyProcPort = port;
@@ -2224,7 +2226,7 @@ SSDataBase(int xlop)
on_exit_reset();
/* Close the postmaster's sockets */
- ClosePostmasterPorts();
+ ClosePostmasterPorts(true);
/* Set up command-line arguments for subprocess */
av[ac++] = "postgres";