BUG #17333: pgdg postgresql-common pg_upgradecluster duplicate data_directory in configuration file

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: eric(dot)meygret(at)free(dot)fr
Subject: BUG #17333: pgdg postgresql-common pg_upgradecluster duplicate data_directory in configuration file
Date: 2021-12-10 16:41:18
Message-ID: 17333-a00bcda4fab7c6d4@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17333
Logged by: Eric Meygret
Email address: eric(dot)meygret(at)free(dot)fr
PostgreSQL version: 14.1
Operating system: Ubuntu 20.04
Description:

Hello,
first I want to say that this bug could delete all data, and second sorry
for my bad English.

I tried to upgrade a database from 9.6 to 14(but I think it is the same for
any migrations).
in /etc/postgresql/9.6/main/postgresql.conf I have to times data_directory
first default value:
data_directory = '/var/lib/postgresql/9.6/main'
and at the end of file
data_directory = '/postgresql/9.6/main/'

postgresql ignore first value.

when I launch upgrade with
pg_upgradecluster -v 14 --method=link --link 9.6 main /postgresql/14/main/

upgrade copy /etc/postgresql/9.6/main/postgresql.conf to
/etc/postgresql/14/main/postgresql.conf
and replace first occurrence so I have :
data_directory = '/postgresql/14/main/'
and at then end of the configuration file :
data_directory = '/postgresql/9.6/main/'

the upgrade failed and start a pg_dropcluster 14 main and this one use the
last occurrence so delete /postgresql/9.6/main/

and now all data are lost. (thanks to backup before upgrade :) )

hope that my explanation is correct and understandable.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2021-12-10 18:56:04 Re: BUG #17333: pgdg postgresql-common pg_upgradecluster duplicate data_directory in configuration file
Previous Message Tom Lane 2021-12-10 16:39:22 Re: BUG #17330: EXPLAIN hangs and very long query plans