Re: BUG #7573: data loss in corner case using delete_old_cluster.sh (pg_upgrade)

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: maxim(dot)boguk(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7573: data loss in corner case using delete_old_cluster.sh (pg_upgrade)
Date: 2012-10-01 14:30:18
Message-ID: 20121001143018.GB7918@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Sep 28, 2012 at 01:18:26AM +0000, maxim(dot)boguk(at)gmail(dot)com wrote:
> The following bug has been logged on the website:
>
> Bug reference: 7573
> Logged by: Maxim Boguk
> Email address: maxim(dot)boguk(at)gmail(dot)com
> PostgreSQL version: 9.2.0
> Operating system: Linux
> Description:
>
> Hi,
>
> today while performing migration of test database (with no critical data...
> and that was good thing).
> I found very nasty corner case with using delete_old_cluster.sh after
> pg_upgrade.
>
> 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?

pg_upgrade really doesn't know what is inside that old cluster, so it
just deletes everything under the data directory.

I guess I could check if the path of the old cluster somehow matches the
leading path of the new cluster, but I doubt that would be fool-proof
either, e.g. symlinks.

> May be it is good idea to add:
> --one-file-system
> when removing a hierarchy recursively, skip any directory that
> is on a file system different from that of the corresponding command line
> argument
>
> to rm call into that script.
>
> However, it is Linux only feature.
>
> PS: Yes I know that keeping any foreign data inside PostgreSQL data
> directory is bad idea.

I don't see how adding --one-file-system would help us. They could have
place it under the old cluster in the same file system.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2012-10-01 15:06:12 Re: BUG #7534: walreceiver takes long time to detect n/w breakdown
Previous Message Andrew Hastie 2012-10-01 11:14:52 Re: BUG #6758: ./configure script sets HAVE_WCSTOMBS_L 1