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

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)2ndquadrant(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: 2020-12-04 19:54:15
Message-ID: 20201204195415.GF24052@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 04, 2020 at 09:40:31PM +0300, Alexey Kondratov wrote:
> > I liked the bools, but dropped them so the patch is smaller.
>
> I had a look on 0001 and it looks mostly fine to me except some strange
> mixture of tabs/spaces in the ExecReindex(). There is also a couple of
> meaningful comments:
>
> - options =
> - (verbose ? REINDEXOPT_VERBOSE : 0) |
> - (concurrently ? REINDEXOPT_CONCURRENTLY : 0);
> + if (verbose)
> + params.options |= REINDEXOPT_VERBOSE;
>
> Why do we need this intermediate 'verbose' variable here? We only use it
> once to set a bitmask. Maybe we can do it like this:
>
> params.options |= defGetBoolean(opt) ?
> REINDEXOPT_VERBOSE : 0;

That allows *setting* REINDEXOPT_VERBOSE, but doesn't *unset* it if someone
runs (VERBOSE OFF). So I kept the bools like Michael originally had rather
than writing "else: params.options &= ~REINDEXOPT_VERBOSE"

> See also attached txt file with diff (I wonder can I trick cfbot this way,
> so it does not apply the diff).

Yes, I think that works :)
I believe it looks for *.diff and *.patch.

> + int options; /* bitmask of lowlevel REINDEXOPT_* */
>
> I would prefer if the comment says '/* bitmask of ReindexOption */' as in
> the VacuumOptions, since citing the exact enum type make it easier to
> navigate source code.

Yes, thanks.

This also fixes some minor formatting and rebase issues, including broken doc/.

--
Justin

Attachment Content-Type Size
v33-0001-ExecReindex-and-ReindexParams.patch text/x-diff 16.6 KB
v33-0002-Allow-REINDEX-to-change-tablespace.patch text/x-diff 28.7 KB
v33-0003-Refactor-and-reuse-set_rel_tablespace.patch text/x-diff 5.9 KB
v33-0004-Allow-CLUSTER-and-VACUUM-FULL-to-change-tablespa.patch text/x-diff 23.7 KB
v33-0005-Implement-vacuum-full-cluster-INDEX_TABLESPACE-t.patch text/x-diff 18.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message code 2020-12-04 20:57:03 [PATCH] pg_dumpall options proposal/patch
Previous Message Alvaro Herrera 2020-12-04 19:28:26 Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly