postgres/src
Thomas Munro 54e72b66ed Refactor rmtree() to use get_dirent_type().
Switch to get_dirent_type() instead of lstat() while traversing a
directory tree, to see if that fixes the intermittent ENOTEMPTY failures
seen in recent pg_upgrade tests, on Windows CI.  While refactoring, also
use AllocateDir() instead of opendir() in the backend, which knows how
to handle descriptor pressure.

Our CI system currently uses Windows Server 2019, a version known not to
have POSIX unlink semantics enabled by default yet, unlike typical
Windows 10 and 11 systems.  That might explain why we see this flapping
on CI but (apparently) not in the build farm, though the frequency is
quite low.

The theory is that some directory entry must be in state
STATUS_DELETE_PENDING, which lstat() would report as ENOENT, though
unfortunately we don't know exactly why yet.  With this change, rmtree()
will not skip them, and try to unlink (again).  Our unlink() wrapper
should either wait a short time for them to go away when some other
process closes the handle, or log a message to tell us the path of the
problem file if not, so we can dig further.

Discussion: https://postgr.es/m/20220919213217.ptqfdlcc5idk5xup%40awork3.anarazel.de
2023-01-31 13:46:25 +13:00
..
backend Invent "join domains" to replace the below_outer_join hack. 2023-01-30 13:50:25 -05:00
bin Fix behavior with pg_restore -l and compressed dumps 2023-01-27 10:19:50 +09:00
common Refactor rmtree() to use get_dirent_type(). 2023-01-31 13:46:25 +13:00
fe_utils Refactor code for restoring files via shell commands 2023-01-18 11:15:48 +09:00
include Invent "join domains" to replace the below_outer_join hack. 2023-01-30 13:50:25 -05:00
interfaces Update copyright for 2023 2023-01-02 15:00:37 -05:00
makefiles Update copyright for 2023 2023-01-02 15:00:37 -05:00
pl plpython: Stop undefining _POSIX_C_SOURCE, _XOPEN_SOURCE 2023-01-25 09:59:26 -08:00
port Remove gratuitous references to postmaster program 2023-01-26 10:48:32 +01:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Do assorted mop-up in the planner. 2023-01-30 13:44:36 -05:00
timezone Update copyright for 2023 2023-01-02 15:00:37 -05:00
tools Rename GUC logical_decoding_mode to logical_replication_mode. 2023-01-30 08:02:08 +05:30
tutorial Update copyright for 2023 2023-01-02 15:00:37 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in autoconf: Move export_dynamic determination to configure 2022-12-06 18:55:28 -08:00
Makefile.shlib autoconf: Rely on ar supporting index creation 2022-10-07 11:53:39 -07:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00