From: Bruce Momjian <bruce@momjian.us>
To: Maxim Boguk <maxim.boguk@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7573: data loss in corner case using delete_old_cluster.sh (pg_upgrade)
Date: Thu, 4 Oct 2012 15:12:01 -0400
Message-ID: <20121004191201.GA11759@momjian.us> (raw)
In-Reply-To: <CAK-MWwQ7+HxYfjV7mrC-c5St305+Nxqpn2=zSvjOYmmgkbCJWw@mail.gmail.com>
References: <E1THPDm-00018c-KT@wrigleys.postgresql.org>
<20121001143018.GB7918@momjian.us>
<CAK-MWwQ7+HxYfjV7mrC-c5St305+Nxqpn2=zSvjOYmmgkbCJWw@mail.gmail.com>
On Thu, Oct 4, 2012 at 10:40:19AM +1000, Maxim Boguk wrote:
>
> > Test database have a bit unusual tablespace layout:
> > main tablespace partition was mounted inside data directory of the old
> > cluster...
> > E.g.:
> > data directory - /var/lib/postgresql/9.2/main
> > main tablespace (another partition mount point) -
> > /var/lib/postgresql/9.2/main/largedb
>
> Can you show us the data directory path of the old and new clusters?
>
>
> --old-datadir=/var/lib/postgresql/9.0/main
> --new-datadir=/var/lib/postgresql/9.2/main
>
> second partition used as tablespace were mounted as:
> /var/lib/postgresql/9.0/main/largedb
>
>
>
> pg_upgrade really doesn't know what is inside that old cluster, so it
> just deletes everything under the data directory.
>
>
> Hmm... may be good idea to try opposite way:
> default directories and files layout in PostgreSQL data directory well
> documented and almost never changes.
> May be instead of rm -rf whole data directory try rm -rf only files and
> directories which sure belong to the PostgreSQL?
>
> Something along with:
> 1)rm -rf base global pg_clog pg_multixact ... and so on
> 2)produce warning if any unusual files left in data directory after that (but
> not delete them).
> 3)delete data directory itself only if that directory completely empty after
> step 1 and 2
>
> PS: I know that solution will be not completely error-prone but it will prevent
> most probably data-loss scenarios. So it's better then nothing.
>
> PS: I also think deleting postgresql.conf and pg_hba.conf from old data
> directory is wrong move too... if admin forget copy pg_hba.conf to the new
> cluster - these settings could be lost forever after delete_old_cluster.sh .
This all seems like a step backwards and adds complexity that will fail.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: bruce@momjian.us, maxim.boguk@gmail.com
Subject: Re: BUG #7573: data loss in corner case using delete_old_cluster.sh (pg_upgrade)
In-Reply-To: <20121004191201.GA11759@momjian.us>
References: <E1THPDm-00018c-KT@wrigleys.postgresql.org> <20121001143018.GB7918@momjian.us> <CAK-MWwQ7+HxYfjV7mrC-c5St305+Nxqpn2=zSvjOYmmgkbCJWw@mail.gmail.com> <20121004191201.GA11759@momjian.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