Unconditionally write the statsfile when SIGHUP is received, to minimize
authorMagnus Hagander <magnus@hagander.net>
Mon, 25 Aug 2008 18:55:43 +0000 (18:55 +0000)
committerMagnus Hagander <magnus@hagander.net>
Mon, 25 Aug 2008 18:55:43 +0000 (18:55 +0000)
the window during which backends have no statistics file to read.

doc/src/sgml/config.sgml
src/backend/postmaster/pgstat.c

index ed5e112d1d20b5d6b62cccc43785297e1e73f75b..73821a5428a58d45204aba8a036665ace7b2e1fc 100644 (file)
@@ -3419,8 +3419,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
         <filename>pg_stat_tmp</filename>. 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.
        </para>
       </listitem>
      </varlistentry>
index 0f19aee795bf99ac80a511634af08426942094dd..524e6eb1ebe16ae802e50a7cbd6f659fb30e1d97 100644 (file)
@@ -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;
                }
 
                /*