Re: Postgresql13_beta1 (could not rename temporary statistics file)Windows 64bits - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: Postgresql13_beta1 (could not rename temporary statistics file)Windows 64bits
Date
Msg-id CAEudQApt2PbW5BZn1e_fnoT2hm574vj-R+jA4BT3p3w6zS6eSw@mail.gmail.com
Whole thread Raw
In response to Re: Postgresql13_beta1 (could not rename temporary statistics file)Windows 64bits  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: Postgresql13_beta1 (could not rename temporary statistics file)Windows 64bits
List pgsql-hackers
I can confirm that the problem is in pgrename (dirmod.c),
something is not OK, with MoveFileEx, even with the (MOVEFILE_REPLACE_EXISTING) flag.

Replacing MoveFileEx, with
unlink (to);
rename (from, to);

#if defined (WIN32) &&! defined (__ CYGWIN__)
unlink(to);
while (rename (from, to)! = 0)
#else
while (rename (from, to) <0)
#endif

The log messages have disappeared.

I suspect that if the target (to) file exists, MoveFileEx, it is failing to rename, even with the flag enabled.

Windows have the native rename function (https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/rename-wrename?view=vs-2019)
However, it fails if the target (to) file exists.

Question, is it acceptable delete the target file, if it exists, to guarantee the rename?

regards,
Ranier Vilela

Attachment

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: hashagg slowdown due to spill changes
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Review for GetWALAvailability()