Re: pg_upgrade -c cannot be run if old cluster is running - Mailing list pgsql-docs

From Tom Lane
Subject Re: pg_upgrade -c cannot be run if old cluster is running
Date
Msg-id 1845283.1725548224@sss.pgh.pa.us
Whole thread Raw
In response to pg_upgrade -c cannot be run if old cluster is running  (PG Doc comments form <noreply@postgresql.org>)
Responses RE: pg_upgrade -c cannot be run if old cluster is running
List pgsql-docs
[ 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



pgsql-docs by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: pg_upgrade -c cannot be run if old cluster is running
Next
From: Alain Bourgeois
Date:
Subject: RE: pg_upgrade -c cannot be run if old cluster is running