Re: file-locking and postmaster.pid

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: file-locking and postmaster.pid
Дата
Msg-id 5779.1148514949@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: file-locking and postmaster.pid  (korry <korry@appx.com>)
Ответы Re: file-locking and postmaster.pid  (korry <korry@appx.com>)
Список pgsql-hackers
korry <korry@appx.com> writes:
> Isn't that sort of like saying that if a postmaster.pid file exists, it
> must have been written by a postmaster?  Pick a semaphore id and
> dedicate it to postmaster exclusion.  

That's not workable, unless you want to assume that nothing on the
system except Postgres uses SysV semaphores.  Otherwise something else
could randomly gobble up the semid you want to use.  I don't care very
much for requiring a distinct semid to be hand-specified for each
postmaster on a machine, either.  At least for my use, that would be a
grade-A PITA: I normally have several postmasters of different vintages
running on the same development machine, and having to configure each
one with its own semid is an extra step I'd rather not deal with.

> As long as the kernel cleans up SEM_UNDO semaphores, I guess I don't see
> have you would have a false positive.

My point was that you couldn't reliably tell a postmaster interested in
a different data directory from a postmaster interested in your own data
directory.  Even with a configured semid, I don't see that that's real
reliable.  I know the first thing I'd do is fix my postmaster start
scripts to specify semid on the command line rather than requiring it
to be in the conf file, and as soon as I do that, the connection to
the data directory is gone :-( --- now my security is utterly dependent
on not screwing up by launching a postmaster with the wrong semid for
the data directory it's pointed at.

The only scenario where the PID-based solution is at serious risk of
false positives is where there are multiple postmasters on the same
machine, so unless you've got a bulletproof answer for this case, you
haven't made an improvement over what we've got.

Anyway the real problem here is that neither PIDs nor semids are
strongly wired to a particular data directory, which is the thing you're
really trying to protect.  File locks would really be much nicer all
around, if we could trust them, because they *would* be directly
connected to a data directory.
        regards, tom lane


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

Предыдущее
От: Richard
Дата:
Сообщение: v814 + OSX10.4.6 builds OK, but fails launch ...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: v814 + OSX10.4.6 builds OK, but fails launch ...