Allow the pgstat process to restart immediately after a receiving

SIGQUIT signal, rather than waiting for PGSTAT_RESTART_INTERVAL.
This commit is contained in:
Bruce Momjian 2007-03-22 19:53:31 +00:00
parent a4127b713d
commit 686956375a
3 changed files with 21 additions and 4 deletions

View File

@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.149 2007/03/16 17:57:36 mha Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.150 2007/03/22 19:53:30 momjian Exp $
* ----------
*/
#include "postgres.h"
@ -572,6 +572,10 @@ pgstat_start(void)
return 0;
}
void allow_immediate_pgstat_restart(void)
{
last_pgstat_start_time = 0;
}
/* ------------------------------------------------------------
* Public functions used by backends follow

View File

@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.526 2007/03/07 13:35:02 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.527 2007/03/22 19:53:30 momjian Exp $
*
* NOTES
*
@ -1896,7 +1896,10 @@ pmdie(SIGNAL_ARGS)
signal_child(PgArchPID, SIGQUIT);
/* Tell pgstat to shut down too; nothing left for it to do */
if (PgStatPID != 0)
{
signal_child(PgStatPID, SIGQUIT);
allow_immediate_pgstat_restart();
}
/* Tell autovac launcher to shut down too */
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGTERM);
@ -1952,7 +1955,10 @@ pmdie(SIGNAL_ARGS)
signal_child(PgArchPID, SIGQUIT);
/* Tell pgstat to shut down too; nothing left for it to do */
if (PgStatPID != 0)
{
signal_child(PgStatPID, SIGQUIT);
allow_immediate_pgstat_restart();
}
/* Tell autovac launcher to shut down too */
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGTERM);
@ -1977,7 +1983,10 @@ pmdie(SIGNAL_ARGS)
if (PgArchPID != 0)
signal_child(PgArchPID, SIGQUIT);
if (PgStatPID != 0)
{
signal_child(PgStatPID, SIGQUIT);
allow_immediate_pgstat_restart();
}
if (DLGetHead(BackendList))
SignalChildren(SIGQUIT);
ExitPostmaster(0);
@ -2241,7 +2250,10 @@ reaper(SIGNAL_ARGS)
signal_child(PgArchPID, SIGQUIT);
/* Tell pgstat to shut down too; nothing left for it to do */
if (PgStatPID != 0)
{
signal_child(PgStatPID, SIGQUIT);
allow_immediate_pgstat_restart();
}
/* Tell autovac launcher to shut down too */
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGTERM);
@ -2404,6 +2416,7 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
"SIGQUIT",
(int) PgStatPID)));
signal_child(PgStatPID, SIGQUIT);
allow_immediate_pgstat_restart();
}
/* We do NOT restart the syslogger */

View File

@ -5,7 +5,7 @@
*
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.55 2007/03/16 17:57:36 mha Exp $
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.56 2007/03/22 19:53:31 momjian Exp $
* ----------
*/
#ifndef PGSTAT_H
@ -369,7 +369,7 @@ extern void CreateSharedBackendStatus(void);
extern void pgstat_init(void);
extern int pgstat_start(void);
extern void pgstat_reset_all(void);
extern void allow_immediate_pgstat_restart(void);
#ifdef EXEC_BACKEND
extern void PgstatCollectorMain(int argc, char *argv[]);
#endif