Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed at end-of-transaction - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed at end-of-transaction
Date
Msg-id 24244.1585415634@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed atend-of-transaction  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed atend-of-transaction  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
Justin Pryzby <pryzby@telsasoft.com> writes:
> Thanks for fixing my test case and pushing.

The buildfarm just showed up another instability in the test cases
we added:

=========================== regression.diffs ================
diff -U3 /home/bf/build/buildfarm-idiacanthus/HEAD/pgsql.build/../pgsql/src/test/regress/expected/misc_functions.out
/home/bf/build/buildfarm-idiacanthus/HEAD/pgsql.build/src/bin/pg_upgrade/tmp_check/regress/results/misc_functions.out
--- /home/bf/build/buildfarm-idiacanthus/HEAD/pgsql.build/../pgsql/src/test/regress/expected/misc_functions.out
2020-03-1708:14:50.292037956 +0100 
+++
/home/bf/build/buildfarm-idiacanthus/HEAD/pgsql.build/src/bin/pg_upgrade/tmp_check/regress/results/misc_functions.out
2020-03-2813:55:12.490024822 +0100 
@@ -169,11 +169,7 @@

 select (w).size = :segsize as ok
 from (select pg_ls_waldir() w) ss where length((w).name) = 24 limit 1;
- ok
-----
- t
-(1 row)
-
+ERROR:  could not stat file "pg_wal/000000010000000000000078": No such file or directory
 select count(*) >= 0 as ok from pg_ls_archive_statusdir();
  ok
 ----

It's pretty obvious what happened here: concurrent activity renamed or
removed the WAL segment between when we saw it in the directory and
when we tried to stat() it.

This seems like it would be just as much of a hazard for field usage
as it is for regression testing, so I propose that we fix these
directory-scanning functions to silently ignore ENOENT failures from
stat().  Are there any for which we should not do that?

            regards, tom lane



pgsql-hackers by date:

Previous
From: "Ivan N. Taranov"
Date:
Subject: Re: [PATCH] postgresql.conf.sample->postgresql.conf.sample.in
Next
From: Tom Lane
Date:
Subject: Re: Berserk Autovacuum (let's save next Mandrill)