pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Alexey Kondratov <a.kondratov@postgrespro.ru>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Cc: Steve Singer <steve@ssinger.info>
Cc: pgsql-hackers@lists.postgresql.org, Robert Haas <robertmhaas@gmail.com>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Jose Luis Tallon <jltallon@adv-solutions.net>
Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
Date: Thu, 21 Jan 2021 10:41:46 +0900
Message-ID: <YAjb2kYBKH07H5Xv@paquier.xyz> (raw)
In-Reply-To: <20210120183439.GA21339@alvherre.pgsql>
References: <03f88f70618ce73e75837b6125a143f7@postgrespro.ru>
	<20210120183439.GA21339@alvherre.pgsql>

On Wed, Jan 20, 2021 at 03:34:39PM -0300, Alvaro Herrera wrote:
> On 2021-Jan-20, Alexey Kondratov wrote:
>> Ugh, forgot to attach the patches. Here they are.
> 
> Yeah, looks reasonable.

Patch 0002 still has a whole set of issues as I pointed out a couple
of hours ago, but if we agree on 0001 as being useful if done
independently, I'd rather get that done first.  This way or just
merging both things in a single commit is not a big deal seeing the
amount of code, so I am fine with any approach.  It may be possible
that 0001 requires more changes depending on the work to-be-done for
0002 though?

>> +	/* No work if no change in tablespace. */
>> +	oldTablespaceOid = rd_rel->reltablespace;
>> +	if (tablespaceOid != oldTablespaceOid ||
>> +		(tablespaceOid == MyDatabaseTableSpace && OidIsValid(oldTablespaceOid)))
>> +	{
>> +		/* Update the pg_class row. */
>> +		rd_rel->reltablespace = (tablespaceOid == MyDatabaseTableSpace) ?
>> +			InvalidOid : tablespaceOid;
>> +		CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
>> +
>> +		changed = true;
>> +	}
>> +
>> +	if (changed)
>> +		/* Record dependency on tablespace */
>> +		changeDependencyOnTablespace(RelationRelationId,
>> +									 reloid, rd_rel->reltablespace);
> 
> Why have a separate "if (changed)" block here instead of merging with
> the above?

Yep.

+       if (SetRelTablespace(reloid, newTableSpace))
+               /* Make sure the reltablespace change is visible */
+               CommandCounterIncrement();
At quick glance, I am wondering why you just don't do a CCI within
SetRelTablespace().
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../YAjb2kYBKH07H5Xv@paquier.xyz/2-signature.asc)
  download

view thread (154+ messages)  latest in thread

Message-ID: <YAjb2kYBKH07H5Xv@paquier.xyz>
Permalink:  ../YAjb2kYBKH07H5Xv@paquier.xyz/
Also on:    postgresql.org/message-id/YAjb2kYBKH07H5Xv@paquier.xyz

 · 

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: michael@paquier.xyz, alvherre@alvh.no-ip.org, a.kondratov@postgrespro.ru, pryzby@telsasoft.com, peter.eisentraut@enterprisedb.com, masahiko.sawada@2ndquadrant.com, steve@ssinger.info, robertmhaas@gmail.com, a.korotkov@postgrespro.ru, sawada.mshk@gmail.com, jltallon@adv-solutions.net
  Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
  In-Reply-To: <YAjb2kYBKH07H5Xv@paquier.xyz>

* 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