hi all,
After a power failure in my PC, postmaster didnt start. Manually
starting it by "/etc/init.d/postgresql start" also didnt help. Finally i traced
the problem to be existance of the postmaster.pid file. After i deleted that
file, postmaster started properly. This happened two times.
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?
My system is automated and can run for months together without any manual
interventions. In that case, in an unlikely event of power failure, the system
functioning may become improper.
Can somebody suggest a way out of this, please.

/ / __ _ _ _ _ __ __ -o)
/ /__ / / / \\// //_// \\ \\/ / /\\\\ Making things happen
/____/ /_/ /_/\\/ /___/ /_/\\_\\ _\\_v-

Search Discussions

  • Tom Lane at May 21, 2003 at 2:50 pm

    HK 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
postedMay 21, '03 at 7:48a
activeMay 21, '03 at 2:50p

2 users in discussion

Tom Lane: 1 post HK: 1 post



site design / logo © 2021 Grokbase