Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version
Date: 2020-10-21 01:17:22
Message-ID: 694458.1603243042@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
> I wonder if pg_upgrade should try to rmdir() the tablespace dirs before
> restoring global objects, allowing it to succeed, rather than just "failing
> early".

I'm a little confused about that. If the directories aren't empty,
that will fail, but if they are, shouldn't the upgrade just work?
initdb is not normally unhappy about the target directory existing
if it's empty.

The reason why rmdir-and-recreate is not a great substitute for
"it just works" is that (a) you may lose the intended ownership or
permissions of those dirs, (b) you may lack write permission on their
parent dirs. So cases where the DBA has pre-created the directories
are important to support.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tsunakawa.takay@fujitsu.com 2020-10-21 01:34:23 RE: [Patch] Optimize dropping of relation buffers using dlist
Previous Message Shinoda, Noriyoshi (PN Japan A&PS Delivery) 2020-10-21 01:05:36 RE: Resetting spilled txn statistics in pg_stat_replication