From e97d163c85c6df7e30ecc346eec007da2cd7e688 Mon Sep 17 00:00:00 2001 From: Christoph Berg <myon@debian.org> Date: Mon, 1 Jul 2013 11:48:31 +0200 Subject: [PATCH] pg_ctlcluster: Create stats_temp_directory when missing. --- PgCommon.pm | 4 +++- debian/changelog | 3 ++- pg_ctlcluster | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/PgCommon.pm b/PgCommon.pm index 2de467b9..aee70cbd 100644 --- a/PgCommon.pm +++ b/PgCommon.pm @@ -562,7 +562,8 @@ sub check_pidfile_running { # Return a hash with information about a specific cluster. # Arguments: <version> <cluster name> # Returns: information hash (keys: pgdata, port, running, logfile [unless it -# has a custom one], configdir, owneruid, ownergid, socketdir) +# has a custom one], configdir, owneruid, ownergid, socketdir, +# statstempdir) sub cluster_info { error 'cluster_info must be called with <version> <cluster> arguments' unless $_[0] && $_[1]; @@ -572,6 +573,7 @@ sub cluster_info { $result{'pgdata'} = cluster_data_directory $_[0], $_[1], \%postgresql_conf; $result{'port'} = $postgresql_conf{'port'} || $defaultport; $result{'socketdir'} = get_cluster_socketdir $_[0], $_[1]; + $result{'statstempdir'} = $postgresql_conf{'stats_temp_directory'}; # if we can determine the running status with the pid file, prefer that if ($postgresql_conf{'external_pid_file'} && diff --git a/debian/changelog b/debian/changelog index 0382097e..adc1d94e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,9 @@ postgresql-common (146) UNRELEASED; urgency=low + On error, show tail of server log file. + When no command is given, open a shell. * pg_createcluster: Add --createclusterconf and --environment options. + * pg_ctlcluster: Create stats_temp_directory when missing. - -- Christoph Berg <myon@debian.org> Thu, 27 Jun 2013 15:19:02 +0200 + -- Christoph Berg <myon@debian.org> Mon, 01 Jul 2013 11:47:25 +0200 postgresql-common (145) unstable; urgency=low diff --git a/pg_ctlcluster b/pg_ctlcluster index 0a285883..9503b4b0 100755 --- a/pg_ctlcluster +++ b/pg_ctlcluster @@ -390,6 +390,12 @@ if ($action ne 'stop' && ! -d $info{'socketdir'}) { '-o', $info{'owneruid'}, '-g', $info{'ownergid'}, $info{'socketdir'}; } +# recreate stats_temp_directory +if ($action ne 'stop' && $info{'statstempdir'} && ! -d $info{'statstempdir'}) { + system 'install', '-d', '-m', 750, + '-o', $info{'owneruid'}, '-g', $info{'ownergid'}, $info{'statstempdir'}; +} + if ($> == 0) { # have the postmaster start with increased OOM killer protection; 9.1 and # later has builtin support for resetting the adjustment of child processes -- GitLab