pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: maxim.boguk@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #7573: data loss in corner case using delete_old_cluster.sh (pg_upgrade)
Date: Fri, 28 Sep 2012 01:18:26 +0000
Message-ID: <E1THPDm-00018c-KT@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      7573
Logged by:          Maxim Boguk
Email address:      maxim.boguk@gmail.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

Now funny part: migration was successful but after few days I decided to
clear old cluster data...
I echecked content of delete_old_cluster.sh but found nothing suspicious...
just one string...
rm -rf /var/lib/postgresql/9.2/main

Well I know I should be more careful, but in result that command deleted
whole tablespace data on another partition including 9.2 version
tablespace.

It was surprise...

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.





view thread (4+ messages)  latest in thread

Message-ID: <E1THPDm-00018c-KT@wrigleys.postgresql.org>
Permalink:  ../E1THPDm-00018c-KT@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1THPDm-00018c-KT@wrigleys.postgresql.org

 · 

reply

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: maxim.boguk@gmail.com
  Subject: Re: BUG #7573: data loss in corner case using delete_old_cluster.sh (pg_upgrade)
  In-Reply-To: <E1THPDm-00018c-KT@wrigleys.postgresql.org>
  References: <E1THPDm-00018c-KT@wrigleys.postgresql.org>

* 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