Alvaro Herrera <[EMAIL PROTECTED]> 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