Re: initdb caching during tests
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
Thomas Munro <thomas.munro@gmail.com>,
Robert Haas <robertmhaas@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-22T21:47:24Z
Lists: pgsql-hackers
> On 5 Aug 2023, at 21:56, Andres Freund <andres@anarazel.de> wrote:
> We have some issues with CI on macos and windows being too expensive (more on
> that soon in a separate email), which reminded me of this thread (with
> original title: [1])
>
> I've attached a somewhat cleaned up version of the patch to cache initdb
> across runs. The results are still fairly impressive in my opinion.
>
> One thing I do not like, but don't have a good idea for how to improve, is
> that there's a bunch of duplicated logic in pg_regress.c and Cluster.pm. I've
> tried to move that into initdb.c itself, but that ends up pretty ugly, because
> we need to be a lot more careful about checking whether options are compatible
> etc. I've also thought about just putting this into a separate perl script,
> but right now we still allow basic regression tests without perl being
> available. So I concluded that for now just having the copies is the best
> answer.
I had a look at this today and have been running a lot of tests with it without
finding anything that breaks. The duplicated code is unfortunate, but after
playing around with some options I agree that it's likely the best option.
While looking I did venture down the rabbithole of making it support extra
params as well, but I don't think moving the goalposts there is doing us any
favors, it's clearly chasing diminishing returns.
My only small gripe is that I keep thinking about template databases for CREATE
DATABASE when reading the error messages in this patch, which is clearly not
related to what this does.
+ note("initializing database system by copying initdb template");
I personally would've used cache instead of template in the user facing parts
to keep concepts separated, but thats personal taste.
All in all, I think this is committable as is.
--
Daniel Gustafsson
Commits
-
Don't clean initdb files on template creation failure
- 00edb2061fcf 17.0 landed
-
Avoid non-POSIX cp flags
- 1a4fd77db85a 17.0 landed
-
Use "template" data directory in tests
- 252dcb32397f 17.0 landed
-
tests: Consistently use pg_basebackup -cfast --no-sync to accelerate tests.
- 839f9636b374 15.0 landed