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

From: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: stat() vs ERROR_DELETE_PENDING, round N + 1
Date: 2021-09-23 09:05:47
Message-ID: CAC+AXB2LwMF3Wv+MozvC28V5vgL-mFysNOz0PBUcgyNvq5JUyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 23, 2021 at 4:58 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:

>
> One small detail I'd like to draw attention to is this bit, which
> differs slightly from the [non-working] previous attempts by mapping
> to two different errors:
>
> + * If there's no O_CREAT flag, then we'll pretend the file is
> + * invisible. With O_CREAT, we have no choice but to report that
> + * there's a file in the way (which wouldn't happen on Unix).
>
> ...
>
> + if (fileFlags & O_CREAT)
> + err = ERROR_FILE_EXISTS;
> + else
> + err = ERROR_FILE_NOT_FOUND;
>

When GetTempFileName() finds a duplicated file name and the file is pending
for deletion, it fails with an "ERROR_ACCESS_DENIED" error code. That may
describe the situation better than "ERROR_FILE_EXISTS".

Regards,

Juan José Santamaría Flecha

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Wildish 2021-09-23 09:33:32 Re: [PATCH] Allow queries in WHEN expression of FOR EACH STATEMENT triggers
Previous Message Drouvot, Bertrand 2021-09-23 08:44:16 Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns