Atomic rename feature for Windows.

From: Victor Spirin <v(dot)spirin(at)postgrespro(dot)ru>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Atomic rename feature for Windows.
Date: 2021-07-05 13:53:06
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I used the SetFileInformationByHandle function with the
FILE_RENAME_FLAG_POSIX_SEMANTICS flag for the file rename function..

1) The _WIN32_WINNT variable needs to be increased to 0x0A00 (Windows
10).  Fixed conflict with #undef CHECKSUM_TYPE_NONE

2) The SetFileInformationByHandle function works correctly only on
Windows 10 and higher.

The app must have a manifest to check the Windows version using the
IsWindows10OrGreater() function. I added a manifest to all postgres
projects and disabled the GenerateManifest option on windows projects.

This patch related to this post:

Victor Spirin
Postgres Professional:
The Russian Postgres Company

Attachment Content-Type Size
rename_atomic.patch text/plain 8.0 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2021-07-05 13:57:41 Re: Disable WAL logging to speed up data loading
Previous Message David Rowley 2021-07-05 13:48:52 Re: Removed extra memory allocations from create_list_bounds