* Peter Kovacs <peter.kovacs.1.0rc at gmail.com> [2007-02-14 14:34]:
> The post I quoted also says:
> 
> "That should not happen; it should always be possible to detect whether
> the file is stale, *if* your start script is written correctly."
> 
> "That" in the quote refers to my description:
> "On system startup PostgreSQL 8.1.4 refuses to start due to the pid
> file is [being] left over from [a] previous "session" on Solaris 10
> x86."
> 
> Nothing did "actually break", but something happened which should not
> have happened if my "start script is [had been] written correctly".
> 
> The issue here is:
> Does the SMF setup described in the referenced Sun document make sure
> that the postmaster process will start and become functional without
> human intervention even if there is a pid file left over from a
> previously crashed (abruptly terminated) postmaster process?

  The start method doesn't appear to clear out stale pidfiles.  On a quick
  glance, it looks like, unless the pid file isn't readable,

  
http://src.opensolaris.org/source/xref/sfw/usr/src/cmd/postgres/postgresql-8.1.6/src/bin/pg_ctl/pg_ctl.c#get_pgpid

  that pg_ctl will attempt to start postgres even if a stale pidfile
  exists

  
http://src.opensolaris.org/source/xref/sfw/usr/src/cmd/postgres/postgresql-8.1.6/src/bin/pg_ctl/pg_ctl.c#do_start

  (Presumably, two postgres invocations with the same configuration will
  collide over some other system resource, like a network port.)

  In general, services don't need pidfiles under smf(5), but if you want
  to have cleaner logs, filing an RFE for the postgres start method
  would be fine.  (There is also a databases community:

  http://www.opensolaris.org/os/community/databases/

  There are some Postgres contributors there, so that might even be
  faster--they own the service methods accompanying the integrated
  Postgres in SFW.)

  - Stephen


Reply via email to