Skip to content

Commit 654e8e4

Browse files
committed
Save pg_stat_statements statistics file into $PGDATA/pg_stat directory at shutdown.
187492b 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.
1 parent 55fb759 commit 654e8e4

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
PG_MODULE_MAGIC;
8181

8282
/* Location of permanent stats file (valid when database is shut down) */
83-
#define PGSS_DUMP_FILE "global/pg_stat_statements.stat"
83+
#define PGSS_DUMP_FILE PGSTAT_STAT_PERMANENT_DIRECTORY "/pg_stat_statements.stat"
8484

8585
/*
8686
* Location of external query text file. We don't keep it in the core

src/backend/postmaster/pgstat.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@
6767
#include "utils/tqual.h"
6868

6969

70-
/* ----------
71-
* Paths for the statistics files (relative to installation's $PGDATA).
72-
* ----------
73-
*/
74-
#define PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat"
75-
#define PGSTAT_STAT_PERMANENT_FILENAME "pg_stat/global.stat"
76-
#define PGSTAT_STAT_PERMANENT_TMPFILE "pg_stat/global.tmp"
77-
7870
/* ----------
7971
* Timer definitions.
8072
* ----------

src/include/pgstat.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
#include "utils/relcache.h"
2121

2222

23+
/* ----------
24+
* Paths for the statistics files (relative to installation's $PGDATA).
25+
* ----------
26+
*/
27+
#define PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat"
28+
#define PGSTAT_STAT_PERMANENT_FILENAME "pg_stat/global.stat"
29+
#define PGSTAT_STAT_PERMANENT_TMPFILE "pg_stat/global.tmp"
30+
2331
/* Default directory to store temporary statistics data in */
2432
#define PG_STAT_TMP_DIR "pg_stat_tmp"
2533

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy