Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version
От | Justin Pryzby |
---|---|
Тема | Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version |
Дата | |
Msg-id | 20201020230638.GI9241@telsasoft.com обсуждение исходный текст |
Ответ на | Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version (Bruce Momjian <bruce@momjian.us>) |
Ответы |
Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version
|
Список | pgsql-hackers |
On Thu, Oct 15, 2020 at 07:35:30PM -0400, Bruce Momjian wrote: > On Fri, Oct 9, 2020 at 07:42:51PM -0400, Bruce Momjian wrote: > > On Fri, Oct 9, 2020 at 02:23:10PM -0500, Justin Pryzby wrote: > > > In my local branch, I had revised this comment to say: > > > > > > + * Note, v8.4 has no tablespace_suffix, which is fine so long as the version we > > > + * being upgraded *to* has a suffix, since it's not allowed to pg_upgrade from > > > + * a version to the same version if tablespaces are in use. > > > > OK, updated patch attached. Also, from your original patch, I didn't > > need to call canonicalize_path() since we are not comparing paths, and I > > didn't need to include common/relpath.h. I also renamed a variable. > > Patch applied to all supported versions. Thanks for the report, and the 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". That can avoid the need to re-create the new cluster, which I imagine in some scenarios might be bad enough to require aborting the upgrade. I propose only for master branch. This doesn't avoid the need to re-create the new cluster if anything has been restored into it (eg. if pg_tablespace is populated), it just cleans out any empty dirs left behind by a previous pg_upgrade which failed after "restoring global objects" but before copying/linking data into that tablespace. |rm -fr pgsql12.dat pgsql14.dat tblspc; |/usr/lib/postgresql/12/bin/initdb -D pgsql12.dat |./tmp_install/usr/local/pgsql/bin/initdb -D pgsql14.dat |mkdir tblspc tblspc/PG_14_202010201 |echo "CREATE TABLESPACE one LOCATION '`pwd`/tblspc'" |/usr/lib/postgresql/12/bin/postgres --single postgres -D pgsql12.dat-p 5678 -k /tmp |./tmp_install/usr/local/pgsql/bin/pg_upgrade -D pgsql14.dat/ -d pgsql12.dat -b /usr/lib/postgresql/12/bin -- Justin
Вложения
В списке pgsql-hackers по дате отправления: