pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alain Bourgeois <alain.bourgeois@zetes.com>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: pg_upgrade -c cannot be run if old cluster is running
Date: Thu, 05 Sep 2024 10:57:04 -0400
Message-ID: <1845283.1725548224@sss.pgh.pa.us> (raw)
In-Reply-To: <PAXP191MB17125C74331DB9BCE8CF5DFDF09D2@PAXP191MB1712.EURP191.PROD.OUTLOOK.COM>
References: <172546462173.8361.7114078895863039790@wrigleys.postgresql.org>
	<1692842.1725482754@sss.pgh.pa.us>
	<PAXP191MB1712B2F0354E98E4396CC739F09D2@PAXP191MB1712.EURP191.PROD.OUTLOOK.COM>
	<1827652.1725543542@sss.pgh.pa.us>
	<PAXP191MB171215979D903A2BDF4E207BF09D2@PAXP191MB1712.EURP191.PROD.OUTLOOK.COM>
	<PAXP191MB17125C74331DB9BCE8CF5DFDF09D2@PAXP191MB1712.EURP191.PROD.OUTLOOK.COM>

[ Please keep the mailing list cc'd ]

Alain Bourgeois <alain.bourgeois@zetes.com> writes:
> I confirm copyig config to data dir and specifying data dir works
> /usr/pgsql-15/bin/pg_upgrade --check -b /usr/pgsql-10/bin/ -B /usr/pgsql-15/bin -d /mnt/pgdata/pgdir -D /mnt/pgdata/pgdirbc15 --check

Hm.  On second look, there is code in there that intends to deal
with -d pointing at a configuration-only directory, and it seems
to work for me:

$ pg_upgrade --check -d /home/postgres/version10/config ...etc...
Finding the real data directory for the source cluster      ok
Performing Consistency Checks on Old Live Server
------------------------------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
...

The lack of any comment about "Finding the real data directory"
in your output is suspicious.  I notice that the code that
does this has a short-circuit case that perhaps could get fooled:

    /* If PG_VERSION exists, it can't be a config-only dir */
    snprintf(filename, sizeof(filename), "%s/PG_VERSION", cluster->pgconfig);
    if ((fp = fopen(filename, "r")) != NULL)
    {
        fclose(fp);
        return;
    }

Do you have a PG_VERSION file in /var/lib/pgsql/10/data?
If so, why?

			regards, tom lane





view thread (9+ messages)  latest in thread

Message-ID: <1845283.1725548224@sss.pgh.pa.us>
Permalink:  ../1845283.1725548224@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1845283.1725548224@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alain.bourgeois@zetes.com, pgsql-docs@lists.postgresql.org
  Subject: Re: pg_upgrade -c cannot be run if old cluster is running
  In-Reply-To: <1845283.1725548224@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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