Re: How to implement autostart of postgres?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: "Gavrina, Irina" <igavrina(at)mera(dot)ru>, pgsql-general(at)postgresql(dot)org, Martin Pitt <mpitt(at)debian(dot)org>
Subject: Re: How to implement autostart of postgres?
Date: 2011-07-29 14:01:22
Message-ID: 24379.1311948082@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> writes:
> On 28/07/11 18:06, Gavrina, Irina wrote:
>> Is there any risk of losing of data or data corruption in this case?

> Possibly, if you then remove postmaster.pid, thus bypassing the other
> safety, and start a new postmaster.

> I'm a bit alarmed to discover that Ubuntu's postgresql packaging appears
> to do exactly this.
> ...
> It merrily removes the pid file without any effort to check if there are
> backends using that datadir, then goes on to relaunch the postmaster.

> Is this sane? Safe?

No, and no. The postmaster is capable of removing the old pidfile if it
really is stale, and any scripted substitute for that is highly likely
to be unsafe. You do have to be a bit careful about how you code the
script though, to ensure that the postmaster won't see false positives.
Martin, is that code your responsibility?

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2011-07-29 14:32:01 Re: query_to_xml nulls set to false
Previous Message Adrian Klaver 2011-07-29 13:40:31 Re: repmgr and archive_mode