[Pkg-postgresql-public] Bug#759725: postgresql-common: non-synchronous service postgresql start/stop/reload
beuc at debian.org
Fri Aug 29 18:28:50 UTC 2014
When working on the FusionForge installation system today I noticed
that in Debian Jessie, running:
service postgresql start
(or stop, or reload), is now asynchronous, due to using the new
PostgreSQL systemd init scripts.
Previously I could rely on the init script to come back when the
database was properly stopped and flushed. Right now the command
returns immediately and starts/stops/reloads in the background.
My scripts need to modify the PostgreSQL listen address and reload it
before populating the database through the PHP application. They also
need to stop/backup/start the server for quick load/restore during our
testsuite. Due to this change the installation system fails randomly
due to race condition.
I found it basically impossible to work-around this issue in a
- 'service postgresql status' is not reliable: it usually says the
service is stopped far before the shutdown is complete. I also got a
few cases where it reported active service with no running daemon.
- the 'postgresql' process may be stopped already, but pg_ctl still
doing a faststop (especially when there's data to flush to disk) -
there may also be other PostgreSQL processes I don't know about;
so 'ps' is not reliable either.
- the postgresql control commands vary between Debian and RedHat
(pg_ctl vs. pg_clusterctl), and they need a data directory that can
be in varied, possibly multiple, locations. Using 'pg_*ctl' manually
is error-prone and long.
- in any case that will require fare more code and testing than
'service postgresql xxx'
Please consider maintaining 'service postgresql start/stop/reload'
synchronous even with systemd.
-- System Information:
Debian Release: jessie/sid
APT prefers testing-updates
APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.14-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=eo.UTF-8, LC_CTYPE=eo.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages postgresql-common depends on:
ii adduser 3.113+nmu3
ii debconf [debconf-2.0] 1.5.53
ii init-system-helpers 1.21
ii lsb-base 4.1+Debian13
ii postgresql-client-common 160
ii procps 1:3.3.9-7
ii ssl-cert 1.0.34
ii ucf 3.0030
Versions of packages postgresql-common recommends:
ii logrotate 3.8.7-1
postgresql-common suggests no packages.
-- debconf information excluded
More information about the Pkg-postgresql-public