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

From Justin Pryzby
Subject pg_upgrade: fail early if a tablespace dir already exists for new cluster version
Date
Msg-id 20200925005531.GJ23631@telsasoft.com
Whole thread Raw
Responses Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version  (Justin Pryzby <pryzby@telsasoft.com>)
Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
This should be caught during --check, or earlier in the upgrade, rather than
only after dumping the schema.

Typically, the tablespace dir would be left behind by a previous failed upgrade
attempt, causing a cascade of failured upgrades.  I guess I may not be the only
one with a 3 year old wrapper which has a hack to check for this.

|rm -fr pgsql12.dat pgsql13.dat
|/usr/pgsql-12/bin/initdb -D pgsql12.dat --no-sync
|/usr/pgsql-13/bin/initdb -D pgsql13.dat --no-sync
|/usr/pgsql-12/bin/postgres -D pgsql12.dat -c port=5678 -k /tmp
|mkdir tblspc tblspc/PG_13_202007203
|psql -h /tmp -p 5678 postgres -c "CREATE TABLESPACE one LOCATION '/home/pryzbyj/tblspc'"
|/usr/pgsql-13/bin/pg_upgrade -D pgsql13.dat -d pgsql12.dat -b /usr/pgsql-12/bin
|pg_upgrade_utility.log:
|CREATE TABLESPACE "one" OWNER "pryzbyj" LOCATION '/home/pryzbyj/tblspc';
|psql:pg_upgrade_dump_globals.sql:27: ERROR:  directory "/home/pryzbyj/tblspc/PG_13_202007201" already in use as a
tablespace

Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Handing off SLRU fsyncs to the checkpointer
Next
From: Michael Paquier
Date:
Subject: Re: Memory allocation abstraction in pgcrypto