Re: [Win32] Problem with rename() - Mailing list pgsql-bugs

From Magnus Hagander
Subject Re: [Win32] Problem with rename()
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCEA352BA@algol.sollentuna.se
Whole thread Raw
In response to [Win32] Problem with rename()  ("Peter Brant" <Peter.Brant@wicourts.gov>)
List pgsql-bugs
> > Looking at our code, we have the comment:
> >     /* These flags allow concurrent rename/unlink */
> >                     (FILE_SHARE_READ |
> > FILE_SHARE_WRITE | FILE_SHARE_DELETE),
>=20
> > But I'm not sure that those flags actually guarantee that.=20
> They do allow
> > concurrent unlink, but not necessarily rename. I read=20
> elsewhere that it
> > should work, but can't find backing docs on MSDN. Seems it=20
> works in most
> > cases, but perhaps there are some where it doesn't?
>=20
> I think there are two different cases involved in rename:
>=20
> 1. Someone has a handle for the file-to-be-renamed;
> 2. Someone has a handle for the file that is to be deleted=20
> (ie currently
>    has the name being renamed to).
>=20
> If #2 doesn't work then we've got serious problems.  I think=20
> though that
> #1 can only occur in the context of WAL segment recycling, so we can
> probably work around it if that doesn't work.

The problem reported here was 1. Nobody had handles to the new filename.
I don't think I've seen any reports of issue 2, but most were never
researched to this depth (because most were just a case of
uninstalling-the-antivirus-to-make-it-work).

//Magnus

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: pre-existing shared memory block
Next
From: "Peter Brant"
Date:
Subject: Re: [Win32] Problem with rename()