Commit e83bbefd authored by Christoph Berg's avatar Christoph Berg

Put stats_temp_directory aka pg_stat_tmp into /var/run/postgresql by

default. (Closes: #739276)
parent 05b7a6d9
# Default values for pg_createcluster(8)
# Occurrences of '%v' are replaced by the major version number,
# and '%c' by the cluster name. Use '%%' for a literal '%'.
# Create a "main" cluster when a new postgresql-x.y server package is installed
#create_main_cluster = true
......@@ -7,9 +9,6 @@
# See pg_createcluster(8) for more documentation.
#start_conf = 'auto'
# In the following options, occurrences of '%v' are replaced by the major
# version number, and '%c' by the cluster name. Use '%%' for a literal '%'.
# Default data directory.
#data_directory = '/var/lib/postgresql/%v/%c'
......@@ -20,10 +19,14 @@
# Options to pass to initdb.
#initdb_options = ''
# The following options are copied into the new cluster's postgresql.conf:
# Enable SSL by default (using the "snakeoil" certificates installed by the
# ssl-cert package, unless configured otherwise here)
ssl = __SSL__
# All other options are copied into the new cluster's postgresql.conf
# Put stats_temp_directory on tmpfs
stats_temp_directory = '/var/run/postgresql/%v-%c.pg_stat_tmp'
# Add timestamps to log lines
log_line_prefix = '%%t '
postgresql-common (158) UNRELEASED; urgency=medium
* Put stats_temp_directory aka pg_stat_tmp into /var/run/postgresql by
default. (Closes: #739276)
-- Christoph Berg <myon@debian.org> Tue, 03 Jun 2014 21:30:05 +0200
postgresql-common (157) unstable; urgency=medium
* Remove createcluster.conf on purge.
......
......@@ -458,6 +458,33 @@ my $ssl_key_access;
my ($uid, $euid, $gid, $egid) = ($<, $>, $(, $));
change_ugid $owneruid, $ownergid;
$ssl_key_access = -r $ssl_key_file;
# check for stats_temp_directory access
if ($defaultconf{stats_temp_directory}) {
my $stats_temp_directory = replace_v_c ($defaultconf{stats_temp_directory}, $version, $cluster);
$stats_temp_directory =~ s!/$!!; # strip trailing slash
my $stats_temp_parent = $stats_temp_directory;
$stats_temp_parent =~ s!/[^/]+$!!;
if (-d $stats_temp_directory) {
if (! -w $stats_temp_directory) {
print "Warning: The selected stats_temp_directory $stats_temp_directory
is not writable for the cluster owner. Not adding this setting in
postgresql.conf.\n";
delete $defaultconf{stats_temp_directory};
}
} elsif (! -d $stats_temp_parent) {
print "Warning: The parent $stats_temp_parent of the selected
stats_temp_directory does not exist. Not adding this setting in
postgresql.conf.\n";
delete $defaultconf{stats_temp_directory};
} elsif (! -w $stats_temp_parent) {
print "Warning: The parent $stats_temp_parent of the selected
stats_temp_directory is not writable for the cluster owner. Not adding this
setting in postgresql.conf.\n";
delete $defaultconf{stats_temp_directory};
}
}
$> = $euid;
$< = $uid;
$( = $gid;
......@@ -538,8 +565,8 @@ if ($socketdir eq '/var/run/postgresql') {
# handle other createcluster.conf parameters
foreach my $guc (sort keys %defaultconf) {
next if $guc =~ /^(create_main_cluster|start_conf|data_directory|xlogdir|initdb_options|ssl)$/;
PgCommon::set_conf_value $version, $cluster, 'postgresql.conf',
$guc, replace_v_c ($defaultconf{$guc}, $version, $cluster);
my $val = replace_v_c ($defaultconf{$guc}, $version, $cluster);
PgCommon::set_conf_value $version, $cluster, 'postgresql.conf', $guc, $val;
}
# process --pgoption parameters
......@@ -776,7 +803,9 @@ additional options passed to pg_ctl of that cluster.
=head1 DEFAULT VALUES
Some default values used by B<pg_createcluster> can be modified in
C</etc/postgresql-common/createcluster.conf>:
C</etc/postgresql-common/createcluster.conf>. Occurrences of B<%v> are replaced
by the major version number, and B<%c> by the cluster name. Use B<%%> for a
literal B<%>.
=over 4
......@@ -790,9 +819,6 @@ Default C<start.conf> value to use.
=back
In the following options, occurrences of B<%v> are replaced by the major
version number, and B<%c> by the cluster name. Use B<%%> for a literal B<%>.
=over 4
=item B<data_directory> (Default: B</var/lib/postgresql/%v/%c>)
......@@ -809,13 +835,29 @@ default, i.e. pg_xlog is remains in the data directory.
Other options to pass to B<initdb>.
=item I<other options> (Default: none)
=item Other options
All other options listed are copied into the new cluster's postgresql.conf, e.g.:
listen_addresses = '*'
log_line_prefix = '%%t '
Some postgresql.conf options are treated specially:
=over 4
=item B<ssl>
Only added to postgresql.conf if the default snakeoil certificates exist and
are readable for the cluster owner as detailed above.
=item B<stats_temp_directory>
Only added to postgresql.conf if existing, and writable for the cluster owner,
or else if the parent directory is writable.
=back
=back
=head1 SEE ALSO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment