Re: [Win32] Problem with rename()

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: [Win32] Problem with rename()
Дата
Msg-id 6BCB9D8A16AC4241919521715F4D8BCEA352B8@algol.sollentuna.se
обсуждение исходный текст
Ответ на [Win32] Problem with rename()  ("Peter Brant" <Peter.Brant@wicourts.gov>)
Ответы Re: [Win32] Problem with rename()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Ok. So we're obviously blocking ourselves out.

Which process was the stalled one? Was it the same one that held the
file open, or a different one?


Looking at our code, we have the comment:
    /* These flags allow concurrent rename/unlink */
                    (FILE_SHARE_READ |
FILE_SHARE_WRITE | FILE_SHARE_DELETE),

But I'm not sure that those flags actually guarantee that. They do allow
concurrent unlink, but not necessarily rename. I read elsewhere that it
should work, but can't find backing docs on MSDN. Seems it works in most
cases, but perhaps there are some where it doesn't?


Is there any way we can force our own other backends to close a file?
That would be an easy fix - have the postmaster tell all other backends
to close all files and reopen...

/Magnus

> -----Original Message-----
> From: Peter Brant [mailto:Peter.Brant@wicourts.gov]=20
> Sent: Tuesday, April 18, 2006 4:15 PM
> To: Bruce Momjian; Qingqing Zhou <zhouqq@cs.toronto.edu;=20
> Magnus Hagander <mha@sollentuna.net
> Cc: pgsql-bugs@postgresql.org
> Subject: Re: [BUGS] [Win32] Problem with rename()
>=20
> Unfortunately, it's not that simple.  It would be=20
> straightforward to track down if it were.
>=20
> In response to other questions:
>=20
> It's Postgres 8.1.3 running on Windows 2003 Server.  No=20
> anti-virus software is installed.  The servers are=20
> essentially bare except for the OS and Postgres.
>=20
> We have "handle -a" output from two occurrences (different servers):
>=20
> For the first one:
>=20
> LOG:  could not rename file=20
> "pg_xlog/000000010000010A000000BD" to=20
> "pg_xlog/000000010000010A000000D7", continuing to try
>=20
> Only one process (postgres.exe) is holding a handle to
> pg_xlog/000000010000010A000000BD:
>=20
>   F84: Event         \BaseNamedObjects\pgident: postgres: bigbird
> bigbird 127.0.0.1(3306) BIND
>   FF4: File          G:\pgsql\data\pg_xlog\000000010000010A000000BD
>=20
> Nothing has the target file open.
>=20
> The second is similar, except that two postgres.exe processes=20
> (and nothing else) have the file open:
>=20
> LOG:  could not rename file=20
> "pg_xlog/000000010000010A0000006E" to=20
> "pg_xlog/000000010000010A00000087", continuing to try
>=20
> #1:
>   F84: Event         \BaseNamedObjects\pgident: postgres: bigbird
> bigbird 127.0.0.1(2367) SELECT
>   EFC: File          G:\pgsql\data\pg_xlog\000000010000010A0000006E
>=20
> #2:
>   F84: Event         \BaseNamedObjects\pgident: postgres: bigbird
> bigbird 127.0.0.1(2420) SELECT
>   FF4: File          G:\pgsql\data\pg_xlog\000000010000010A0000006E
>=20
> Nothing has the target file open.
>=20
> Pete
>=20
> >>> Bruce Momjian <pgman@candle.pha.pa.us> 04/18/06 2:58 am >>>
> Yes, comment I added to dirmod.c give a hint:
>=20
>     /*
>      * We need these loops because even though PostgreSQL=20
> uses flags that
>      * allow rename while the file is open, other=20
> applications might have
>      * these files open without those flags.
>      */
>=20
> so someone else has the file opened, but didn't use the=20
> required flags.
>=20
> As to what could have it open, I don't know.
>=20
>=20

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Harald Armin Massa"
Дата:
Сообщение: Re: [Win32] Problem with rename()
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [Win32] Problem with rename()