Re: [HACKERS] postmaster crash and .s.pgsql file - Mailing list pgsql-hackers

From Goran Thyni
Subject Re: [HACKERS] postmaster crash and .s.pgsql file
Date
Msg-id 19980127142639.5107.qmail@guevara.bildbasen.se
Whole thread Raw
In response to Re: [HACKERS] postmaster crash and .s.pgsql file  (James Hughes <jamesh@interpath.com>)
List pgsql-hackers
   : Removing at startup opens a whole new can of worms.
   : (You must no postmaster is not already running.)

   How about in postmaster.c (arround line 427), when starting up...
       1.) Check for the existence of a pid file.
       2.) If one is there, read the pid and see if a back end is alive.
       3.) If so, warn the user and exit.
       4.) If not, check for and cleanup any leftover files.
       5.) Continue with startup process.
           ...wouldn't this work OK?

It would,
but it would be complex.

The easy way to check for a pid is "kill -0 PID".
But...
It only works if we are running under the same user
as the server (or root).

Besides,
 we do not know that a process running as that
pid really is a postmaster w/o checking the process
table - and that is "portability hell".

Besides 2,
how do get the pid in the first place?
If you code it into the socket, like:
/tmp/.s.PORTNR.PID
how would the clients find the socket to connect to?
(they do not know the pid of the server)

Better leave it until after 6.3 (at least).

      best regards,
--
---------------------------------------------
G�ran Thyni, sysadm, JMS Bildbasen, Kiruna


pgsql-hackers by date:

Previous
From: darrenk@insightdist.com (Darren King)
Date:
Subject: Re: [HACKERS] No: implied sort with group by
Next
From: "Vadim B. Mikheev"
Date:
Subject: Re: [HACKERS] Group By bug in snapshot 270198