Re: stat() vs ERROR_DELETE_PENDING, round N + 1

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: thomas(dot)munro(at)gmail(dot)com
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org, juanjo(dot)santamaria(at)gmail(dot)com, michael(at)paquier(dot)xyz
Subject: Re: stat() vs ERROR_DELETE_PENDING, round N + 1
Date: 2021-09-03 02:01:03
Message-ID: 20210903.110103.1330710259893472730.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Fri, 3 Sep 2021 01:01:43 +1200, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote in
> On Fri, Sep 3, 2021 at 12:44 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2021-09-03 02:17:37 Re: row filtering for logical replication
Previous Message Michael Paquier 2021-09-03 01:45:33 Re: Estimating HugePages Requirements?