Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] What's left?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL Win32 port list <pgsql-hackers-win32(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Claudio Natoli <claudio(dot)natoli(at)memetrics(dot)com>,"''Merlin Moncure' '" <merlin(dot)moncure(at)rcsonline(dot)com>,PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] What's left?
Date: 2004-01-27 04:01:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32pgsql-patches
Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > In this way, no one ever has the rename file open while we are holding
> > > the locks, and we can loop without holding an exclusive lock on
> > > pg_shadow, and file writes remain in order.
> > 
> > You're doing this where exactly, and are certain that you are holding no
> > locks why exactly?  And if you aren't holding a lock, what prevents
> > concurrency bugs?
> Oh, for concurrency bugs, you make while holding the
> exclusive lock, so someone could come in later and replace
> while I am in the rename loop, but then I just install theirs instead.
> I could install someone who has just done the rename to but
> not tried the rename from to realfile, but that seems OK. 
> They will just fine the file missing and fail on the rename, which is
> OK.

OK, here is a patch that I think handles rename.  It does the rename to
a secondary file while holding the lock, then releases the lock and does
a rename to the active file.  I enabled this for Win32 and Cygwin, which
has the same file system behavior.

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-hackers by date

Next:From: Ezra EpsteinDate: 2004-01-27 06:00:17
Previous:From: Tom LaneDate: 2004-01-27 03:56:24

pgsql-patches by date

Next:From: Brian MooreDate: 2004-01-27 04:51:20
Subject: support for printing/exporting xml
Previous:From: Bruce MomjianDate: 2004-01-27 01:53:02
Subject: Re: What's left?

pgsql-hackers-win32 by date

Next:From: Merlin MoncureDate: 2004-01-27 20:51:40
Subject: pg_config.h on interix
Previous:From: Bruce MomjianDate: 2004-01-27 01:53:02
Subject: Re: What's left?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group