Re: Win32 rename()/unlink() questions

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Win32 rename()/unlink() questions
Дата
Msg-id 20020919224718.H36366-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: Win32 rename()/unlink() questions  (Mike Mascari <mascarm@mascari.com>)
Ответы Re: Win32 rename()/unlink() questions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, 20 Sep 2002, Mike Mascari wrote:

> Bruce Momjian wrote:
> > Mike Mascari wrote:
> >
> >>Actually, looking at the pg_pwd code, you want to determine a
> >>way for:
> >>
> >>1. Process 1 opens "foo"
> >>2. Process 2 opens "foo"
> >>3. Process 1 creates "bar"
> >>4. Process 1 renames "bar" to "foo"
> >>5. Process 2 can continue to read data from the open file handle
> >>and get the original "foo" data.
> >
> >
> > Yep, that's it.
> >
>
> So far, MoveFileEx("foo", "bar", MOVEFILE_REPLACE_EXISTING)
> returns "Access Denied" when Process 1 attempts the rename. But
> I'm continuing to investigate the possibilities...

Does a sequence like
Process 1 opens "foo"
Process 2 opens "foo"
Process 1 creates "bar"
Process 1 renames "foo" to <something>- where something is generated to not overlap an existing file
Process 1 renames "bar" to "foo"
Process 2 continues reading
let you do the replace and keep reading (at the penalty that
you've now got to have a way to know when to remove the
various <something>s)




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

Предыдущее
От: Mike Mascari
Дата:
Сообщение: Re: Win32 rename()/unlink() questions
Следующее
От: Mike Mascari
Дата:
Сообщение: Re: Win32 rename()/unlink() questions