Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly

From: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>, Steve Singer <steve(at)ssinger(dot)info>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Jose Luis Tallon <jltallon(at)adv-solutions(dot)net>
Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
Date: 2021-01-20 18:08:11
Message-ID: 7f51f09d2dd1c92981f898e0a7b2f187@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-01-20 18:54, Alvaro Herrera wrote:
> On 2021-Jan-20, Alvaro Herrera wrote:
>
>> On 2021-Jan-20, Michael Paquier wrote:
>>
>> > +/*
>> > + * This is mostly duplicating ATExecSetTableSpaceNoStorage,
>> > + * which should maybe be factored out to a library function.
>> > + */
>> > Wouldn't it be better to do first the refactoring of 0002 and then
>> > 0001 so as REINDEX can use the new routine, instead of putting that
>> > into a comment?
>>
>> I think merging 0001 and 0002 into a single commit is a reasonable
>> approach.
>
> ... except it doesn't make a lot of sense to have set_rel_tablespace in
> either indexcmds.c or index.c. I think tablecmds.c is a better place
> for it. (I would have thought catalog/storage.c, but that one's not
> the
> right abstraction level it seems.)
>

I did a refactoring of ATExecSetTableSpaceNoStorage() in the 0001. New
function SetRelTablesapce() is placed into the tablecmds.c. Following
0002 gets use of it. Is it close to what you and Michael suggested?

>
> But surely ATExecSetTableSpaceNoStorage should be using this new
> routine. (I first thought 0002 was doing that, since that commit is
> calling itself a "refactoring", but now that I look closer, it's not.)
>

Yeah, this 'refactoring' was initially referring to refactoring of what
Justin added to one of the previous 0001. And it was meant to be merged
with 0001, once agreed, but we got distracted by other stuff.

I have not yet addressed Michael's concerns regarding reindex of
partitions. I am going to look closer on it tomorrow.

Regards
--
Alexey Kondratov

Postgres Professional https://www.postgrespro.com
Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexey Kondratov 2021-01-20 18:10:14 Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
Previous Message Robert Haas 2021-01-20 17:59:21 Re: strange error reporting