Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version
Date
Msg-id 694458.1603243042@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version
List pgsql-hackers
Justin Pryzby <pryzby@telsasoft.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



pgsql-hackers by date:

Previous
From: "Shinoda, Noriyoshi (PN Japan A&PS Delivery)"
Date:
Subject: RE: Resetting spilled txn statistics in pg_stat_replication
Next
From: "tsunakawa.takay@fujitsu.com"
Date:
Subject: RE: [Patch] Optimize dropping of relation buffers using dlist