Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace onthe fly - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace onthe fly
Date
Msg-id 20200229145304.GI29456@telsasoft.com
Whole thread Raw
In response to Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace onthe fly  (Alexey Kondratov <a.kondratov@postgrespro.ru>)
Responses Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace onthe fly  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
On Sat, Feb 29, 2020 at 03:35:27PM +0300, Alexey Kondratov wrote:
> Anyway, new version is attached. It is rebased in order to resolve conflicts
> with a recent fix of REINDEX CONCURRENTLY + temp relations, and includes
> this small comment fix.

Thanks for rebasing - I actually started to do that yesterday.

I extracted the bits from your original 0001 patch which handled CLUSTER and
VACUUM FULL.  I don't think if there's any interest in combining that with
ALTER anymore.  On another thread (1), I tried to implement that, and Tom
pointed out problem with the implementation, but also didn't like the idea.

I'm including some proposed fixes, but didn't yet update the docs, errors or
tests for that.  (I'm including your v8 untouched in hopes of not messing up
the cfbot).  My fixes avoid an issue if you try to REINDEX onto pg_default, I
think due to moving system toast indexes.

template1=# REINDEX DATABASE template1 TABLESPACE pg_default;
2020-02-29 08:01:41.835 CST [23382] WARNING:  cannot change tablespace of indexes for mapped relations, skipping all
WARNING:  cannot change tablespace of indexes for mapped relations, skipping all
2020-02-29 08:01:41.894 CST [23382] ERROR:  SMgrRelation hashtable corrupted
2020-02-29 08:01:41.894 CST [23382] STATEMENT:  REINDEX DATABASE template1 TABLESPACE pg_default;
2020-02-29 08:01:41.894 CST [23382] WARNING:  AbortTransaction while in COMMIT state
2020-02-29 08:01:41.895 CST [23382] PANIC:  cannot abort transaction 491, it was already committed

-- 
Justin

(1) https://www.postgresql.org/message-id/flat/20200208150453.GV403%40telsasoft.com

Attachment

pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: [REPORT] Possible Memory Leak Postgres Windows
Next
From: Dave Cramer
Date:
Subject: Re: Binary support for pgoutput plugin