Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL
Date
Msg-id 19795.1568400476@sss.pgh.pa.us
Whole thread Raw
In response to pgsql: Fix progress reporting of CLUSTER / VACUUM FULL  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL
Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL
List pgsql-committers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Fix progress reporting of CLUSTER / VACUUM FULL

Not a new problem of this patch, exactly, but:
 
 /* Reindex options */
 #define REINDEXOPT_VERBOSE 1 << 0  /* print progress info */
+#define REINDEXOPT_REPORT_PROGRESS 1 << 1  /* report pgstat progress */

Surely these macro definitions are incredibly dangerous due to their
lack of parentheses.

I'd initially thought that we already had bugs in existing usages like

    if (options & REINDEXOPT_VERBOSE)

After consulting a nearby C reference I see that we're accidentally
saved by << having higher priority than &, but this is not safely-
maintainable code.  Expressions like "~REINDEXOPT_VERBOSE" would not
do what one expects.

            regards, tom lane



pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL
Next
From: Alvaro Herrera
Date:
Subject: Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL