Save pg_stat_statements statistics file into $PGDATA/pg_stat directory at shutdown.
authorFujii Masao <fujii@postgresql.org>
Wed, 4 Jun 2014 03:09:45 +0000 (12:09 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 4 Jun 2014 03:09:45 +0000 (12:09 +0900)
187492b6c2e8cafc5b39063ca3b67846e8155d24 changed pgstat.c so that
the stats files were saved into $PGDATA/pg_stat directory when the server
was shutdowned. But it accidentally forgot to change the location of
pg_stat_statements permanent stats file. This commit fixes pg_stat_statements
so that its stats file is also saved into $PGDATA/pg_stat at shutdown.

Since this fix changes the file layout, we don't back-patch it to 9.3
where this oversight was introduced.

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

index 32d16cc5f3e03408ccd576a2620fb92fb34990c7..a3e8c595b812969696a787c8a0653dd46afae6e2 100644 (file)
@@ -80,7 +80,7 @@
 PG_MODULE_MAGIC;
 
 /* Location of permanent stats file (valid when database is shut down) */
-#define PGSS_DUMP_FILE "global/pg_stat_statements.stat"
+#define PGSS_DUMP_FILE PGSTAT_STAT_PERMANENT_DIRECTORY "/pg_stat_statements.stat"
 
 /*
  * Location of external query text file.  We don't keep it in the core
index f86481665f3a58190cf38153f1815eed14d34736..3ab1428f7c72cb3dc4a66c83c7ae97f8981f7498 100644 (file)
 #include "utils/tqual.h"
 
 
-/* ----------
- * Paths for the statistics files (relative to installation's $PGDATA).
- * ----------
- */
-#define PGSTAT_STAT_PERMANENT_DIRECTORY                "pg_stat"
-#define PGSTAT_STAT_PERMANENT_FILENAME         "pg_stat/global.stat"
-#define PGSTAT_STAT_PERMANENT_TMPFILE          "pg_stat/global.tmp"
-
 /* ----------
  * Timer definitions.
  * ----------
index d9de09fea0af8d67185ff5ac927940e5e96f0afd..08925336d181c16759fedd4af939564c9d109155 100644 (file)
 #include "utils/relcache.h"
 
 
+/* ----------
+ * Paths for the statistics files (relative to installation's $PGDATA).
+ * ----------
+ */
+#define PGSTAT_STAT_PERMANENT_DIRECTORY                "pg_stat"
+#define PGSTAT_STAT_PERMANENT_FILENAME         "pg_stat/global.stat"
+#define PGSTAT_STAT_PERMANENT_TMPFILE          "pg_stat/global.tmp"
+
 /* Default directory to store temporary statistics data in */
 #define PG_STAT_TMP_DIR                "pg_stat_tmp"