Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> writes:
> > I think we may be best just looping on MoveFileEx() until is succeeds.
> > We do the pg_pwd writes while holding an exclusive lock on pg_shadow so
> > that will guarantee that no one else will slip an old version of the
> > file in after we have written it. However, it also prevents pg_shadow
> > access while we are doing the looping. Yuck.
> Surely you're not evaluating this on the assumption that the pg_shadow
> triggers are the only places that use rename() ?
> I see other places in pgstat and relcache that expect rename() to work
> per Unix spec.
Yes, I know there are others but I think we will need _a_ rename that
works 100% and then replace that in all Win32 rename cases.
Given what I have seen, I think a single rename with a loop that uses
MoveFileEx() may be our best bet. It is localized, doesn't affect the
open() code, and should work well. The only downside is that under
heavy read activity the loop will loop around a few times but I just
don't see another solution.
I was initially concerned that the loop in rename could let old renames
update the file overwriting newer contents but I realize now that
rename() itself has the same issue (an old rename could hit in the code
after a newer rename) so in all cases we must already have the proper
locking in place.
Bruce Momjian | http://candle.pha.pa.us
[EMAIL PROTECTED] | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly