Re: file-locking and postmaster.pid - Mailing list pgsql-hackers

From korry
Subject Re: file-locking and postmaster.pid
Date
Msg-id 1148506126.21335.81.camel@sakai.localdomain
Whole thread Raw
In response to Re: file-locking and postmaster.pid  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: file-locking and postmaster.pid
List pgsql-hackers
<blockquote type="CITE"><pre>
<font color="#000000">Alvaro Herrera <<a href="mailto:alvherre@commandprompt.com">alvherre@commandprompt.com</a>>
writes:</font>
<font color="#000000">> Certainly on all platforms there must be *some* locking primitive.  We</font>
<font color="#000000">> just need to figure out the appropiate parameters to fcntl() or flock()</font>
<font color="#000000">> or lockf() on each.</font>
</pre></blockquote><br /> I use lockf() (not fcntl() or flock()) on every platform other than Win32.  Of course, I may
notrun on every system that PostgreSQL supports.<br /><br /><blockquote type="CITE"><pre>
 

<font color="#000000">Quite aside from the hassle factor of needing to deal with N variants of</font>
<font color="#000000">the syscalls, I'm not convinced that it's guaranteed to work.  ISTR that</font>
<font color="#000000">for instance NFS file locking is pretty much Alice-in-Wonderland :-(</font>

<font color="#000000">Since the entire point here is to have a guaranteed bulletproof check,</font>
<font color="#000000">locks that work most of the time on most platforms/filesystems aren't</font>
<font color="#000000">gonna be an improvement.</font>
</pre></blockquote><br /> NFS file locking may certainly be problematic.  I don't know about NFS byte-range locking.<br
/><br/> What we currently have in place is not bulletproof.  I think holding a byte-range lock in addition to the "is
theresome process with the right pid?" check might be a little more bullet resistant :-)<br /><br /><br />            
--Korry<br /><br /> 

pgsql-hackers by date:

Previous
From: korry
Date:
Subject: Re: file-locking and postmaster.pid
Next
From: Alvaro Herrera
Date:
Subject: Re: file-locking and postmaster.pid