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

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Alexey Kondratov <a.kondratov@postgrespro.ru>
Cc: Justin Pryzby <pryzby@telsasoft.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Masahiko Sawada <masahiko.sawada@2ndquadrant.com>, Steve Singer <steve@ssinger.info>, pgsql-hackers@lists.postgresql.org, Robert Haas <robertmhaas@gmail.com>, Alexander Korotkov <a.korotkov@postgrespro.ru>, Masahiko Sawada <sawada.mshk@gmail.com>, Jose Luis Tallon <jltallon@adv-solutions.net>
Date: 2021-01-13T08:22:49Z
Lists: pgsql-hackers
On Wed, Dec 23, 2020 at 07:30:35PM +0300, Alexey Kondratov wrote:
> After eyeballing the patch I can add that we should alter this comment:
> 
> 	int	options;	/* bitmask of VacuumOption */
> 
> as you are going to replace VacuumOption with VACOPT_* defs. So this should
> say:
> 
> /* bitmask of VACOPT_* */

Check.

> 
> Also I have found naming to be a bit inconsistent:
>  * we have ReindexOptions, but VacuumParams
>  * and ReindexOptions->flags, but VacuumParams->options

Check.  As ReindexOptions and ClusterOptions are the new members of
the family here, we could change them to use Params instead with
"options" as bits32 internally.

> And the last one, you have used bits32 for Cluster/ReindexOptions, but left
> VacuumParams->options as int. Maybe we should also change it to bits32 for
> consistency?

Yeah, that makes sense.  I'll send an updated patch based on that.
--
Michael

Commits

  1. Add TABLESPACE option to REINDEX

  2. Refactor code in tablecmds.c to check and process tablespace moves

  3. Refactor option handling of CLUSTER, REINDEX and VACUUM

  4. pg_dump: Don't use enums for defining bit mask values

  5. Refactor CLUSTER and REINDEX grammar to use DefElem for option lists

  6. Refactor parsing rules for option lists of EXPLAIN, VACUUM and ANALYZE

  7. Improve tab completion of REINDEX in psql

  8. Fix possible crash during FATAL exit from reindexing.