Re: Temporary file access API

From: Antonin Houska <ah(at)cybertec(dot)at>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Temporary file access API
Date: 2022-04-20 15:00:26
Message-ID: 24759.1650466826@antos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Tue, Apr 12, 2022 at 5:30 AM Antonin Houska <ah(at)cybertec(dot)at> wrote:
> > Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> > > On Mon, Apr 11, 2022 at 4:05 AM Antonin Houska <ah(at)cybertec(dot)at> wrote:
> > > > There are't really that many kinds of files to encrypt:
> > > >
> > > >
> > > >
> > > > (And pg_stat/* files should be removed from the list.)
> > >
> > > This kind of gets into some theoretical questions. Like, do we think
> > > that it's an information leak if people can look at how many
> > > transactions are committing and aborting in pg_xact_status? In theory
> > > it could be, but I know it's been argued that that's too much of a
> > > side channel. I'm not sure I believe that, but it's arguable.
> >
> > I was referring to the fact that the statistics are no longer stored in files:
> >
> >;a=commit;h=5891c7a8ed8f2d3d577e7eea34dacff12d7b6bbd
> Oh, yeah, I agree with that.

I see now that the statistics are yet saved to a file on server shutdown. I've
updated the wiki page.

Attached is a new version of the patch, to evaluate what the API use in the
backend could look like. I haven't touched places where the file is accessed
in a non-trivial way, e.g. lseek() / fseek() or pg_pwrite() / pg_pread() is

Another use case might be copying one file to another via a buffer. Something

BufFileCopy(int dstfd, int srcfd, int bufsize)

The obvious call site would be in copydir.c:copy_file(), but I think there are
a few more in the server code.

Antonin Houska

Attachment Content-Type Size
temp_file_api_v2.tgz application/gzip 20.5 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Gilles Darold 2022-04-20 15:15:02 Re: [Proposal] vacuumdb --schema only
Previous Message André Hänsel 2022-04-20 14:23:26 RE: Bad estimate with partial index