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: 2006-05-24 21:28:46
Message-ID: 1148506126.21335.81.camel@sakai.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-05-24 21:33:02 Re: file-locking and postmaster.pid
Previous Message korry 2006-05-24 21:23:57 Re: file-locking and postmaster.pid