Re: The function of lock file named ".s.PGSQL..lock" on Linux?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: The function of lock file named ".s.PGSQL..lock" on Linux?
Дата
Msg-id 16464.1281026474@sss.pgh.pa.us
обсуждение исходный текст
Ответ на The function of lock file named ".s.PGSQL..lock" on Linux?  ("xsun" <xu2002261@163.com>)
Ответы Re: The function of lock file named ".s.PGSQL..lock" on Linux?  (Greg Smith <greg@2ndquadrant.com>)
Список pgsql-admin
"xsun" <xu2002261@163.com> writes:
> When the psql server is started under Linux platform, in /tmp directory
> there is a lock files named ".s.PGSQL.<port>.lock". So I want to know what
> is the function of this lock file?

It prevents multiple postmasters from trying to use the same socket file.

> And does the server work well without
> this lock file?

No.  (Well, it will run, but you have no protection against accidentally
starting another postmaster on the same port number.)

> Additionally, I know that the file ".s.PGSQL.<port>" is used as the unix
> domain socket file. But the file ".s.PGSQL.<port>.lock" makes me still
> pazzled. Could you explain that? Thanks.

We can't portably lock the socket file itself, so we make a separate
ordinary file for locking purposes.

            regards, tom lane

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: out of memory error
Следующее
От: Bob Lunney
Дата:
Сообщение: Re: out of memory error