Re: pg_ls_tmpdir to show directories and shared filesets

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: David Steele <david(at)pgmasters(dot)net>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, pgsql-hackers(at)postgresql(dot)org, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: pg_ls_tmpdir to show directories and shared filesets
Date: 2020-03-06 23:35:07
Message-ID: 20200306233507.GN684@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 05, 2020 at 10:18:38AM -0600, Justin Pryzby wrote:
> I'm not sure if prefer the 0002 patch alone (which recurses into dirs all at
> once during the initial call), or 0002+3+4, which incrementally reads the dirs
> on each call (but requires keeping dirs opened).

I fixed an issue that leading dirs were being shown which should not have been,
which was easier in the 0004 patch, so squished. And fixed a bug that
"special" files weren't excluded, and "missing_ok" wasn't effective.

> > I don't understand what purpose is served by having pg_ls_waldir() hide
> > directories.
>
> We could talk about whether the other functions should show dirs, if it's worth
> breaking their return type. Or if they should show hidden or special files,
> which doesn't require breaking the return. But until then I am to leave the
> behavior alone.

I don't see why any of the functions would exclude dirs, but ls_tmpdir deserves
to be fixed since core postgres dynamically creates dirs there.

Also ... I accidentally changed the behavior: master not only doesn't decend
into dirs, it hides them - that was my original complaint. I propose to *also*
change at least tmpdir and logdir to show dirs, but don't decend. I left
waldir alone for now.

Since v12 ls_tmpdir and since v10 logdir and waldir exclude dirs, I think we
should backpatch documentation to say so.

ISTM pg_ls_tmpdir and ls_logdir should be called with missing_ok=true, since
they're not created until they're used.

--
Justin

Attachment Content-Type Size
v7-0001-BUG-in-errmsg.patch text/x-diff 950 bytes
v7-0002-Document-historic-behavior-about-hiding-directori.patch text/x-diff 1.7 KB
v7-0003-Document-historic-behavior-about-hiding-directori.patch text/x-diff 905 bytes
v7-0004-pg_ls_tmpdir-to-show-directories.patch text/x-diff 12.2 KB
v7-0005-Change-logdir-and-archive_statusdir-to-include-di.patch text/x-diff 4.1 KB
v7-0006-Change-pg_ls_logdir-to-ignore-error-if-initial-to.patch text/x-diff 882 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikita Glukhov 2020-03-07 00:59:15 Re: Ltree syntax improvement
Previous Message Tom Lane 2020-03-06 22:15:09 Re: Re[4]: bool_plperl transform