From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Smith <greg@2ndquadrant.com>
Cc: xsun <xu2002261@163.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: The function of lock file named ".s.PGSQL.<port>.lock" on Linux?
Date: Tue, 10 Aug 2010 21:09:55 -0400
Message-ID: <23168.1281488995@sss.pgh.pa.us> (raw)
In-Reply-To: <4C61F3FF.1080303@2ndquadrant.com>
References: <i399mq$28vn$1@news.hub.org>
<16464.1281026474@sss.pgh.pa.us>
<4C61F3FF.1080303@2ndquadrant.com>
Greg Smith <greg@2ndquadrant.com> writes:
> Tom Lane wrote:
>> We can't portably lock the socket file itself, so we make a separate
>> ordinary file for locking purposes.
> It looks to me like the fact that the .lock file is created is only
> documented in src/backend/utils/init/miscinit.c , and even there the
> reason why (what you wrote above) isn't mentioned. Seems like noting
> this file is created in the unix_socket_directory entry of the docs, and
> the rationale for why in the source code, would make a useful
> improvement. Anybody want to write a little documentation patch?
FWIW, the discussion about that was here:
http://archives.postgresql.org/pgsql-hackers/2000-11/msg01306.php
and the subsequent commit was
2000-11-29 15:59 tgl
* configure, configure.in, src/backend/libpq/pqcomm.c,
src/backend/postmaster/postmaster.c, src/backend/tcop/postgres.c,
src/backend/utils/init/miscinit.c, src/backend/utils/misc/guc.c,
src/bin/pg_ctl/pg_ctl.sh, src/include/config.h.in,
src/include/miscadmin.h: Get rid of not-very-portable
fcntl(F_SETLK) mechanism for locking the Unix socket file, in favor
of having an ordinary lockfile beside the socket file. Clean up a
few robustness problems in the lockfile code. If postmaster is
going to reject a connection request based on database state, it
will now tell you so before authentication exchange not after. (Of
course, a failure after is still possible if conditions change
meanwhile, but this makes life easier for a yet-to-be-written
pg_ping utility.)
(The pgsql-committers messages were pretty useless back then, so I won't
point you to that archive.)
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, greg@2ndquadrant.com, xu2002261@163.com
Subject: Re: The function of lock file named ".s.PGSQL.<port>.lock" on Linux?
In-Reply-To: <23168.1281488995@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox