pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Use "template" data directory in tests
2+ messages / 2 participants
[nested] [flat]

* pgsql: Use "template" data directory in tests
@ 2023-08-24 22:09  Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Andres Freund @ 2023-08-24 22:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Use "template" data directory in tests

When running all (or just many) of our tests, a significant portion of both
CPU time and IO is spent running initdb. Most of those initdb runs don't
specify any options influencing properties of the created data directory.

Avoid most of that overhead by creating a "template" data directory, alongside
the temporary installation. Instead of running initdb, pg_regress and tap
tests can copy that data directory. When a tap test specifies options to
initdb, the template data directory is not used. That could be relaxed for
some options, but it's not clear it's worth the effort.

There unfortunately is some duplication between pg_regress.c and Cluster.pm,
but there are no easy ways of sharing that code without introducing additional
complexity.

Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/20220120021859.3zpsfqn4z7ob7afz@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/252dcb32397f64a5e1ceac05b29a271ab19aa960

Modified Files
--------------
.cirrus.tasks.yml                        |  3 +-
meson.build                              | 30 +++++++++++++
src/Makefile.global.in                   | 38 +++++++++-------
src/test/perl/PostgreSQL/Test/Cluster.pm | 46 ++++++++++++++++++-
src/test/regress/pg_regress.c            | 76 +++++++++++++++++++++++++-------
5 files changed, 156 insertions(+), 37 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: Use "template" data directory in tests
@ 2023-08-28 00:36  Michael Paquier <michael@paquier.xyz>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2023-08-28 00:36 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org

Hi Andres,

On Thu, Aug 24, 2023 at 10:09:20PM +0000, Andres Freund wrote:
> Use "template" data directory in tests
> 
> When running all (or just many) of our tests, a significant portion of both
> CPU time and IO is spent running initdb. Most of those initdb runs don't
> specify any options influencing properties of the created data directory.
> 
> Avoid most of that overhead by creating a "template" data directory, alongside
> the temporary installation. Instead of running initdb, pg_regress and tap
> tests can copy that data directory. When a tap test specifies options to
> initdb, the template data directory is not used. That could be relaxed for
> some options, but it's not clear it's worth the effort.

This commit is saving a lot of cycles here.  Thanks for doing that!
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-08-28 00:36 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-08-24 22:09 pgsql: Use "template" data directory in tests Andres Freund <andres@anarazel.de>
2023-08-28 00:36 ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox