Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8rIC-0005EV-CI for pgsql-committers@arkaria.postgresql.org; Fri, 13 Sep 2019 19:31:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i8rIB-0007I3-7d for pgsql-committers@arkaria.postgresql.org; Fri, 13 Sep 2019 19:31:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8rIB-0007Hq-0j for pgsql-committers@lists.postgresql.org; Fri, 13 Sep 2019 19:31:39 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8rI8-0006hF-AL for pgsql-committers@lists.postgresql.org; Fri, 13 Sep 2019 19:31:38 +0000 Received: by mail-qk1-x741.google.com with SMTP id x134so29316265qkb.0 for ; Fri, 13 Sep 2019 12:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=GcjzJ5w/2XjUGJ8aX2vek2/EZUWrLY3Msh9jLufcCTQ=; b=AkjNOE4GCFM+WIWQE0E+JsaBdvZxQYjmQwHi7Y2M3DZ+MZLvQqzmKKArdVxkdUbup3 VpWRfdlH/6Rtg00MaciCiTztQx1VcA5sngYaa0ZQC09DWNvstfi3Lf6odMfnJGtvhseQ mLWMjn61UKk/E9ulOE2LZk7kP+lHXU1buFRTjzlD7zEskAAQSMeE74LxKiUL924zh2ZU +gM/mIQpwOUjeQDD8Gy4KH3g66J2hKkl2weoMtFQPQEaao9ZcmEbVdhzYepFjiAWsTAY oWI1rc+1ma1VTZ0sHfGeN+m/sPgKSH3Ok6BK0XkCalFZxJvBSUrnaKqhdELJv7NdRjwN eJMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=GcjzJ5w/2XjUGJ8aX2vek2/EZUWrLY3Msh9jLufcCTQ=; b=KYF7aSm4ngyGxCEqVxGHFAoh7pNYV9rQfIIlO1DzrtiIti0aQzt00lrjoa0nj1g3yn 1DziihWuZPQ8DafRwvzJMsNi89MV0/PWrmBl50LFTtSAycBa+p2qvUr5VPqVTqM5Yj+c zvM7uyzcgaTl+aYyfWQUN5MfvPywH7w+KWMMuwapRdhDpLitXuTd8hzkYtNbFQa7l8T1 vryLd1R7U0QhRM/rKrtFUF4wEpkK0yvEFr2Am93N5701JGiuFh2jnY8qK2Ns5z5Gp54w ds33seG/NfHXlxYfUEMmZjFQIdOSsNtRi3A0ySD2jFjz90qbXNXkj/T3/B5JJviQq3Nx ZPjA== X-Gm-Message-State: APjAAAUMAs91cLd/Op/d36ZIbYOPFhqXzrCjM2El7bRR3WTRNO11ZW74 B62mUweDF7krWW+WLNkP4+sJUqvmyjwUuUxjGnNy+nCAbx+Ly1QFvMI5JTzsVU5WrihvQDTs2Um 3s2RkRzZztjwuz1bg7lvtt+LuDi7MRShEFG5Jlfh9h1vgvzdXp9sN+wmPiMQyghcGLTePQm97F9 Wl4HjkEzzVNi9XpPoBVA== X-Google-Smtp-Source: APXvYqzl0mzWaPOJqY3Q5O5xKJTGCYUjxbPdsNnBJLUxMKvAST17tms6lDWnC8QL1bmowTvSaIOb2Q== X-Received: by 2002:a37:8647:: with SMTP id i68mr39386698qkd.306.1568403094435; Fri, 13 Sep 2019 12:31:34 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([179.56.30.174]) by smtp.gmail.com with ESMTPSA id v23sm553082qto.89.2019.09.13.12.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 12:31:34 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 3435812068B; Fri, 13 Sep 2019 16:31:32 -0300 (-03) Date: Fri, 13 Sep 2019 16:31:32 -0300 From: Alvaro Herrera To: Tom Lane Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix progress reporting of CLUSTER / VACUUM FULL Message-ID: <20190913193132.GA18625@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <19795.1568400476@sss.pgh.pa.us> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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