Re: stat() vs ERROR_DELETE_PENDING, round N + 1
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: thomas.munro@gmail.com
Cc: tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org,
juanjo.santamaria@gmail.com, michael@paquier.xyz
Date: 2021-09-03T02:01:03Z
Lists: pgsql-hackers
At Fri, 3 Sep 2021 01:01:43 +1200, Thomas Munro <thomas.munro@gmail.com> wrote in > On Fri, Sep 3, 2021 at 12:44 AM Thomas Munro <thomas.munro@gmail.com> wrote: > > NtFileCreate() > > Erm, that's spelled NtCreateFile. I see Michael mentioned this > before[1]; I don't think it's only available in kernel mode though, > the docs[2] say "This function is the user-mode equivalent to the > ZwCreateFile function", and other open source user space stuff is > using it. It's explicitly internal and subject to change though, > hence my desire to avoid it. > > [1] https://www.postgresql.org/message-id/flat/a9c76882-27c7-9c92-7843-21d5521b70a9%40postgrespro.ru > [2] https://docs.microsoft.com/en-us/windows/win32/api/winternl/nf-winternl-ntcreatefile Might be stupid, if a delete-pending'ed file can obstruct something, couldn't we change unlink on Windows to rename to a temporary random name then remove it? We do something like it explicitly while WAL file removal. (It may cause degradation on bulk file deletion, and we may need further fix so that such being-deleted files are excluded while running a directory scan, though..) However, looking [1], with that strategy there may be a case where such "deleted" files may be left alone forever, though. [1] https://www.postgresql.org/message-id/002101d79fc2%24c96dff60%245c49fe20%24%40gmail.com regards. -- Kyotaro Horiguchi NTT Open Source Software Center
Commits
-
Check for STATUS_DELETE_PENDING on Windows.
- e2f0f8ed251d 15.0 landed
-
Fix our Windows stat() emulation to handle file sizes > 4GB.
- bed90759fcbc 14.0 cited
-
Attempt to handle pending-delete files on Windows
- 9951741bbeb3 10.0 cited