aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2008-08-15 08:37:41 +0000
committerMagnus Hagander <magnus@hagander.net>2008-08-15 08:37:41 +0000
commit5b8eb2b4b95ac4b016368ce6ca2c3477387e7fc7 (patch)
tree7a20e4b0469da0d12e999819eb218dc7621918eb /src/backend/utils
parentf24f233f6a9fb3af211c2fc658c5068e63593a8c (diff)
downloadpostgresql-5b8eb2b4b95ac4b016368ce6ca2c3477387e7fc7.tar.gz
postgresql-5b8eb2b4b95ac4b016368ce6ca2c3477387e7fc7.zip
Make the temporary directory for pgstat files configurable by the GUC
variable stats_temp_directory, instead of requiring the admin to mount/symlink the pg_stat_tmp directory manually. For now the config variable is PGC_POSTMASTER. Room for further improvment that would allow it to be changed on-the-fly.
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/misc/guc.c35
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample1
2 files changed, 35 insertions, 1 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 874d20c15f1..6cc6dcb7e03 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.465 2008/07/23 17:29:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.466 2008/08/15 08:37:40 mha Exp $
*
*--------------------------------------------------------------------
*/
@@ -164,6 +164,7 @@ static const char *show_tcp_keepalives_interval(void);
static const char *show_tcp_keepalives_count(void);
static bool assign_autovacuum_max_workers(int newval, bool doit, GucSource source);
static bool assign_maxconnections(int newval, bool doit, GucSource source);
+static const char *assign_pgstat_temp_directory(const char *newval, bool doit, GucSource source);
static char *config_enum_get_options(struct config_enum *record,
const char *prefix, const char *suffix);
@@ -343,6 +344,8 @@ char *HbaFileName;
char *IdentFileName;
char *external_pid_file;
+char *pgstat_temp_directory;
+
int tcp_keepalives_idle;
int tcp_keepalives_interval;
int tcp_keepalives_count;
@@ -2467,6 +2470,16 @@ static struct config_string ConfigureNamesString[] =
},
{
+ {"stats_temp_directory", PGC_POSTMASTER, STATS_COLLECTOR,
+ gettext_noop("Writes temporary statistics files to the specified directory."),
+ NULL,
+ GUC_SUPERUSER_ONLY
+ },
+ &pgstat_temp_directory,
+ "pg_stat_tmp", assign_pgstat_temp_directory, NULL
+ },
+
+ {
{"default_text_search_config", PGC_USERSET, CLIENT_CONN_LOCALE,
gettext_noop("Sets default text search configuration."),
NULL
@@ -7370,4 +7383,24 @@ assign_autovacuum_max_workers(int newval, bool doit, GucSource source)
return true;
}
+static const char *
+assign_pgstat_temp_directory(const char *newval, bool doit, GucSource source)
+{
+ if (doit)
+ {
+ if (pgstat_stat_tmpname)
+ free(pgstat_stat_tmpname);
+ if (pgstat_stat_filename)
+ free(pgstat_stat_filename);
+
+ pgstat_stat_tmpname = guc_malloc(FATAL, strlen(newval) + 12); /* /pgstat.tmp */
+ pgstat_stat_filename = guc_malloc(FATAL, strlen(newval) + 13); /* /pgstat.stat */
+
+ sprintf(pgstat_stat_tmpname, "%s/pgstat.tmp", newval);
+ sprintf(pgstat_stat_filename, "%s/pgstat.stat", newval);
+ }
+
+ return newval;
+}
+
#include "guc-file.c"
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 552d856ae29..063d3ec1c4a 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -366,6 +366,7 @@
#track_functions = none # none, pl, all
#track_activity_query_size = 1024
#update_process_title = on
+#stats_temp_directory = 'pg_stat_tmp'
# - Statistics Monitoring -