Re: Catalog version access

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Vik Fearing <vik(at)postgresfriends(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Catalog version access
Date: 2021-02-22 02:24:07
Message-ID: 20210222022407.ecaygvx2ise6uwyz@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2021-02-21 20:53:52 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> >> If we're going to bother with providing a way
> >> to get this info, we should make it possible to ask the running server.
>
> > In Vik's case there is no running server to ask, IIUC.
>
> Hm. If you're about to initdb or start the server then there's more
> reason to think you can find a matching pg_config. Still, pg_config
> is not going to tell you what is actually in the data directory, so
> it's not clear to me how it helps with "do I need to initdb?".

Imagine trying to run regular tests of HEAD, where the tests require a
large database to be loaded. Re-loading the data for every [few] commits
is prohibitively time consuming, and even just running pg_upgrade is
painful. So you'd like to re-use a "template" data directory with the
data loaded if possible (i.e. no catversion / WAL / ... version bumps),
and a pg_upgrade otherwise.

In such a situation it's easy to access the catalog version for the
existing data directory (pg_controldata, or pg_control_system()) - but
there's no convenient way to figure out what the catversion of the
to-be-tested version will be. Vik's approach to figuring that out was
initdb'ing a throw-away data directory, using pg_controldata, and
discarding that data directory - not pretty. There's no version skew
issue here as far as I can tell, given he's initdbing freshly anyway.

The only argument I see against such an option is that arguably just
grepping for the information in the headers isn't too hard. But that's
then something everybody has to do, there's the issue of plain unix
commands not working on windows, etc.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-02-22 02:28:27 Re: Finding cause of test fails on the cfbot site
Previous Message tsunakawa.takay@fujitsu.com 2021-02-22 01:59:28 RE: Parallel INSERT (INTO ... SELECT ...)