Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxuMT-0006V3-F0 for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Jun 2021 16:43:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lxuMS-0004BG-Bc for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Jun 2021 16:43:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxuMS-0004B8-4B for pgsql-hackers@lists.postgresql.org; Mon, 28 Jun 2021 16:43:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxuMP-0006Qo-TJ for pgsql-hackers@lists.postgresql.org; Mon, 28 Jun 2021 16:43:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 15SGhU5u253123; Mon, 28 Jun 2021 12:43:31 -0400 From: Tom Lane To: Fabien COELHO cc: PostgreSQL Developers Subject: Re: Overflow hazard in pgbench In-reply-to: References: <73927.1624815543@sss.pgh.pa.us> Comments: In-reply-to Fabien COELHO message dated "Mon, 28 Jun 2021 10:13:11 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <253121.1624898610.1@sss.pgh.pa.us> Date: Mon, 28 Jun 2021 12:43:30 -0400 Message-ID: <253122.1624898610@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Fabien COELHO writes: >> I suggest applying the attached in branches that have the required >> functions. > The proposed patch does fix the issue in pgbench TAP test. I'd suggest to > add unlikely() on all these conditions, as already done elsewhere. See > attached version. Done that way, though I'm skeptical that it makes any measurable difference. > I also recompiled after removing manually -fwrapv: Make check, pgbench TAP > tests and check-world all passed. I'm not sure that edge case are well > enough tested in postgres to be sure that all is ok just from these runs > though. Yeah, I'm afraid that in most places it'd take a specifically-designed test case to expose a problem, if there is one. regards, tom lane