Skip site navigation (1) Skip section navigation (2)

Re: We should Axe /contrib/start-scripts

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Josh Berkus" <josh(at)agliodbs(dot)com>, "Chander Ganesan" <chander(at)otg-nc(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: We should Axe /contrib/start-scripts
Date: 2009-08-19 21:32:35
Message-ID: 4A8C29230200002500029DDB@gw.wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-hackers
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote: 
 
> The problem is that after a system crash and reboot, an old
> postmaster.pid file might be left behind.  The postmaster can only
> safely remove this lock file if it is *certain* that it doesn't
> represent another live postmaster process.  Otherwise it is honor-
> bound to commit hara-kiri instead of starting up.  It can tell
> whether or not the PID in the file belongs to a live process and
> whether that process belongs to the postgres userid (by attempting
> kill(PID, 0) and seeing what it gets).  If not, it can remove the
> file with a clear conscience.
 
Right -- we did run into this in spades when our backup server,
running dozens of instances of PostgreSQL in "warm standby" to confirm
the integrity of the files received, crashed hard.  I wasn't sure if
this was the problem being addressed.  One obvious solution, which we
now rigorously observe, is to use a different OS user for each
PostgreSQL instance.  I assume that pg_ctl is safe in such an
environment?
 
> The long and the short of it is that it's best to not use pg_ctl.
> As mentioned, it doesn't buy much of anything for an initscript
> anyway.
 
It must buy something in our environment, because our attempts to use
the sample script with minimal modification were problematic. 
Unfortunately I forget the details, but our problems vanished when we
switched to pg_ctl.  (Well, except for that one unfortunate episode
mentioned above.)
 
> The whole thing is really only a problem for initscript authors (who
> all know about it by now ;-))
 
Well, one of them (at least) didn't quite understand the whole issue
until receiving your email.  Thanks for the clear description.
 
-Kevin

In response to

Responses

pgsql-hackers by date

Next:From: David FetterDate: 2009-08-19 21:42:10
Subject: Re: Geometric bewilderment
Previous:From: Tom LaneDate: 2009-08-19 21:29:34
Subject: Re: We should Axe /contrib/start-scripts

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group