]> granicus.if.org Git - postgresql/commitdiff
Allow the pgstat process to restart immediately after a receiving
authorBruce Momjian <bruce@momjian.us>
Thu, 22 Mar 2007 19:53:31 +0000 (19:53 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 22 Mar 2007 19:53:31 +0000 (19:53 +0000)
SIGQUIT signal, rather than waiting for PGSTAT_RESTART_INTERVAL.

src/backend/postmaster/pgstat.c
src/backend/postmaster/postmaster.c
src/include/pgstat.h

index 378e165707f04033e81681f2fa1f3d6548f67cc1..26e6ff4ca08a62215447a30b6404e37a8aacfc2e 100644 (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
index 261b957043d2b2eb31bcb3b7c8802eb6a7a2ab1d..385185eddb45b0da8f111e7d2d802342462ba97c 100644 (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 */
index ce0333a787187066602cf49b55cd1375ec3e26b2..8e08db4c172b15ff524694eac33c1793c188f8f4 100644 (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