Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error
Date
Msg-id 20230217203512.eewdaaqpflauorvv@alvherre.pgsql
Whole thread Raw
In response to Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error  (Andres Freund <andres@anarazel.de>)
Responses Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On 2023-Feb-13, Andres Freund wrote:

> There's something wrong with the patch, it reliably fails with core dumps:
> https://cirrus-ci.com/github/postgresql-cfbot/postgresql/commitfest%2F42%2F3260

I think this would happen on machines where sizeof(bool) is not 1 (which
mine is evidently not).  Fixed.

In addition, there was the problem that the psprintf() to generate the
command name would race against each other if you had multiple threads.
I changed the code so that the name to prepare each statement under is
generated when the Command struct is first initialized, which occurs
before the threads are started.  One small issue is that now we use a
single counter for all commands of all scripts, rather than a
script-local counter.  This doesn't seem at all important.


I did realize that Nagata-san was right that we've always prepared the
whole script in advance; that behavior was there already in commit
49639a7b2c52 that introduced -Mprepared.  We've never done each command
just before executing it.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
Y una voz del caos me habló y me dijo
"Sonríe y sé feliz, podría ser peor".
Y sonreí. Y fui feliz.
Y fue peor.

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: wrong query result due to wang plan
Next
From: Jeff Davis
Date:
Subject: Re: Move defaults toward ICU in 16?