https://github.com/postgres/postgres
Revision de1510e2f5a1826890b206253016ebfc592c2f0a authored by Michael Paquier on 12 July 2021, 04:02:45 UTC, committed by Michael Paquier on 12 July 2021, 04:02:45 UTC
The code introduced by bed9075 to enhance the stat() implementation on
Windows for file sizes larger than 4GB fails to properly detect files
pending for deletion with its method based on NtQueryInformationFile()
or GetFileInformationByHandleEx(), as proved by Alexander Lakhin in a
custom TAP test of his own.

The method used in the implementation of open() to sleep and loop when
when failing on ERROR_ACCESS_DENIED (EACCES) is showing much more
stability, so switch to this method.  This could still lead to issues if
the permission problem stays around for much longer than the timeout of
1 second used, but that should (hopefully) never happen in
performance-critical paths.  Still, there could be a point in increasing
the timeouts for the sake of machines that handle heavy loads.

Note that WIN32's open() now uses microsoft_native_stat() as it should
be similar to stat() when working around issues with concurrent file
deletions.

I have spent some time testing this patch with pgbench in combination
of the SQL functions from genfile.c, as well as running the TAP test
provided on the thread with MSVC builds, and this looks much more
stable than the previous method.

Author: Alexander Lakhin
Reviewed-by: Tom Lane, Michael Paquier,	Justin Pryzby
Discussion: https://postgr.es/m/c3427edf-d7c0-ff57-90f6-b5de3bb62709@gmail.com
Backpatch-through: 14
1 parent 69dfc36
History
Tip revision: de1510e2f5a1826890b206253016ebfc592c2f0a authored by Michael Paquier on 12 July 2021, 04:02:45 UTC
Fix issues with Windows' stat() for files pending on deletion
Tip revision: de1510e
File Mode Size
config
contrib
doc
src
.dir-locals.el -rw-r--r-- 730 bytes
.editorconfig -rw-r--r-- 183 bytes
.git-blame-ignore-revs -rw-r--r-- 8.6 KB
.gitattributes -rw-r--r-- 1.5 KB
.gitignore -rw-r--r-- 504 bytes
COPYRIGHT -rw-r--r-- 1.2 KB
GNUmakefile.in -rw-r--r-- 4.2 KB
HISTORY -rw-r--r-- 277 bytes
Makefile -rw-r--r-- 1.6 KB
README -rw-r--r-- 1.2 KB
README.git -rw-r--r-- 721 bytes
aclocal.m4 -rw-r--r-- 490 bytes
configure -rwxr-xr-x 566.9 KB
configure.ac -rw-r--r-- 81.9 KB

README

back to top