agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Alexey Kondratov <a.kondratov@postgrespro.ru>
Cc: Michael Paquier <michael@paquier.xyz>
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: Wed, 20 Jan 2021 15:34:39 -0300
Message-ID: <20210120183439.GA21339@alvherre.pgsql> (raw)
In-Reply-To: <03f88f70618ce73e75837b6125a143f7@postgrespro.ru>

On 2021-Jan-20, Alexey Kondratov wrote:

> On 2021-01-20 21:08, Alexey Kondratov wrote:
> > 
> > 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?
> 
> Ugh, forgot to attach the patches. Here they are.

Yeah, looks reasonable.

> +	/* 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?


-- 
Álvaro Herrera                            39°49'30"S 73°17'W





view thread (154+ messages)  latest in thread

Message-ID: <20210120183439.GA21339@alvherre.pgsql>
Permalink:  ../20210120183439.GA21339@alvherre.pgsql/
Also on:    postgresql.org/message-id/20210120183439.GA21339@alvherre.pgsql

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: alvherre@alvh.no-ip.org, a.kondratov@postgrespro.ru, michael@paquier.xyz, 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: <20210120183439.GA21339@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox