Re: pg_upgrade -c cannot be run if old cluster is running

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alain Bourgeois <alain(dot)bourgeois(at)zetes(dot)com>
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: pg_upgrade -c cannot be run if old cluster is running
Date: 2024-09-05 14:57:04
Message-ID: 1845283.1725548224@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

[ Please keep the mailing list cc'd ]

Alain Bourgeois <alain(dot)bourgeois(at)zetes(dot)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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Alain Bourgeois 2024-09-05 15:04:34 RE: pg_upgrade -c cannot be run if old cluster is running
Previous Message Daniel Gustafsson 2024-09-05 13:41:10 Re: pg_upgrade -c cannot be run if old cluster is running