More time spending with "delete pending"
Alexander Law <exclusion@gmail.com>
From: Alexander Lakhin <exclusion@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-11-14T10:00:00Z
Lists: pgsql-hackers
Attachments
- 001_delete_pending.pl (application/x-perl)
- fix_pg_ls_dir.patch (text/x-patch) patch
Hello hackers, After fixing bug #16161 (pg_ctl inability to open just deleted postmaster.pid) there are still some errors related to the same Windows-only issue. Namely, pg_upgradeCheck failures seen on https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=fairywren&br=REL_13_STABLE Here pg_ls_dir_files couldn't handle the "delete pending" state too. I've made a simple test to reproduce this behavior with pg_ls_waldir, that fails with: error running SQL: 'psql:<stdin>:1: ERROR: could not stat file "pg_wal/dummy": Permission denied' As noted in [1], a sensible solution would be putting the same "retry on ERROR_ACCESS_DENIED" action in a wrapper for stat(). And bed90759f brought in master the _pgstat64() function, where such error handling should be placed. So please look at the patch (based on the previous one made to fix bug#16161), that makes the attached test pass. And I have a few questions. For now genfile.c needs to include "port.h" explicitly to override definitions in "sys/stat.h", that override "stat" redefinition for Windows included implicitly above via "postgres.h". Without it the pg_ls_dir_files() function just uses system' stat(). So I wonder, is there a way to make all stat-calling code use the improved stat()? And if so, maybe the stat() call in pgwin32_open should be replaced with microsoft_native_stat(). And regarding released versions, are there any reasons to not backport bed90759f (with the proposed fix or alike)? [1] https://www.postgresql.org/message-id/396837.1605298573%40sss.pgh.pa.us Best regards, Alexander
Commits
-
Revert "Fix issues with Windows' stat() for files pending on deletion"
- 5e60237ad1b4 14.0 landed
- 2c9b46c090e7 15.0 landed
-
Fix issues with Windows' stat() for files pending on deletion
- de1510e2f5a1 14.0 landed
- 54fb8c7ddf15 15.0 landed