Re: Win32 rename()/unlink() questions
От | Bruce Momjian |
---|---|
Тема | Re: Win32 rename()/unlink() questions |
Дата | |
Msg-id | 200209200250.g8K2ofr29042@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Win32 rename()/unlink() questions (Bruce Momjian <pgman@candle.pha.pa.us>) |
Список | pgsql-hackers |
Bruce Momjian wrote: > > > Second, when you unlink() a file on Win32, do applications continue > > > accessing the old file contents if they had the file open before the > > > unlink? > > > > > > > unlink() just calls DeleteFile() which will error if: > > > > 1. The target file is in use > > > > CreateFile() has the option: > > > > FILE_FLAG_DELETE_ON_CLOSE > > > > which might be able to be used to simulate traditional unlink() > > behavior. > > No, that flag isn't going to help us. I wonder what MoveFileEx does if > the target file exists _and_ is open by another user? I don't see any > loop in that Win32 rename() routine, and I looked at the Unix version of > apr_file_rename and its just a straight rename() call. This says that if the target is in use, it is overwritten: http://support.microsoft.com/default.aspx?scid=KB;EN-US;q140570& While I think that is good news, does it open the problem of other readers reading partial updates to the file and therefore seeing garbage. Not sure how to handle that, nor am I even sure how I would test it. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
В списке pgsql-hackers по дате отправления: