Re: file-locking and postmaster.pid
- From: korry <korry(at)appx(dot)com>
- To: pgsql-hackers(at)postgresql(dot)org
- Subject: Re: file-locking and postmaster.pid
- Date: Wed, 24 May 2006 17:28:46 -0400
- Message-id: <1148506126(dot)21335(dot)81(dot)camel(at)sakai(dot)localdomain>
Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Certainly on all platforms there must be *some* locking primitive. We
> just need to figure out the appropiate parameters to fcntl() or flock()
> or lockf() on each.
I use lockf() (not fcntl() or flock()) on every platform other than Win32. Of course, I may not run on every system that PostgreSQL supports.
Quite aside from the hassle factor of needing to deal with N variants of
the syscalls, I'm not convinced that it's guaranteed to work. ISTR that
for instance NFS file locking is pretty much Alice-in-Wonderland :-(
Since the entire point here is to have a guaranteed bulletproof check,
locks that work most of the time on most platforms/filesystems aren't
gonna be an improvement.
NFS file locking may certainly be problematic. I don't know about NFS byte-range locking.
What we currently have in place is not bulletproof. I think holding a byte-range lock in addition to the "is there some process with the right pid?" check might be a little more bullet resistant :-)
-- Korry
Home |
Main Index |
Thread Index