Questions about pid file creation code

Поиск
Список
Период
Сортировка
От Zdenek Kotala
Тема Questions about pid file creation code
Дата
Msg-id 4611518F.8010508@sun.com
обсуждение исходный текст
Ответы Re: Questions about pid file creation code  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I'm looking on pid file creation code (src/backend/utils/init/miscinit.c  - CreateLockFile) and I have couple of
questions:

1) Is there still some reason have negative value in postmaster.pid? It 
happens only if backend runs in single mode. But I think now is not 
necessary to use it. And there are some confusing messages about 
postgres/postmaster. See:

errhint("Is another postgres (PID %d) running in data directory \"%s\"?",
(int) other_pid, refName) :
errhint("Is another postmaster (PID %d) running in data directory \"%s\"?",
(int) other_pid, refName)) :

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

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


4) The following condition is buggy, because atoi function does not have 
defined result if parameter is not valid number. (OK in most 
implementation it really returns 0)
 if (other_pid <= 0)             elog(FATAL, "bogus data in lock file \"%s\": \"%s\"",                  filename,
buffer)

I think usage of strtol there should be better.

    Zdenek


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

Предыдущее
От: "Simon Riggs"
Дата:
Сообщение: Re: One-time plans
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: CheckpointStartLock starvation