pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version
Date: Wed, 21 Oct 2020 06:54:17 -0500
Message-ID: <20201021115416.GK9241@telsasoft.com> (raw)
In-Reply-To: <694458.1603243042@sss.pgh.pa.us>
References: <20200925005531.GJ23631@telsasoft.com>
	<20201009185325.GA24870@momjian.us>
	<20201009192310.GS17626@telsasoft.com>
	<20201009234251.GA8419@momjian.us>
	<20201015233530.GG3797@momjian.us>
	<20201020230638.GI9241@telsasoft.com>
	<694458.1603243042@sss.pgh.pa.us>

On Tue, Oct 20, 2020 at 09:17:22PM -0400, Tom Lane wrote:
> 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,

You mean rmdir() will fail, returning -1, which my patch will ignore, and the
pg_upgrade will fail, same as it would have before.  The goal of the patch is
to improve the "empty" case, only.

> but if they are, shouldn't the upgrade just work?

It fails in "Restoring global objects", which runs "CREATE TABLESPACE".
| errmsg("directory \"%s\" already in use as a tablespace",

I considered the possibility of changing that, but it seems like this is
specific to pg_upgrade.  I wouldn't want to change the core server just for
that, and it has a good reason for failing in that case:
| * The creation of the version directory prevents more than one tablespace
| * in a single location.

-- 
Justin





view thread (13+ messages)  latest in thread

Message-ID: <20201021115416.GK9241@telsasoft.com>
Permalink:  ../20201021115416.GK9241@telsasoft.com/
Also on:    postgresql.org/message-id/20201021115416.GK9241@telsasoft.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, tgl@sss.pgh.pa.us, bruce@momjian.us
  Subject: Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version
  In-Reply-To: <20201021115416.GK9241@telsasoft.com>

* 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