From e3e3507be3d50b6c4ec522b80c7e816701b17320 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 25 Aug 2008 18:55:43 +0000 Subject: [PATCH] Unconditionally write the statsfile when SIGHUP is received, to minimize the window during which backends have no statistics file to read. --- doc/src/sgml/config.sgml | 4 ++-- src/backend/postmaster/pgstat.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index ed5e112d1d..73821a5428 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -3419,8 +3419,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; pg_stat_tmp. Pointing this at a RAM based filesystem will decrease physical I/O requirements and can lead to increased 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. + there is a small window of time until the new file has been written + during which the statistics functions might return no information. diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 0f19aee795..524e6eb1eb 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -2638,11 +2638,14 @@ PgstatCollectorMain(int argc, char *argv[]) /* * Reload configuration if we got SIGHUP from the postmaster. + * Also, signal a new write of the file, so we drop a new file as + * soon as possible of the directory for it changes. */ if (got_SIGHUP) { ProcessConfigFile(PGC_SIGHUP); got_SIGHUP = false; + need_statwrite = true; } /* -- 2.39.5