postgresql/src/backend
Thomas Munro 56b39cce77 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
(cherry picked from commit e2f0f8ed25)

Author: Thomas Munro <tmunro@postgresql.org>
Author: Alexandra Wang <alexandra.wang.oss@gmail.com>
2024-11-08 09:44:46 +10:30
..
access Revert "For inplace update, send nontransactional invalidations." 2024-11-02 09:05:07 -07:00
bootstrap Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
catalog Suppress new "may be used uninitialized" warning. 2024-11-02 19:42:57 -07:00
commands Restructure foreign key handling code for ATTACH/DETACH 2024-10-22 16:01:18 +02:00
executor Remove unnecessary word in a comment 2024-10-23 17:55:35 +09:00
foreign Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
jit Monkey-patch LLVM code to fix ARM relocation bug. 2024-11-06 23:10:05 +13:00
lib Fix lock assertions in dshash.c. 2022-07-11 15:48:54 +12:00
libpq Fix regression in TLS session ticket disabling 2024-08-19 12:55:11 +02:00
main Fix outdated --help message for postgres -f 2022-08-15 13:37:40 +09:00
nodes Further fixes for MULTIEXPR_SUBLINK fix. 2022-09-06 16:38:18 -04:00
optimizer Correctly identify which EC members are computable at a plan node. 2024-10-12 14:56:08 -04:00
parser Remove incorrect Assert. 2024-09-11 11:42:19 -04:00
partitioning Fix creation of partition descriptor during concurrent detach+drop 2024-08-12 18:17:56 -04:00
po Translation updates 2024-08-05 12:23:51 +02:00
port Check for STATUS_DELETE_PENDING on Windows. 2024-11-08 09:44:46 +10:30
postmaster Avoid deadlock during orphan temp table removal. 2024-04-02 14:59:04 -04:00
regex Avoid character classification in regex escape parsing. 2023-04-21 08:20:47 -07:00
replication Revert "For inplace update, send nontransactional invalidations." 2024-11-02 09:05:07 -07:00
rewrite Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
snowball In the Snowball dictionary, don't try to stem excessively-long words. 2022-08-31 10:42:05 -04:00
statistics Fix incorrectly reported stats kind in "can't happen" ERROR 2024-03-05 16:19:05 +13:00
storage At end of recovery, reset all sinval-managed caches. 2024-10-25 06:51:08 -07:00
tcop Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
tsearch Limit to_tsvector_byid's initial array allocation to something sane. 2023-09-25 11:50:28 -04:00
utils Fix -Wcast-function-type warnings 2024-11-08 09:42:21 +10:30
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nls.mk Translation updates 2020-09-14 13:14:53 +02:00