pg_upgrade old cluster delete script

Lists: pgsql-hackers
From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: pg_upgrade old cluster delete script
Date: 2013-02-14 05:29:52
Message-ID: 20130214052952.GA10606@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

You might remember this pg_upgrade bug report where the user complained
that user-defined tablespaces _inside_ the old cluster directory were
deleted by the old cluster delete script:

http://www.postgresql.org/message-id/E1THPDm-00018c-KT@wrigleys.postgresql.org

and my reply that we don't want to fix this:

http://www.postgresql.org/message-id/20121004191201.GA11759@momjian.us

However, creating a script that deletes data is never a good idea so I
have created the attached patch to avoid creating the script in these
cases, and issue a message to the user.

The test isn't perfect but it is probably close enough. I don't think
it is worth unlinking a possibly matching filename in such cases.

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

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

Attachment Content-Type Size
pg_upgrade.diff text/x-diff 1.7 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: pg_upgrade old cluster delete script
Date: 2013-02-14 15:55:18
Message-ID: 20130214155518.GA2895@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Feb 14, 2013 at 12:29:52AM -0500, Bruce Momjian wrote:
> You might remember this pg_upgrade bug report where the user complained
> that user-defined tablespaces _inside_ the old cluster directory were
> deleted by the old cluster delete script:
>
> http://www.postgresql.org/message-id/E1THPDm-00018c-KT@wrigleys.postgresql.org
>
> and my reply that we don't want to fix this:
>
> http://www.postgresql.org/message-id/20121004191201.GA11759@momjian.us
>
> However, creating a script that deletes data is never a good idea so I
> have created the attached patch to avoid creating the script in these
> cases, and issue a message to the user.
>
> The test isn't perfect but it is probably close enough. I don't think
> it is worth unlinking a possibly matching filename in such cases.

OK, I have applied a modified version of this patch the uses the
port/path.c functions to do proper path comparison, and decided to
conditionally unlink the script file just in case.

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

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