path relative to the data directory or an absolute path. The default is
<filename>pg_stat_tmp</filename>. Pointing this at a RAM based filesystem
will decrease physical I/O requirements and can lead to increased
- performance. This parameter can only be set at server start.
+ performance. If this parameter is changed when the system is running,
+ the statistics functions might return no information until a new
+ file has been written, which typically happens twice per second.
</para>
</listitem>
</varlistentry>
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.
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);
* 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);
if (need_exit)
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
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
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();
},
{
- {"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