aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/pgstat.c22
-rw-r--r--src/backend/postmaster/postmaster.c5
-rw-r--r--src/backend/utils/misc/guc.c4
3 files changed, 25 insertions, 6 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index e09becdeb80..c822b35d003 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2008, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.179 2008/08/15 08:37:39 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.180 2008/08/25 15:11:00 mha Exp $
* ----------
*/
#include "postgres.h"
@@ -203,6 +203,7 @@ static PgStat_GlobalStats globalStats;
static volatile bool need_exit = false;
static volatile bool need_statwrite = false;
+static volatile bool got_SIGHUP = false;
/*
* Total time charged to functions so far in the current backend.
@@ -224,6 +225,7 @@ NON_EXEC_STATIC void PgstatCollectorMain(int argc, char *argv[]);
static void pgstat_exit(SIGNAL_ARGS);
static void force_statwrite(SIGNAL_ARGS);
static void pgstat_beshutdown_hook(int code, Datum arg);
+static void pgstat_sighup_handler(SIGNAL_ARGS);
static PgStat_StatDBEntry *pgstat_get_db_entry(Oid databaseid, bool create);
static void pgstat_write_statsfile(bool permanent);
@@ -2571,7 +2573,7 @@ PgstatCollectorMain(int argc, char *argv[])
* Ignore all signals usually bound to some action in the postmaster,
* except SIGQUIT and SIGALRM.
*/
- pqsignal(SIGHUP, SIG_IGN);
+ pqsignal(SIGHUP, pgstat_sighup_handler);
pqsignal(SIGINT, SIG_IGN);
pqsignal(SIGTERM, SIG_IGN);
pqsignal(SIGQUIT, pgstat_exit);
@@ -2635,6 +2637,15 @@ PgstatCollectorMain(int argc, char *argv[])
break;
/*
+ * Reload configuration if we got SIGHUP from the postmaster.
+ */
+ if (got_SIGHUP)
+ {
+ ProcessConfigFile(PGC_SIGHUP);
+ got_SIGHUP = false;
+ }
+
+ /*
* If time to write the stats file, do so. Note that the alarm
* interrupt isn't re-enabled immediately, but only after we next
* receive a stats message; so no cycles are wasted when there is
@@ -2834,6 +2845,13 @@ force_statwrite(SIGNAL_ARGS)
need_statwrite = true;
}
+/* SIGHUP handler for collector process */
+static void
+pgstat_sighup_handler(SIGNAL_ARGS)
+{
+ got_SIGHUP = true;
+}
+
/*
* Lookup the hash table entry for the specified database. If no hash
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 6f00e5ad341..8bc95f1f2f7 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.561 2008/06/26 02:47:19 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.562 2008/08/25 15:11:01 mha Exp $
*
* NOTES
*
@@ -1923,7 +1923,8 @@ SIGHUP_handler(SIGNAL_ARGS)
signal_child(PgArchPID, SIGHUP);
if (SysLoggerPID != 0)
signal_child(SysLoggerPID, SIGHUP);
- /* PgStatPID does not currently need SIGHUP */
+ if (PgStatPID != 0)
+ signal_child(PgStatPID, SIGHUP);
/* Reload authentication config files too */
load_hba();
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 2c6e4b61e9d..149817e6c96 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.469 2008/08/22 18:47:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.470 2008/08/25 15:11:00 mha Exp $
*
*--------------------------------------------------------------------
*/
@@ -2470,7 +2470,7 @@ static struct config_string ConfigureNamesString[] =
},
{
- {"stats_temp_directory", PGC_POSTMASTER, STATS_COLLECTOR,
+ {"stats_temp_directory", PGC_SIGHUP, STATS_COLLECTOR,
gettext_noop("Writes temporary statistics files to the specified directory."),
NULL,
GUC_SUPERUSER_ONLY