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

pgsql: Make it reasonably safe to use pg_ctl to start the postmaster

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make it reasonably safe to use pg_ctl to start the postmaster
Date: 2009-08-27 16:59:38
Message-ID: 20090827165938.C308F75331E@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Make it reasonably safe to use pg_ctl to start the postmaster from a boot-time
script.

To do this, have pg_ctl pass down its parent shell's PID in an environment
variable PG_GRANDPARENT_PID, and teach CreateLockFile() to disregard that PID
as a false match if it finds it in postmaster.pid.  This allows us to cope
with one level of postgres-owned shell process even with pg_ctl in the way,
so it's just as safe as starting the postmaster directly.  You still have to
be careful about how you write the initscript though.

Adjust the comments in contrib/start-scripts/ to not deprecate use of
pg_ctl.  Also, fix the ROTATELOGS option in the OSX script, which was
indulging in exactly the sort of unsafe coding that renders this fix
pointless :-(.  A pipe inside the "sudo" will probably result in more
than one postgres-owned process hanging around.

Modified Files:
--------------
    pgsql/contrib/start-scripts:
        freebsd (r1.4 -> r1.5)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/start-scripts/freebsd?r1=1.4&r2=1.5)
        linux (r1.8 -> r1.9)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/start-scripts/linux?r1=1.8&r2=1.9)
    pgsql/contrib/start-scripts/osx:
        PostgreSQL (r1.3 -> r1.4)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/start-scripts/osx/PostgreSQL?r1=1.3&r2=1.4)
    pgsql/src/backend/utils/init:
        miscinit.c (r1.176 -> r1.177)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/init/miscinit.c?r1=1.176&r2=1.177)
    pgsql/src/bin/pg_ctl:
        pg_ctl.c (r1.111 -> r1.112)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_ctl/pg_ctl.c?r1=1.111&r2=1.112)

pgsql-committers by date

Next:From: Alvaro HerreraDate: 2009-08-27 17:18:45
Subject: pgsql: Fix handling of autovacuum reloptions.
Previous:From: Magnus HaganderDate: 2009-08-27 16:49:41
Subject: pgsql: exports.txt needs to use spaces as separators, not tabs, to work

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