From: | Paul Guo <pguo(at)pivotal(dot)io> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [Patch] Check file type before calling AllocateFile() for files out of pg data directory to avoid potential issues (e.g. hang). |
Date: | 2019-04-24 05:11:55 |
Message-ID: | CAEET0ZFO4XRkQF-=EamDS91V0J9H3hpSu_i7wCTfO_51tfYo2Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Apr 24, 2019 at 12:49 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> Hi,
>
> On 2019-04-24 12:46:15 +0800, Paul Guo wrote:
> > This is, in theory, not a 100% bug, but it is probably not unusual to see
> > conflicts of files between postgresql sqls and other applications on the
> > same node so I think the fix is needed. I checked all code that calls
> > AllocateFile() and wrote a simple patch to do sanity check (if the file
> > exists it must be a regular file) for those files which are probably out
> of
> > the postgres data directories which we probably want to ignore. This is
> > actually not a perfect fix since it is not atomic (check and open), but
> it
> > should fix most of the scenarios. To be perfect, we might want to
> refactor
> > AllocateFile() to allow atomic check&create using either 'x' in fopen()
> > or O_EXCL in open(), also it seems that we might not want to create temp
> > file for AllocateFile() with fixed filenames. This is beyond of this
> patch
> > of course.
>
> This seems like a bad idea to me. IMO we want to support using a pipe
> etc here. If the admin creates a fifo like this without attaching a
> program it seems like it's their fault.
>
Oh, I never know this application scenario before. So yes, for this, we
need to keep the current code logic in copy code.
>
> Greetings,
>
> Andres Freund
>
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2019-04-24 05:58:32 | Re: Unhappy about API changes in the no-fsm-for-small-rels patch |
Previous Message | Andres Freund | 2019-04-24 04:49:31 | Re: [Patch] Check file type before calling AllocateFile() for files out of pg data directory to avoid potential issues (e.g. hang). |