Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Andres Freund <andres@anarazel.de>
Cc: Yugo NAGATA <nagata@sraoss.co.jp>, Tom Lane <tgl@sss.pgh.pa.us>, Fabien COELHO <coelho@cri.ensmp.fr>, pgsql-hackers@postgresql.org
Date: 2023-02-17T20:35:12Z
Lists: pgsql-hackers
Attachments
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.
Commits
-
Fix pgbench in prepared mode with an empty pipeline
- 8f5e42d33469 16.0 landed
- 34f51196573c 15.4 landed
-
pgbench: Prepare commands in pipelines in advance
- 663e50e83211 14.8 landed
- 108a22bd14d4 15.3 landed
- 038f586d5f1d 16.0 landed
-
Add -M (query mode) option per ITAGAKI Takahiro
- 49639a7b2c52 8.4.0 cited