Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Steele <david(at)pgmasters(dot)net>, 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 (and pg_ls_*)
Date: 2020-12-04 17:23:23
Message-ID: 2168893.1607102603@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
[ v24-0001-Document-historic-behavior-of-links-to-directori.patch ]

The cfbot is unhappy with one of the test cases you added:

6245@@ -259,9 +259,11 @@
6246 select path, filename, type from pg_ls_dir_metadata('.', true, false, true) where path!~'[0-9]|pg_internal.init|global.tmp' order by 1;
6247 path | filename | type
6248 ----------------------------------+-----------------------+------
6249+ PG_VERSION | PG_VERSION | -
6250 base | base | d
6251 base/pgsql_tmp | pgsql_tmp | d
6252 global | global | d
6253+ global/config_exec_params | config_exec_params | -
6254 global/pg_control | pg_control | -
6255 global/pg_filenode.map | pg_filenode.map | -
6256 pg_commit_ts | pg_commit_ts | d
6257@@ -285,7 +287,6 @@
6258 pg_subtrans | pg_subtrans | d
6259 pg_tblspc | pg_tblspc | d
6260 pg_twophase | pg_twophase | d
6261- PG_VERSION | PG_VERSION | -
6262 pg_wal | pg_wal | d
6263 pg_wal/archive_status | archive_status | d
6264 pg_xact | pg_xact | d
6265@@ -293,7 +294,7 @@
6266 postgresql.conf | postgresql.conf | -
6267 postmaster.opts | postmaster.opts | -
6268 postmaster.pid | postmaster.pid | -
6269-(34 rows)
6270+(35 rows)

This shows that (a) the test is sensitive to prevailing collation and
(b) it's not filtering out enough temporary files. Even if those things
were fixed, though, the test would break every time we added/removed
some PGDATA substructure. Worse, it'd also break if say somebody had
edited postgresql.conf and left an editor backup file behind, or when
running in an installation where the configuration files are someplace
else. I think this is way too fragile to be acceptable.

Maybe it could be salvaged by reversing the sense of the WHERE condition
so that instead of trying to blacklist stuff, you whitelist just a small
number of files that should certainly be there.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Borisov 2020-12-04 17:31:14 Re: [PATCH] Covering SPGiST index
Previous Message Bossart, Nathan 2020-12-04 17:17:06 Re: please update ps display for recovery checkpoint