Critical data loss bug in postgresql-common initscript
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
postgresql-common (Debian) |
Fix Released
|
Unknown
|
|||
postgresql-common (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Lucid |
Fix Released
|
High
|
Unassigned | ||
Precise |
Fix Released
|
High
|
Martin Pitt |
Bug Description
Hi
The Debian packages for PostgreSQL (and thus the Ubuntu packages because of the shared use of pg_wrapper) are subject to a potentially critical data loss bug because of an unsafe procedure for restarting PostgreSQL.
This issue has been recognised and patched in Debian:
http://
http://
but should be urgently included in Ubuntu and backported.
I quote Tom Lane (key PostgreSQL dev):
[The] forced unlink on the postmaster.pid file [...] (a) is entirely
new postmaster before all the old backends have flushed out.
It is VITAL that pg_wrapper NEVER unlink the postmaster.pid file. The postmaster will do that its self if it finds the pid to be stale, but only after performing some checks to make sure there are no backends still running and to ensure that there's no other postmaster running against the database.
See:
http://
Context here:
http://
http://
SRU INFORMATION:
* Impact: Severe data loss in rare corner cases.
* Regression potential: Very low. The change has been in Debian, Quantal, and my very popular PostgreSQL backports repository for quite some time. pg_ctlcluster has a function start_check_
* Test case: I do not know a realistic and reliable test case to cause the data loss, but the analysis of the bug in above ML thread is very clear. I suggest to regression-test the change only, i. e. run the postgresql-common test suite and a manual check that starting a cluster still works with a stale pid file being around:
sudo pg_createcluster 9.1 test --start
sudo cp /var/lib/
sudo pg_ctlcluster 9.1 test stop
# now cause a stale pid file
sudo cp /var/lib/
# this should succeed and say "Removed stale pid file."
sudo pg_ctlcluster 9.1 test start
# this should say that 9.1/test is online
pg_lsclusters
Changed in postgresql-common (Debian): | |
status: | Unknown → New |
Changed in postgresql-common (Ubuntu Lucid): | |
status: | Fix Committed → In Progress |
Changed in postgresql-common (Debian): | |
status: | New → Fix Released |
Debian patch: http:// anonscm. debian. org/loggerhead/ pkg-postgresql/ postgresql- common/ trunk/revision/ 1181