Re: Questions about pid file creation code

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Questions about pid file creation code
Дата
Msg-id 27405.1175544695@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Questions about pid file creation code  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Ответы Re: Questions about pid file creation code  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Список pgsql-hackers
Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
> 1) Is there still some reason have negative value in postmaster.pid?

Just to distinguish postmasters from standalone backends in the error
messages.  I think that's still useful.

> 2) Why 100? What race condition should happen? This piece of code looks 
> like kind of magic.

There are at least two race cases identified in the comments in the
loop.

> 3) Why pid checking and cleanup is in postgres? I think it is role of 
> pg_ctl or init scripts.

Let's see, instead of one place in the postgres code we should do it in
N places in different init scripts, and just trust to luck that a
particular installation is using an init script that knows to do that?
I don't think so.  Besides, how is the init script going to remove it
again?  It won't still be running when the postmaster exits.

> 4) The following condition is buggy, because atoi function does not have 
> defined result if parameter is not valid number.

>   if (other_pid <= 0)

It's not actually trying to validate the syntax of the lock file, only
to make certain it doesn't trigger any unexpected behavior in kill().
I don't think I've yet seen any reports that suggest that more syntax
checking of the lock file would be a useful activity.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Arrays of Complex Types
Следующее
От: Bruce Momjian
Дата:
Сообщение: Bonjour patch