agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Alexey Kondratov <a.kondratov@postgrespro.ru>
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: Tue, 22 Dec 2020 02:32:05 -0600
Message-ID: <20201222083204.GL30237@telsasoft.com> (raw)
In-Reply-To: <X+GWnexHZdt/aaVl@paquier.xyz>
References: <7ec67c56-2377-cd05-51a0-691104404abe@enterprisedb.com>
	<20201216004517.GA18498@alvherre.pgsql>
	<X9lcV/nYVU5WYf7D@paquier.xyz>
	<X+GWnexHZdt/aaVl@paquier.xyz>

On Tue, Dec 22, 2020 at 03:47:57PM +0900, Michael Paquier wrote:
> On Wed, Dec 16, 2020 at 10:01:11AM +0900, Michael Paquier wrote:
> > On Tue, Dec 15, 2020 at 09:45:17PM -0300, Alvaro Herrera wrote:
> > > I don't like this idea too much, because adding an option causes an ABI
> > > break.  I don't think we commonly add options in backbranches, but it
> > > has happened.  The bitmask is much easier to work with in that regard.
> > 
> > ABI flexibility is a good point here.  I did not consider this point
> > of view.  Thanks!
> 
> FWIW, I have taken a shot at this part of the patch, and finished with
> the attached.  This uses bits32 for the bitmask options and an hex
> style for the bitmask params, while bundling all the flags into
> dedicated structures for all the options that can be extended for the
> tablespace case (or some filtering for REINDEX).

Seems fine, but why do you do memcpy() instead of a structure assignment ?

> @@ -3965,8 +3965,11 @@ reindex_relation(Oid relid, int flags, int options)
>  		 * Note that this should fail if the toast relation is missing, so
>  		 * reset REINDEXOPT_MISSING_OK.
>  		 */
> -		result |= reindex_relation(toast_relid, flags,
> -								   options & ~(REINDEXOPT_MISSING_OK));
> +		ReindexOptions newoptions;
> +
> +		memcpy(&newoptions, options, sizeof(ReindexOptions));
> +		newoptions.flags &= ~(REINDEXOPT_MISSING_OK);
> +		result |= reindex_relation(toast_relid, flags, &newoptions);

Could be newoptions = *options;

Also, this one is going to be subsumed by ExecReindex(), so the palloc will go
away (otherwise I would ask to pass it in from the caller):

> +ReindexOptions *
>  ReindexParseOptions(ParseState *pstate, ReindexStmt *stmt)
>  {
>  	ListCell   *lc;
> -	int			options = 0;
> +	ReindexOptions *options;
>  	bool		concurrently = false;
>  	bool		verbose = false;
>  
> +	options = (ReindexOptions *) palloc0(sizeof(ReindexOptions));
> +

-- 
Justin 





view thread (154+ messages)  latest in thread

Message-ID: <20201222083204.GL30237@telsasoft.com>
Permalink:  ../20201222083204.GL30237@telsasoft.com/
Also on:    postgresql.org/message-id/20201222083204.GL30237@telsasoft.com

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: pryzby@telsasoft.com, michael@paquier.xyz, alvherre@alvh.no-ip.org, peter.eisentraut@enterprisedb.com, a.kondratov@postgrespro.ru, 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: <20201222083204.GL30237@telsasoft.com>

* 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