Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 92376633551 for ; Thu, 5 Aug 2010 13:41:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 49734-08 for ; Thu, 5 Aug 2010 16:41:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D265163348C for ; Thu, 5 Aug 2010 13:41:23 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o75GfESa016465; Thu, 5 Aug 2010 12:41:15 -0400 (EDT) To: "xsun" cc: pgsql-admin@postgresql.org Subject: Re: The function of lock file named ".s.PGSQL..lock" on Linux? In-reply-to: References: Comments: In-reply-to "xsun" message dated "Tue, 03 Aug 2010 22:39:29 +0800" Date: Thu, 05 Aug 2010 12:41:14 -0400 Message-ID: <16464.1281026474@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/26 X-Sequence-Number: 35275 "xsun" writes: > When the psql server is started under Linux platform, in /tmp directory > there is a lock files named ".s.PGSQL..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." is used as the unix > domain socket file. But the file ".s.PGSQL..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