Re: A test for replay of regression tests

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: A test for replay of regression tests
Date: 2021-10-06 06:10:12
Message-ID: CA+hUKG+stUD8qE6s5uJPpFaTW-5ZADp+Bq2Bhiu+-00j3xz7gg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 10, 2021 at 7:47 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Thu, Jun 10, 2021 at 7:37 PM Anastasia Lubennikova
> <lubennikovaav(at)gmail(dot)com> wrote:
> > For some reason, it failed on cfbot, so I'll switch it back to 'Waiting on

Sorry for the delay. I got stuck in a CI loop trying to make a new
improved version work on Windows, so far without success. If anyone
can tell me what's wrong on that OS I'd be very grateful to hear it.
I don't know if it's something I haven't understood about reparse
points, or something to do with "restricted tokens" and accounts
privileges. The symptoms on Cirrus are:

DROP TABLESPACE regress_tblspacewith;
+WARNING: could not open directory
"pg_tblspc/16386/PG_15_202109101": No such file or directory
+WARNING: could not stat file "pg_tblspc/16386": No such file or directory

The short explanation of this new version is that the tablespace tests
now work on a pair of local nodes because you can do this sort of
thing:

postgres=# create tablespace xxx location 'pg_user_files/xxx';
ERROR: directory "pg_user_files/xxx" does not exist
postgres=# create tablespace xxx new location 'pg_user_files/xxx';
CREATE TABLESPACE

Patches:

0001: Allow restricted relative tablespace paths.

Rationale: I really want to be able to run the tablespace test with a
local replica, instead of just skipping it (including but not only
from this new TAP test). After re-reading a bunch of threads about
how to achieve that that never went anywhere and considering various
ideas already presented, I wondered if we could agree on allowing
relative paths under one specific directory "pg_user_files" (a
directory that PostgreSQL itself will completely ignore). Better
names welcome.

I wonder if for Windows we'd want to switch to real symlinks, since,
as far as I know from some light reading, reparse points are converted
to absolute paths on creation, so the pgdata directory would be less
portable than it would be on POSIX systems.

0002: CREATE TABLESPACE ... NEW LOCATION.

The new syntax "NEW" says that it's OK if the directory doesn't exist
yet, we'll just create it.

Rationale: With relative paths, it's tricky for pg_regress to find
the data directory of the primary server + any streaming replicas that
may be downstream from it (and possibly remote) to create the
directory, but the server can do it easily. Better syntax welcome.
(I originally wanted to use WITH (<something>) but that syntax is
tangled up with persistent relopts.)

0003: Use relative paths for tablespace regression test.

Remove the pg_regress logic for creating the directory, and switch to
relative paths using the above.

0004: Test replay of regression tests.

Same as before, this adds a replicated run of the regression tests in
src/test/recovery/t/027_stream_regress.pl, with an optional expensive
mode that you can enable with
PG_TEST_EXTRA="wal_consistency_checking".

I removed the useless --create-role as pointed out by Anastasia.

I added a step to compare the contents of the primary and replica
servers with pg_dump, as suggested by Tsunakawa-san.

I think the way I pass in the psql source directory to --bindir is not
good, but I've reached my daily limit of Perl; how should I be
specifying the tmp_install bin directory here? This is so pg_regress
can find psql.

system_or_bail("../regress/pg_regress",
"--bindir=../../bin/psql",
"--port=" . $node_primary->port,
"--schedule=../regress/parallel_schedule",
"--dlpath=../regress",
"--inputdir=../regress");

Attachment Content-Type Size
v5-0001-Allow-restricted-relative-tablespace-paths.patch text/x-patch 4.3 KB
v5-0002-CREATE-TABLESPACE-.-NEW-LOCATION.patch text/x-patch 7.6 KB
v5-0003-Use-relative-paths-for-tablespace-regression-test.patch text/x-patch 9.1 KB
v5-0004-Test-replay-of-regression-tests.patch text/x-patch 5.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2021-10-06 06:11:51 Re: Windows crash / abort handling
Previous Message Andres Freund 2021-10-06 06:09:41 Re: Incorrect snapshots while promoting hot standby node when 2PC is used