postgresql/src
Thomas Munro e2f0f8ed25 Check for STATUS_DELETE_PENDING on Windows.
1.  Update our open() wrapper to check for NT's STATUS_DELETE_PENDING
and translate it to Unix-like errors.  This is done with
RtlGetLastNtStatus(), which is dynamically loaded from ntdll.  A new
file win32ntdll.c centralizes lookup of NT functions, in case we decide
to add more in the future.

2.  Remove non-working code that was trying to do something similar for
stat(), and just reuse the open() wrapper code.  As a side effect,
stat() also gains resilience against "sharing violation" errors.

3.  Since stat() is used very early in process startup, remove the
requirement that the Win32 signal event has been created before
pgwin32_open_handle() is reached.  Instead, teach pg_usleep() to fall
back to a non-interruptible sleep if reached before the signal event is
available.

This could be back-patched, but for now it's in master only.  The
problem has apparently been with us for a long time and generated only a
few complaints.  Proposed patches trigger it more often, which led to
this investigation and fix.

Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKGJz_pZTF9mckn6XgSv69%2BjGwdgLkxZ6b3NWGLBCVjqUZA%40mail.gmail.com
2021-12-10 16:19:43 +13:00
..
backend Check for STATUS_DELETE_PENDING on Windows. 2021-12-10 16:19:43 +13:00
bin Revert "Check that we have a working tar before trying to use it" 2021-12-08 16:45:39 -05:00
common Centralize timestamp computation of control file on updates 2021-11-29 13:36:13 +09:00
fe_utils Rethink pg_dump's handling of object ACLs. 2021-12-06 12:39:45 -05:00
include Check for STATUS_DELETE_PENDING on Windows. 2021-12-10 16:19:43 +13:00
interfaces Improve some comments in scanner files 2021-12-01 16:10:52 +01:00
makefiles Add NO_INSTALL option to pgxs 2021-05-27 13:58:29 +02:00
pl Remove unneeded Python includes 2021-11-25 14:19:22 +01:00
port Check for STATUS_DELETE_PENDING on Windows. 2021-12-10 16:19:43 +13:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:23 -05:00
test Fix double publish of child table's data. 2021-12-09 08:36:59 +05:30
timezone Update time zone data files to tzdata release 2021e. 2021-10-29 11:38:18 -04:00
tools Check for STATUS_DELETE_PENDING on Windows. 2021-12-10 16:19:43 +13:00
tutorial doc: Prefer explicit JOIN syntax over old implicit syntax in tutorial 2021-04-08 10:51:26 +02:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Add support for LZ4 compression in pg_receivewal 2021-11-05 11:33:25 +09:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:27:59 -07:00
nls-global.mk Add errhint_plural() function and make use of it 2021-03-31 09:16:25 +02:00