Re: postmaster didnt start after power failure.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: HK <harikrishnan(at)midascomm(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: postmaster didnt start after power failure.
Date: 2003-05-21 14:43:52
Message-ID: 7045.1053528232@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

HK <harikrishnan(at)midascomm(dot)com> writes:
> I am using RH 7.2 and postgres 7.1.3.
> Can anyone clarify on why the pid file is not removed on next bootup?

Recent versions of PG (I don't think 7.1.3 qualifies as recent anymore)
will usually restart successfully even if the postmaster.pid file is
still present. The postmaster is bright enough to check whether the PID
mentioned in the file actually belongs to a live process (and is not its
own PID, so we handle the case where successive reboots assign the same
PID to the postmaster).

However, there is a corner case if the reboot process isn't 100%
repeatable --- it may be that the current postmaster got assigned a PID
a few counts different from what it had in the last boot cycle, and the
PID it had last time is now assigned to another daemon process created
at boot time. In that case the postmaster will think the lock file
represents an already-live postmaster and will refuse to start.

The same scenario exists for other standard daemons such as sendmail.
Usually, there is some early-in-boot script responsible for removing
leftover pid files to ensure those daemons will restart. You might want
to find that script and add PG's pidfiles (there are two) to its list of
things to zap.

I do *not* recommend putting this action into PG's own start script,
since that script is often re-used after initial system boot to
start/stop the postmaster by hand. If you put an "rm pidfile" in it,
you just blew away your protection against mistakenly starting two
postmasters manually. Which is a really, really bad mistake...

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Joe Conway 2003-05-21 15:20:47 Re: connect by [prior]
Previous Message Tom Lane 2003-05-21 14:32:07 Re: parse error when executing a simple plpgsql function