From: | Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Questions about pid file creation code |
Date: | 2007-04-02 18:55:11 |
Message-ID: | 4611518F.8010508@sun.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2007-04-02 19:00:03 | CheckpointStartLock starvation |
Previous Message | Hiroki Kataoka | 2007-04-02 18:28:58 | Re: Proposal: Adding JIS X 0213 support |