Re: Postgresql13_beta1 (could not rename temporary statistics file) Windows 64bits

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Postgresql13_beta1 (could not rename temporary statistics file) Windows 64bits
Date: 2020-06-16 02:49:33
Message-ID: CAEudQApt2PbW5BZn1e_fnoT2hm574vj-R+jA4BT3p3w6zS6eSw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
logfile application/octet-stream 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-06-16 03:02:36 Re: Review for GetWALAvailability()
Previous Message Jeff Davis 2020-06-16 02:38:45 Re: hashagg slowdown due to spill changes