Re: [HACKERS] postmaster crash and .s.pgsql file

From: Goran Thyni <goran(at)bildbasen(dot)se>
To: jamesh(at)interpath(dot)com
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] postmaster crash and .s.pgsql file
Date: 1998-01-27 14:26:39
Message-ID: 19980127142639.5107.qmail@guevara.bildbasen.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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,
--
---------------------------------------------
Gran Thyni, sysadm, JMS Bildbasen, Kiruna

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim B. Mikheev 1998-01-27 14:57:26 Re: [HACKERS] Group By bug in snapshot 270198
Previous Message Serj 1998-01-27 14:03:41 Group By bug in snapshot 270198