From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL |
Date: | 2019-09-13 19:31:32 |
Message-ID: | 20190913193132.GA18625@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
On 2019-Sep-13, Tom Lane wrote:
> 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.
Fixed back to 9.5, where this macro appeared. I was unable to come up
with a way to search for other occurrences of the same problem :-(
Thanks,
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-09-13 19:40:17 | pgsql: logical decoding: process ASSIGNMENT during snapshot build |
Previous Message | Alvaro Herrera | 2019-09-13 19:30:30 | pgsql: Fix under-parenthesized macro definitions |