[Pkg-postgresql-public] Bug#890427: postgresql-common: configured stats_temp_directory does not get created after reboot

Mario Splivalo mario.splivalo at canonical.com
Wed Feb 14 16:46:40 UTC 2018


Package: postgresql-common
Version: 190
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch

Dear Maintainer,

default postgres installation in Debian (and Ubuntu) configures 
stats_temp_directory inside /var/run/postgresql:

$ grep stats_temp /etc/postgresql/10/main/postgresql.conf
stats_temp_directory = '/var/run/postgresql/10-main.pg_stat_tmp'

However, this directory is not created after reboot.

In most cases this is not a problem as systemd starts postgres via
pg_ctlcluster, a "multiversion/cluster aware pg_ctl wrapper", and
pg_ctlcluster will create missing directories before starting postgres.

But in cases where systemd is not starting postgres this is a problem.
Specifically, when postgres is controlled by pacemaker (using postgres
resource agent for pacemaker) it is started using pg_ctl wrapper. pg_ctl
won't create missing directories and therefore postgres fails to start.

The simplest solution for this issue is to have systemd recreate missing
directories via /usr/lib/tmpfiles.d/postgresql.conf file.

Currently only /var/run/postgresql and /var/log/postgresql are created using
systemd-tmpfiles.


In Ubuntu, the attached patch was applied to achieve the following:

  * d/postgresql-common.postgresql.tmpfile: add stats_temp_directory to
    tempfiles created. (Closes: #1749283) 


Thanks for considering the patch.


-- System Information:
Debian Release: stretch/sid
  APT prefers artful-updates
  APT policy: (500, 'artful-updates'), (500, 'artful-security'), (500, 'artful'), (100, 'artful-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-32-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
-------------- next part --------------
diff -Nru postgresql-common-190/debian/postgresql-common.postgresql.tmpfile postgresql-common-190ubuntu1/debian/postgresql-common.postgresql.tmpfile
--- postgresql-common-190/debian/postgresql-common.postgresql.tmpfile	2018-01-12 15:08:46.000000000 +0100
+++ postgresql-common-190ubuntu1/debian/postgresql-common.postgresql.tmpfile	2018-02-14 13:10:08.000000000 +0100
@@ -1,4 +1,5 @@
 # Directory for PostgreSQL sockets, lockfiles and stats tempfiles
 d /var/run/postgresql 2775 postgres postgres - -
+d /var/run/postgresql/10-main.pg_stat_tmp 2770 postgres postgres  - - 
 # Log directory
 d /var/log/postgresql 1775 root postgres - -


More information about the Pkg-postgresql-public mailing list