agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Alexey Kondratov <a.kondratov@postgrespro.ru>
Cc: Alvaro Herrera <alvherre@2ndquadrant.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, 3 Dec 2020 20:46:09 +0100
Message-ID: <14dde730-1d34-260e-fa9d-7664df2d6313@enterprisedb.com> (raw)
In-Reply-To: <X8g9L7ZNymScmziJ@paquier.xyz>
References: <20200909122200.GA2743@paquier.xyz>
	<20200909153629.GG18552@telsasoft.com>
	<a9d64111ffe72f51069d50e90d5bf029@postgrespro.ru>
	<20201031183611.GA22691@telsasoft.com>
	<20201124153123.GO24052@telsasoft.com>
	<X8TYkH2cJHzqFDGM@paquier.xyz>
	<bfc3903c0e30ef4349ec5cfee625d8d5@postgrespro.ru>
	<X8Wun1FBVgcqb6Fb@paquier.xyz>
	<20201201054308.GC24052@telsasoft.com>
	<X8XeRagOdYS3wCkT@paquier.xyz>
	<X8g9L7ZNymScmziJ@paquier.xyz>

A side comment on this patch:  I think using enums as bit mask values is 
bad style.  So changing this:

-/* Reindex options */
-#define REINDEXOPT_VERBOSE (1 << 0) /* print progress info */
-#define REINDEXOPT_REPORT_PROGRESS (1 << 1) /* report pgstat progress */
-#define REINDEXOPT_MISSING_OK (1 << 2) /* skip missing relations */
-#define REINDEXOPT_CONCURRENTLY (1 << 3)   /* concurrent mode */

to this:

+typedef enum ReindexOption
+{
+   REINDEXOPT_VERBOSE = 1 << 0,    /* print progress info */
+   REINDEXOPT_REPORT_PROGRESS = 1 << 1,    /* report pgstat progress */
+   REINDEXOPT_MISSING_OK = 1 << 2, /* skip missing relations */
+   REINDEXOPT_CONCURRENTLY = 1 << 3    /* concurrent mode */
+} ReindexOption;

seems wrong.

There are a couple of more places like this, including the existing 
ClusterOption that this patched moved around, but we should be removing 
those.

My reasoning is that if you look at an enum value of this type, either 
say in a switch statement or a debugger, the enum value might not be any 
of the defined symbols.  So that way you lose all the type checking that 
an enum might give you.

Let's just keep the #define's like it is done in almost all other places.





view thread (154+ messages)  latest in thread

Message-ID: <14dde730-1d34-260e-fa9d-7664df2d6313@enterprisedb.com>
Permalink:  ../14dde730-1d34-260e-fa9d-7664df2d6313@enterprisedb.com/
Also on:    postgresql.org/message-id/14dde730-1d34-260e-fa9d-7664df2d6313@enterprisedb.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: peter.eisentraut@enterprisedb.com, michael@paquier.xyz, pryzby@telsasoft.com, a.kondratov@postgrespro.ru, alvherre@2ndquadrant.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: <14dde730-1d34-260e-fa9d-7664df2d6313@enterprisedb.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